binary ftrace buffer format
Hi!
For the past hour or so I've been trying to make Steven's rb-read.pl script [1] work, but not only is it endian-challenged, working only on LE, but also does it seems to have a different idea of the ring buffer format, so even with fixes I can't get it to print proper data.
I'm convinced that it would be trivial to write a program to parse the binary trace buffer, but I can't find a format description. Can somebody point me to one please?
Oh and a tangential question -- that thing seems to work on pages, does that mean I can't trace something larger than a page?
johannes
So, I've gotten this far, manually:
This was on a powerpc 64-bit (big endian) machine, the contents of per_cpu/trace_pipe_raw:
00000000 00 00 02 24 15 cd b4 a0 00 00 00 00 00 00 0f f0 page header: time 2354.007880864, 4080 bytes
00000010 00 00 00 00 item header: type_len == 0, time offset = 0
00 00 00 94 item length: 148 bytes
00 82 event ID 130
11 02 00 00 00 00
00000020 00 00 00 00 00 00 00 00 c0 00 00 01 03 ca 1a 00
00000030 00 1a 70 00 00 00 01 00 00 80 39 e4 01 00 00 00
00000040 00 00 00 00 00 00 01 09 01 00 7c 10 80 00 ec 0f
00000050 80 00 00 00 00 00 01 00 00 00 ff ff ff ff 1a ff
00000060 ff ff 02 ff ff ff 20 34 00 00 e2 34 00 00 c4 ca
00000070 ff ff 94 c9 ff ff 66 f3 ff ff e6 f2 ff ff 00 00
00000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000090 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff
000000a0 ff ff 00 00
00 00 00 00 item header: type_len == 0, time offset == 0
88 78 3d 40 item length???
00 82 event ID 130
11 02at which point it stops making sense. What's with that item length? Can anyone help?
johannes
Quoted 10 lines · Johannes Berg
Hi!
For the past hour or so I've been trying to make Steven's rb-read.pl script [1] work, but not only is it endian-challenged, working only on LE, but also does it seems to have a different idea of the ring buffer format, so even with fixes I can't get it to print proper data.
I'm convinced that it would be trivial to write a program to parse the binary trace buffer, but I can't find a format description. Can somebody point me to one please?
I have a tool called trace-cmd (I'm looking into porting it to the perf tool) but it currently does what you want. I've tested it on both 32 bit and 64 bit systems as well as big and little endians. The files can be created on one system and read on another. It contains data in the files to let other systems know how to read it.
You can get the tool here:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
Quoted 3 lines
Oh and a tangential question -- that thing seems to work on pages, does that mean I can't trace something larger than a page?
Currently, we have not the need to trace more than a page. But this is something that can be changed in the future, but currently we have not had the need, and when it was developed, Linus suggested pages would be fine.
-- Steve
Quoted 5 lines
johannes
Quoted 9 lines · Steven Rostedt
I have a tool called trace-cmd (I'm looking into porting it to the perf tool) but it currently does what you want. I've tested it on both 32 bit and 64 bit systems as well as big and little endians. The files can be created on one system and read on another. It contains data in the files to let other systems know how to read it.
You can get the tool here:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
Nice! I'll give it a whirl, in the meantime I've already found the problem I was looking for though.
Quoted 3 lines
Currently, we have not the need to trace more than a page. But this is something that can be changed in the future, but currently we have not had the need, and when it was developed, Linus suggested pages would be fine.
Fair enough.
johannes
Quoted 3 lines · Steven Rostedt
You can get the tool here:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
Another thing that just crossed my mind -- is this a candidate for tools/ maybe?
johannes
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Steven Rostedt
You can get the tool here:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.gitAnother thing that just crossed my mind -- is this a candidate for
tools/maybe?
Actually, I'm looking at putting this into perf. That way we have one tool with one format. I'll have to work with Ingo to see exactly how this should be done.
-- Steve