perf evsel: Rename perf_evsel__*filter*() to evsel__*filter*()

As those are not 'struct evsel' methods, not part of tools/lib/perf/,
aka libperf, to whom the perf_ prefix belongs.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 862b2f8f
...@@ -3164,10 +3164,9 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) ...@@ -3164,10 +3164,9 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace)
if (filter == NULL) if (filter == NULL)
goto out_enomem; goto out_enomem;
if (!perf_evsel__append_tp_filter(trace->syscalls.events.sys_enter, if (!evsel__append_tp_filter(trace->syscalls.events.sys_enter, filter)) {
filter)) {
sys_exit = trace->syscalls.events.sys_exit; sys_exit = trace->syscalls.events.sys_exit;
err = perf_evsel__append_tp_filter(sys_exit, filter); err = evsel__append_tp_filter(sys_exit, filter);
} }
free(filter); free(filter);
...@@ -3801,7 +3800,7 @@ static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel ...@@ -3801,7 +3800,7 @@ static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel
if (new_filter != evsel->filter) { if (new_filter != evsel->filter) {
pr_debug("New filter for %s: %s\n", evsel->name, new_filter); pr_debug("New filter for %s: %s\n", evsel->name, new_filter);
perf_evsel__set_filter(evsel, new_filter); evsel__set_filter(evsel, new_filter);
free(new_filter); free(new_filter);
} }
......
...@@ -2522,7 +2522,7 @@ static int parse_addr_filter(struct evsel *evsel, const char *filter, ...@@ -2522,7 +2522,7 @@ static int parse_addr_filter(struct evsel *evsel, const char *filter,
goto out_exit; goto out_exit;
} }
if (perf_evsel__append_addr_filter(evsel, new_filter)) { if (evsel__append_addr_filter(evsel, new_filter)) {
err = -ENOMEM; err = -ENOMEM;
goto out_exit; goto out_exit;
} }
...@@ -2540,7 +2540,7 @@ static int parse_addr_filter(struct evsel *evsel, const char *filter, ...@@ -2540,7 +2540,7 @@ static int parse_addr_filter(struct evsel *evsel, const char *filter,
return err; return err;
} }
static int perf_evsel__nr_addr_filter(struct evsel *evsel) static int evsel__nr_addr_filter(struct evsel *evsel)
{ {
struct perf_pmu *pmu = evsel__find_pmu(evsel); struct perf_pmu *pmu = evsel__find_pmu(evsel);
int nr_addr_filters = 0; int nr_addr_filters = 0;
...@@ -2561,7 +2561,7 @@ int auxtrace_parse_filters(struct evlist *evlist) ...@@ -2561,7 +2561,7 @@ int auxtrace_parse_filters(struct evlist *evlist)
evlist__for_each_entry(evlist, evsel) { evlist__for_each_entry(evlist, evsel) {
filter = evsel->filter; filter = evsel->filter;
max_nr = perf_evsel__nr_addr_filter(evsel); max_nr = evsel__nr_addr_filter(evsel);
if (!filter || !max_nr) if (!filter || !max_nr)
continue; continue;
evsel->filter = NULL; evsel->filter = NULL;
......
...@@ -995,7 +995,7 @@ int perf_evlist__set_tp_filter(struct evlist *evlist, const char *filter) ...@@ -995,7 +995,7 @@ int perf_evlist__set_tp_filter(struct evlist *evlist, const char *filter)
if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT) if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT)
continue; continue;
err = perf_evsel__set_filter(evsel, filter); err = evsel__set_filter(evsel, filter);
if (err) if (err)
break; break;
} }
...@@ -1015,7 +1015,7 @@ int perf_evlist__append_tp_filter(struct evlist *evlist, const char *filter) ...@@ -1015,7 +1015,7 @@ int perf_evlist__append_tp_filter(struct evlist *evlist, const char *filter)
if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT) if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT)
continue; continue;
err = perf_evsel__append_tp_filter(evsel, filter); err = evsel__append_tp_filter(evsel, filter);
if (err) if (err)
break; break;
} }
......
...@@ -1166,7 +1166,7 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts, ...@@ -1166,7 +1166,7 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
evsel__reset_sample_bit(evsel, BRANCH_STACK); evsel__reset_sample_bit(evsel, BRANCH_STACK);
} }
int perf_evsel__set_filter(struct evsel *evsel, const char *filter) int evsel__set_filter(struct evsel *evsel, const char *filter)
{ {
char *new_filter = strdup(filter); char *new_filter = strdup(filter);
...@@ -1179,13 +1179,12 @@ int perf_evsel__set_filter(struct evsel *evsel, const char *filter) ...@@ -1179,13 +1179,12 @@ int perf_evsel__set_filter(struct evsel *evsel, const char *filter)
return -1; return -1;
} }
static int perf_evsel__append_filter(struct evsel *evsel, static int evsel__append_filter(struct evsel *evsel, const char *fmt, const char *filter)
const char *fmt, const char *filter)
{ {
char *new_filter; char *new_filter;
if (evsel->filter == NULL) if (evsel->filter == NULL)
return perf_evsel__set_filter(evsel, filter); return evsel__set_filter(evsel, filter);
if (asprintf(&new_filter, fmt, evsel->filter, filter) > 0) { if (asprintf(&new_filter, fmt, evsel->filter, filter) > 0) {
free(evsel->filter); free(evsel->filter);
...@@ -1196,14 +1195,14 @@ static int perf_evsel__append_filter(struct evsel *evsel, ...@@ -1196,14 +1195,14 @@ static int perf_evsel__append_filter(struct evsel *evsel,
return -1; return -1;
} }
int perf_evsel__append_tp_filter(struct evsel *evsel, const char *filter) int evsel__append_tp_filter(struct evsel *evsel, const char *filter)
{ {
return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter); return evsel__append_filter(evsel, "(%s) && (%s)", filter);
} }
int perf_evsel__append_addr_filter(struct evsel *evsel, const char *filter) int evsel__append_addr_filter(struct evsel *evsel, const char *filter)
{ {
return perf_evsel__append_filter(evsel, "%s,%s", filter); return evsel__append_filter(evsel, "%s,%s", filter);
} }
/* Caller has to clear disabled after going through all CPUs. */ /* Caller has to clear disabled after going through all CPUs. */
......
...@@ -225,10 +225,9 @@ void __evsel__reset_sample_bit(struct evsel *evsel, enum perf_event_sample_forma ...@@ -225,10 +225,9 @@ void __evsel__reset_sample_bit(struct evsel *evsel, enum perf_event_sample_forma
void evsel__set_sample_id(struct evsel *evsel, bool use_sample_identifier); void evsel__set_sample_id(struct evsel *evsel, bool use_sample_identifier);
int perf_evsel__set_filter(struct evsel *evsel, const char *filter); int evsel__set_filter(struct evsel *evsel, const char *filter);
int perf_evsel__append_tp_filter(struct evsel *evsel, const char *filter); int evsel__append_tp_filter(struct evsel *evsel, const char *filter);
int perf_evsel__append_addr_filter(struct evsel *evsel, int evsel__append_addr_filter(struct evsel *evsel, const char *filter);
const char *filter);
int evsel__enable_cpu(struct evsel *evsel, int cpu); int evsel__enable_cpu(struct evsel *evsel, int cpu);
int evsel__enable(struct evsel *evsel); int evsel__enable(struct evsel *evsel);
int evsel__disable(struct evsel *evsel); int evsel__disable(struct evsel *evsel);
......
...@@ -2261,7 +2261,7 @@ static int set_filter(struct evsel *evsel, const void *arg) ...@@ -2261,7 +2261,7 @@ static int set_filter(struct evsel *evsel, const void *arg)
} }
if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT) { if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT) {
if (perf_evsel__append_tp_filter(evsel, str) < 0) { if (evsel__append_tp_filter(evsel, str) < 0) {
fprintf(stderr, fprintf(stderr,
"not enough memory to hold filter string\n"); "not enough memory to hold filter string\n");
return -1; return -1;
...@@ -2286,7 +2286,7 @@ static int set_filter(struct evsel *evsel, const void *arg) ...@@ -2286,7 +2286,7 @@ static int set_filter(struct evsel *evsel, const void *arg)
return -1; return -1;
} }
if (perf_evsel__append_addr_filter(evsel, str) < 0) { if (evsel__append_addr_filter(evsel, str) < 0) {
fprintf(stderr, fprintf(stderr,
"not enough memory to hold filter string\n"); "not enough memory to hold filter string\n");
return -1; return -1;
...@@ -2317,7 +2317,7 @@ static int add_exclude_perf_filter(struct evsel *evsel, ...@@ -2317,7 +2317,7 @@ static int add_exclude_perf_filter(struct evsel *evsel,
snprintf(new_filter, sizeof(new_filter), "common_pid != %d", getpid()); snprintf(new_filter, sizeof(new_filter), "common_pid != %d", getpid());
if (perf_evsel__append_tp_filter(evsel, new_filter) < 0) { if (evsel__append_tp_filter(evsel, new_filter) < 0) {
fprintf(stderr, fprintf(stderr,
"not enough memory to hold filter string\n"); "not enough memory to hold filter string\n");
return -1; return -1;
......
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