perf evsel: Rename set_filter to apply_filter

We need to be able to go on constructing a complex filter in multiple
stages, since we can only set one filter per event.

For instance, we need to be able, in 'perf trace' to filter by the
'common_pid' field all the time, if only for the tracer itself, to
avoid a feedback loop, and, in addition, we may want to filter the
raw_syscalls:sys_{enter,exit} events by its 'id' filter, when using
'perf trace -e open,close' or 'perf trace -e !open,close', i.e. when
we are interested in just a subset of syscalls or when we are not
interested in it.

So we will have:

   perf_evsel__set_filter(evsel, char *filter)

       Replaces whatever is in evsel->filter.

   perf_evsel__append_filter(evsel, const char *op, char *filter)

       Appends, using op ("&&" or "||") with what is in evsel->filter.

   perf_evsel__apply_filter(evsel, filter):

        That actually applies a filter, be it the one being
        constructed in evsel->filter, or any other, for tools
        with more specific ways to build the filter, issuing
        the appropriate ioctl for all the evsel fds.

The same changes will be made to the evlist__{set,apply} variants to
keep everything consistent.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-2s5z9xtpnc2lwio3cv5x0jek@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8b3ce757
...@@ -1161,7 +1161,7 @@ int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **e ...@@ -1161,7 +1161,7 @@ int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **e
if (evsel->filter == NULL) if (evsel->filter == NULL)
continue; continue;
err = perf_evsel__set_filter(evsel, ncpus, nthreads, evsel->filter); err = perf_evsel__apply_filter(evsel, ncpus, nthreads, evsel->filter);
if (err) { if (err) {
*err_evsel = evsel; *err_evsel = evsel;
break; break;
...@@ -1179,7 +1179,7 @@ int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter) ...@@ -1179,7 +1179,7 @@ int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter)
nthreads = thread_map__nr(evlist->threads); nthreads = thread_map__nr(evlist->threads);
evlist__for_each(evlist, evsel) { evlist__for_each(evlist, evsel) {
err = perf_evsel__set_filter(evsel, ncpus, nthreads, filter); err = perf_evsel__apply_filter(evsel, ncpus, nthreads, filter);
if (err) if (err)
break; break;
} }
......
...@@ -815,7 +815,7 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, int ncpus, int nthrea ...@@ -815,7 +815,7 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, int ncpus, int nthrea
return 0; return 0;
} }
int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
const char *filter) const char *filter)
{ {
return perf_evsel__run_ioctl(evsel, ncpus, nthreads, return perf_evsel__run_ioctl(evsel, ncpus, nthreads,
......
...@@ -182,7 +182,7 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel, ...@@ -182,7 +182,7 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
void perf_evsel__set_sample_id(struct perf_evsel *evsel, void perf_evsel__set_sample_id(struct perf_evsel *evsel,
bool use_sample_identifier); bool use_sample_identifier);
int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
const char *filter); const char *filter);
int perf_evsel__enable(struct perf_evsel *evsel, int ncpus, int nthreads); int perf_evsel__enable(struct perf_evsel *evsel, int ncpus, int nthreads);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment