perf evswitch: Move switch logic to use in other tools
Now other tools that want switching can use an evswitch for that, just set it up and add it to the PERF_RECORD_SAMPLE processing function. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: William Cohen <wcohen@redhat.com> Link: https://lkml.kernel.org/n/tip-b1trj1q97qwfv251l66q3noj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -1807,28 +1807,9 @@ static void process_event(struct perf_script *script,
|
||||
if (!show_event(sample, evsel, thread, al))
|
||||
return;
|
||||
|
||||
if (script->evswitch.on && script->evswitch.discarding) {
|
||||
if (script->evswitch.on != evsel)
|
||||
return;
|
||||
if (evswitch__discard(&script->evswitch, evsel))
|
||||
return;
|
||||
|
||||
script->evswitch.discarding = false;
|
||||
|
||||
if (!script->evswitch.show_on_off_events)
|
||||
return;
|
||||
|
||||
goto print_it;
|
||||
}
|
||||
|
||||
if (script->evswitch.off && !script->evswitch.discarding) {
|
||||
if (script->evswitch.off != evsel)
|
||||
goto print_it;
|
||||
|
||||
script->evswitch.discarding = true;
|
||||
|
||||
if (!script->evswitch.show_on_off_events)
|
||||
return;
|
||||
}
|
||||
print_it:
|
||||
++es->samples;
|
||||
|
||||
perf_sample__fprintf_start(sample, thread, evsel,
|
||||
|
Reference in New Issue
Block a user