aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-14 08:44:07 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-14 08:45:12 -0400
commit8465b05046652cfde3d47692cab2e8ba962f140f (patch)
tree858be3849302875120b805fd43e5a25ddd7823a0 /tools/perf/builtin-report.c
parentc17c2db1f3cea41c3543025905d3582c6937dd95 (diff)
perf report: Print out raw events in hexa
Print out events in hexa dump format, when -D is specified: 0x4868 [0x48]: event: 1 . . ... raw event: size 72 bytes . 0000: 01 00 00 00 00 00 48 00 d4 72 00 00 d4 72 00 00 ......H..r...r. . 0010: 00 00 40 f2 3e 00 00 00 00 30 01 00 00 00 00 00 ..@.>....0..... . 0020: 00 00 00 00 00 00 00 00 2f 75 73 72 2f 6c 69 62 ......../usr/li . 0030: 36 34 2f 6c 69 62 65 6c 66 2d 30 2e 31 34 31 2e 64/libelf-0.141 . 0040: 73 6f 00 00 00 00 00 00 f-0.141 . 0x4868 [0x48]: PERF_EVENT_MMAP 29396: [0x3ef2400000(0x13000) @ (nil)]: /usr/lib64/libelf-0.141.so This helps the debugging of mis-parsing of data files, and helps the addition of new sample/trace formats. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 82fa93b4db99..37515da637f7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1095,9 +1095,43 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head)
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098static void trace_event(event_t *event)
1099{
1100 unsigned char *raw_event = (void *)event;
1101 int i, j;
1102
1103 if (!dump_trace)
1104 return;
1105
1106 dprintf(".\n. ... raw event: size %d bytes\n", event->header.size);
1107
1108 for (i = 0; i < event->header.size; i++) {
1109 if ((i & 15) == 0)
1110 dprintf(". %04x: ", i);
1111
1112 dprintf(" %02x", raw_event[i]);
1113
1114 if (((i & 15) == 15) || i == event->header.size-1) {
1115 dprintf(" ");
1116 for (j = 0; j < 15-(i & 15); j++)
1117 dprintf(" ");
1118 for (j = 0; j < (i & 15); j++) {
1119 if (isprint(raw_event[i-15+j]))
1120 dprintf("%c", raw_event[i-15+j]);
1121 else
1122 dprintf(".");
1123 }
1124 dprintf("\n");
1125 }
1126 }
1127 dprintf(".\n");
1128}
1129
1098static int 1130static int
1099process_event(event_t *event, unsigned long offset, unsigned long head) 1131process_event(event_t *event, unsigned long offset, unsigned long head)
1100{ 1132{
1133 trace_event(event);
1134
1101 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) 1135 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
1102 return process_overflow_event(event, offset, head); 1136 return process_overflow_event(event, offset, head);
1103 1137
@@ -1204,7 +1238,7 @@ more:
1204 1238
1205 size = event->header.size; 1239 size = event->header.size;
1206 1240
1207 dprintf("%p [%p]: event: %d\n", 1241 dprintf("\n%p [%p]: event: %d\n",
1208 (void *)(offset + head), 1242 (void *)(offset + head),
1209 (void *)(long)event->header.size, 1243 (void *)(long)event->header.size,
1210 event->header.type); 1244 event->header.type);