diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-07-10 04:58:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-10 11:34:09 -0400 |
commit | 5bf83c29a0ad2e78683c318b607539dbadbf7a3b (patch) | |
tree | 1a32308d45d0ae3eeead2f4143a9cc6c8877d26f /tools/perf/builtin-script.c | |
parent | 26c11206f433ea507a7541f48cb472b85870577e (diff) |
perf script: Add scripting operation process_switch()
Add scripting operation process_switch() to process switch events.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190710085810.1650-18-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 79367087bd18..8f24865596af 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -2289,6 +2289,12 @@ static int process_switch_event(struct perf_tool *tool, | |||
2289 | if (perf_event__process_switch(tool, event, sample, machine) < 0) | 2289 | if (perf_event__process_switch(tool, event, sample, machine) < 0) |
2290 | return -1; | 2290 | return -1; |
2291 | 2291 | ||
2292 | if (scripting_ops && scripting_ops->process_switch) | ||
2293 | scripting_ops->process_switch(event, sample, machine); | ||
2294 | |||
2295 | if (!script->show_switch_events) | ||
2296 | return 0; | ||
2297 | |||
2292 | thread = machine__findnew_thread(machine, sample->pid, | 2298 | thread = machine__findnew_thread(machine, sample->pid, |
2293 | sample->tid); | 2299 | sample->tid); |
2294 | if (thread == NULL) { | 2300 | if (thread == NULL) { |
@@ -2467,7 +2473,7 @@ static int __cmd_script(struct perf_script *script) | |||
2467 | script->tool.mmap = process_mmap_event; | 2473 | script->tool.mmap = process_mmap_event; |
2468 | script->tool.mmap2 = process_mmap2_event; | 2474 | script->tool.mmap2 = process_mmap2_event; |
2469 | } | 2475 | } |
2470 | if (script->show_switch_events) | 2476 | if (script->show_switch_events || (scripting_ops && scripting_ops->process_switch)) |
2471 | script->tool.context_switch = process_switch_event; | 2477 | script->tool.context_switch = process_switch_event; |
2472 | if (script->show_namespace_events) | 2478 | if (script->show_namespace_events) |
2473 | script->tool.namespaces = process_namespaces_event; | 2479 | script->tool.namespaces = process_namespaces_event; |