mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
26c11206f4
commit
5bf83c29a0
|
@ -2289,6 +2289,12 @@ static int process_switch_event(struct perf_tool *tool,
|
||||||
if (perf_event__process_switch(tool, event, sample, machine) < 0)
|
if (perf_event__process_switch(tool, event, sample, machine) < 0)
|
||||||
return -1;
|
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,
|
thread = machine__findnew_thread(machine, sample->pid,
|
||||||
sample->tid);
|
sample->tid);
|
||||||
if (thread == NULL) {
|
if (thread == NULL) {
|
||||||
|
@ -2467,7 +2473,7 @@ static int __cmd_script(struct perf_script *script)
|
||||||
script->tool.mmap = process_mmap_event;
|
script->tool.mmap = process_mmap_event;
|
||||||
script->tool.mmap2 = process_mmap2_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;
|
script->tool.context_switch = process_switch_event;
|
||||||
if (script->show_namespace_events)
|
if (script->show_namespace_events)
|
||||||
script->tool.namespaces = process_namespaces_event;
|
script->tool.namespaces = process_namespaces_event;
|
||||||
|
|
|
@ -81,6 +81,9 @@ struct scripting_ops {
|
||||||
struct perf_sample *sample,
|
struct perf_sample *sample,
|
||||||
struct perf_evsel *evsel,
|
struct perf_evsel *evsel,
|
||||||
struct addr_location *al);
|
struct addr_location *al);
|
||||||
|
void (*process_switch)(union perf_event *event,
|
||||||
|
struct perf_sample *sample,
|
||||||
|
struct machine *machine);
|
||||||
void (*process_stat)(struct perf_stat_config *config,
|
void (*process_stat)(struct perf_stat_config *config,
|
||||||
struct perf_evsel *evsel, u64 tstamp);
|
struct perf_evsel *evsel, u64 tstamp);
|
||||||
void (*process_stat_interval)(u64 tstamp);
|
void (*process_stat_interval)(u64 tstamp);
|
||||||
|
|
Loading…
Reference in New Issue