Re: Perf record format portability

From: Steven Rostedt
Date: Wed May 16 2012 - 15:32:22 EST


On Wed, 2012-05-16 at 19:48 +0200, Jiri Olsa wrote:

> for ppc64(record) vs x86_64(report) I got following report on latest tip:
>
> [jolsa@dhcp-26-214 test]$ ../perf report > report.target
> Endianness of raw data not corrected!
> Warning:
> 718 samples with id not present in the header
> Warning:
> The perf.data file has no samples!
>
> for following record:
> perf record -a -e sched:sched_switch -e sched:sched_process_exit -e sched:sched_process_fork -e sched:sched_wakeup -- sleep 10
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.178 MB perf.data (~7781 samples) ]
>
> I haven't tried trace-cmd, but I guess let's wait for libparsevents
> perf integration then.. ;)
>

It's in perf. It just needs to be set up.

Look at tools/perf/util/trace-event.h

There's a bigendian() function, a "file_bigendian" and a
"host_bigendian". If perf recorded what endian was used on the target,
and saves that in the perf.dat file, all it needs to do is update the
two variables.

file_bigendian = recorded_endian;
host_bigendian = bigendian();

1 for big endian, 0 for little endian.

Where host is the machine that is running the perf report or script.
After that, all reads of the data in events uses one of the
__data2host() macros to convert if necessary.

Note, latest trace-cmd has put all these in a pevent struct descriptor,
so that different files can be read at the same time, and these files
can be from different endian (and bit size) machines. The global
variables no longer exist.

My patches, that I and Frederic posted previously, convert perf to use
this descriptor so that perf could benefit and read multiple files too.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/