aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-07-10 11:58:06 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-10 12:34:09 -0300
commit5bf83c29a0ad2e78683c318b607539dbadbf7a3b (patch)
tree1a32308d45d0ae3eeead2f4143a9cc6c8877d26f /tools/perf/builtin-script.c
parentperf scripts python: exported-sql-viewer.py: Use new 'has_calls' column (diff)
downloadlinux-dev-5bf83c29a0ad2e78683c318b607539dbadbf7a3b.tar.xz
linux-dev-5bf83c29a0ad2e78683c318b607539dbadbf7a3b.zip
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.c8
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,
if (perf_event__process_switch(tool, event, sample, machine) < 0)
return -1;
+ if (scripting_ops && scripting_ops->process_switch)
+ scripting_ops->process_switch(event, sample, machine);
+
+ if (!script->show_switch_events)
+ return 0;
+
thread = machine__findnew_thread(machine, sample->pid,
sample->tid);
if (thread == NULL) {
@@ -2467,7 +2473,7 @@ static int __cmd_script(struct perf_script *script)
script->tool.mmap = process_mmap_event;
script->tool.mmap2 = process_mmap2_event;
}
- if (script->show_switch_events)
+ if (script->show_switch_events || (scripting_ops && scripting_ops->process_switch))
script->tool.context_switch = process_switch_event;
if (script->show_namespace_events)
script->tool.namespaces = process_namespaces_event;