aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/dlfilter.c9
-rw-r--r--tools/perf/util/dlfilter.h21
-rw-r--r--tools/perf/util/perf_dlfilter.h6
3 files changed, 32 insertions, 4 deletions
diff --git a/tools/perf/util/dlfilter.c b/tools/perf/util/dlfilter.c
index 03c4bf150656..e93c49c07999 100644
--- a/tools/perf/util/dlfilter.c
+++ b/tools/perf/util/dlfilter.c
@@ -175,6 +175,7 @@ static int dlfilter__open(struct dlfilter *d)
}
d->start = dlsym(d->handle, "start");
d->filter_event = dlsym(d->handle, "filter_event");
+ d->filter_event_early = dlsym(d->handle, "filter_event_early");
d->stop = dlsym(d->handle, "stop");
d->fns = dlsym(d->handle, "perf_dlfilter_fns");
if (d->fns)
@@ -251,7 +252,8 @@ int dlfilter__do_filter_event(struct dlfilter *d,
struct evsel *evsel,
struct machine *machine,
struct addr_location *al,
- struct addr_location *addr_al)
+ struct addr_location *addr_al,
+ bool early)
{
struct perf_dlfilter_sample d_sample;
struct perf_dlfilter_al d_ip_al;
@@ -322,7 +324,10 @@ int dlfilter__do_filter_event(struct dlfilter *d,
d->ctx_valid = true;
- ret = d->filter_event(d->data, &d_sample, d);
+ if (early)
+ ret = d->filter_event_early(d->data, &d_sample, d);
+ else
+ ret = d->filter_event(d->data, &d_sample, d);
d->ctx_valid = false;
diff --git a/tools/perf/util/dlfilter.h b/tools/perf/util/dlfilter.h
index 22b7636028dd..a994560e563d 100644
--- a/tools/perf/util/dlfilter.h
+++ b/tools/perf/util/dlfilter.h
@@ -40,6 +40,9 @@ struct dlfilter {
int (*filter_event)(void *data,
const struct perf_dlfilter_sample *sample,
void *ctx);
+ int (*filter_event_early)(void *data,
+ const struct perf_dlfilter_sample *sample,
+ void *ctx);
struct perf_dlfilter_fns *fns;
};
@@ -54,7 +57,8 @@ int dlfilter__do_filter_event(struct dlfilter *d,
struct evsel *evsel,
struct machine *machine,
struct addr_location *al,
- struct addr_location *addr_al);
+ struct addr_location *addr_al,
+ bool early);
void dlfilter__cleanup(struct dlfilter *d);
@@ -68,7 +72,20 @@ static inline int dlfilter__filter_event(struct dlfilter *d,
{
if (!d || !d->filter_event)
return 0;
- return dlfilter__do_filter_event(d, event, sample, evsel, machine, al, addr_al);
+ return dlfilter__do_filter_event(d, event, sample, evsel, machine, al, addr_al, false);
+}
+
+static inline int dlfilter__filter_event_early(struct dlfilter *d,
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct evsel *evsel,
+ struct machine *machine,
+ struct addr_location *al,
+ struct addr_location *addr_al)
+{
+ if (!d || !d->filter_event_early)
+ return 0;
+ return dlfilter__do_filter_event(d, event, sample, evsel, machine, al, addr_al, true);
}
#endif
diff --git a/tools/perf/util/perf_dlfilter.h b/tools/perf/util/perf_dlfilter.h
index 82833ee8680d..f7a847fdee59 100644
--- a/tools/perf/util/perf_dlfilter.h
+++ b/tools/perf/util/perf_dlfilter.h
@@ -120,4 +120,10 @@ int stop(void *data, void *ctx);
*/
int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx);
+/*
+ * The same as 'filter_event' except it is called before internal
+ * filtering.
+ */
+int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, void *ctx);
+
#endif