Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Question about importing a multi-cpu perf capture in TraceCompass

Sounds like ITmfTrace.getCpu() was not such a bad idea after all ;)


On 2015-12-18 03:50 PM, Matthew Khouzam wrote:
Jerome, could you try to change the file CtfCpuAspect.java in
tmf.ctf.core to this

/*******************************************************************************
  * Copyright (c) 2014, 2015 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
  *   Alexandre Montplaisir - Initial API and implementation
  *******************************************************************************/

package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;

import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;

/**
  * "CPU" event aspect for CTF traces.
  *
  * @author Alexandre Montplaisir
  */
public class CtfCpuAspect extends TmfCpuAspect {

     @Override
     public Integer resolve(ITmfEvent event) {
         if (!(event instanceof CtfTmfEvent)) {
             return null;
         }
         int cpu = ((CtfTmfEvent) event).getCPU();
         if (cpu == 0) {
             final ITmfEventField field =
event.getContent().getField("perf_cpu");
             if (field != null) {
                 final Object value = field.getValue();
                 if (value instanceof Long) {
                     cpu = (int) value;
                 }
             }
         }
         return cpu;
     }
}


It seems to work here. I want to confirm before productifying the patch.

On 15-12-18 09:46 AM, Jerome CORRENOZ wrote:
Hi,

I’m starting to use TraceCompass to import a perf trace.

I have a problem with multi-CPU. Indeed, the trace has been captured
on a multi-CPU but all the events seem to be associated to CPU0 (see
the table view, column “CPU”) whereas the “Contents” correctly
contains the “perf_cpu=X”. This impacts the “Resources” view where
only CPU0 is displayed but mainly the “Control Flow” view.

I’m using:

-    perf 4.1.1 on ARMv7

-    TraceCompass 1.1.0

Doing the following:

#perf record –e ‘sched :*’ –a

#perf data convert –to-ctf=./ctf

Then Open the ctf file (called perf_stream_0) in TraceCompass

Any ideas about the cause of it ?

BR,

   Jerome




Back to the top