
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>
32 lines
616 B
C
32 lines
616 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
// Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
#include "evswitch.h"
|
|
|
|
bool evswitch__discard(struct evswitch *evswitch, struct evsel *evsel)
|
|
{
|
|
if (evswitch->on && evswitch->discarding) {
|
|
if (evswitch->on != evsel)
|
|
return true;
|
|
|
|
evswitch->discarding = false;
|
|
|
|
if (!evswitch->show_on_off_events)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
if (evswitch->off && !evswitch->discarding) {
|
|
if (evswitch->off != evsel)
|
|
return false;
|
|
|
|
evswitch->discarding = true;
|
|
|
|
if (!evswitch->show_on_off_events)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|