Dump user data event in perf report -D, looks like this:

  0x25de3e [0x58]: event: 17
  .
  . ... raw event: size 88 bytes
  .  0000:  11 00 00 00 00 00 58 00 20 00 10 00 00 00 00 00  ......X. .......

  SNIP

  1214276524830 0x25de3e [0x58]: PERF_RECORD_USER_DATA 29014/29014: type: 
0x100020, id 5
  ... FP chain: nr:5
  .....  0: fffffffffffffe00
  .....  1: 00007fadc451cd77
  .....  2: 00007fadc4504eb1
  .....  3: 00007fadc451af0f
  .....  4: 0000000000000040

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
 tools/perf/util/session.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index cb910ea6f0a0..218b36e76d4d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1164,6 +1164,24 @@ static void dump_read(struct perf_evsel *evsel, union 
perf_event *event)
                printf("... id           : %" PRIu64 "\n", read_event->id);
 }
 
+static void
+dump_user_data(union perf_event *event, struct perf_sample *sample)
+{
+       u64 type;
+
+       if (!dump_trace)
+               return;
+
+       printf(" %d/%d: type: %#" PRIx64 ", id %" PRIu64 "\n",
+              sample->pid, sample->tid, event->user_data.type,
+              sample->user_data_id);
+
+       type = event->user_data.type;
+
+       if (type & PERF_SAMPLE_CALLCHAIN)
+               callchain__printf(sample);
+}
+
 static struct machine *machines__find_for_cpumode(struct machines *machines,
                                               union perf_event *event,
                                               struct perf_sample *sample)
@@ -1286,6 +1304,7 @@ static int machines__deliver_event(struct machines 
*machines,
                }
                return perf_evlist__deliver_sample(evlist, tool, event, sample, 
evsel, machine);
        case PERF_RECORD_USER_DATA:
+               dump_user_data(event, sample);
                return tool->user_data(tool, event, sample, evsel, machine);
        case PERF_RECORD_MMAP:
                return tool->mmap(tool, event, sample, machine);
-- 
2.13.6

Reply via email to