[PATCH 3/3] perf script: Process event update events

From: Jiri Olsa
Date: Thu Apr 07 2016 - 03:11:39 EST


Andreas reported following command produces no output:

$ cat test.py
#!/usr/bin/env python

def stat__krava(cpu, thread, time, val, ena, run):
print "event %s cpu %d, thread %d, time %d, val %d, ena %d, run %d" % \
("krava", cpu, thread, time, val, ena, run)
$ perf stat -a -I 1000 -e cycles,"cpu/config=0x6530160,name=krava/" record | perf script -s test.py

The reason is that perf script does not process event update
events and will never get the event name update thus the
python callback is never called.

The fix is just to add already existing callback we use
in the perf stat report.

Reported-by: Andreas Hollmann <hollmann@xxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-5tyy9xeoiyg1nvy32tkjrlv1@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-script.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 3770c3dffe5e..59009aa7e2ca 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1961,6 +1961,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
.exit = perf_event__process_exit,
.fork = perf_event__process_fork,
.attr = process_attr,
+ .event_update = perf_event__process_event_update,
.tracing_data = perf_event__process_tracing_data,
.build_id = perf_event__process_build_id,
.id_index = perf_event__process_id_index,
--
2.4.11