Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373119

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

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/3] perf script: Process event update events
Date 2016-04-07 09:20 +0200
Message-ID <rlcoq-hp-19@gated-at.bofh.it> (permalink)
References <rlcop-hp-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@in.tum.de>
Link: http://lkml.kernel.org/n/tip-5tyy9xeoiyg1nvy32tkjrlv1@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] perf tools: Introduce trim function Jiri Olsa <jolsa@kernel.org> - 2016-04-07 09:20 +0200
  [PATCH 3/3] perf script: Process event update events Jiri Olsa <jolsa@kernel.org> - 2016-04-07 09:20 +0200
    [tip:perf/core] perf script: Process event update events tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-13 09:20 +0200
  Re: [PATCH 1/3] perf tools: Introduce trim function Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 16:00 +0200
    Re: [PATCH 1/3] perf tools: Introduce trim function Jiri Olsa <jolsa@redhat.com> - 2016-04-07 16:10 +0200
      Re: [PATCH 1/3] perf tools: Introduce trim function Milian Wolff <milian.wolff@kdab.com> - 2016-04-07 18:00 +0200
  [tip:perf/core] perf tools: Introduce trim function tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-13 09:20 +0200

csiph-web