Skip to content
  • Jiri Olsa's avatar
    perf evsel: Fix swap for samples with raw data · f9d8adb3
    Jiri Olsa authored
    
    
    When we detect a different endianity we swap event before processing.
    It's tricky for samples because we have no idea what's inside. We treat
    it as an array of u64s, swap them and later on we swap back parts which
    are different.
    
    We mangle this way also the tracepoint raw data, which ends up in report
    showing wrong data:
    
      1.95%  comm=Q^B pid=29285 prio=16777216 target_cpu=000
      1.67%  comm=l^B pid=0 prio=16777216 target_cpu=000
    
    Luckily the traceevent library handles the endianity by itself (thank
    you Steven!), so we can pass the RAW data directly in the other
    endianity.
    
      2.51%  comm=beah-rhts-task pid=1175 prio=120 target_cpu=002
      2.23%  comm=kworker/0:0 pid=11566 prio=120 target_cpu=000
    
    The fix is basically to swap back the raw data if different endianity is
    detected.
    
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Link: http://lkml.kernel.org/r/20171129184346.3656-1-jolsa@kernel.org
    
    
    [ Add util/memswap.c to python-ext-sources to link missing mem_bswap_64() ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    f9d8adb3