perf evlist: Fix the class prefix for 'struct evlist' 'add' evsel methods

To differentiate from libperf's 'struct perf_evlist' methods.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2020-06-17 09:16:20 -03:00
parent ce0dc7d222
commit e251abee87
7 changed files with 27 additions and 34 deletions

View File

@ -1319,7 +1319,7 @@ static struct evlist *kvm_live_event_list(void)
*name = '\0'; *name = '\0';
name++; name++;
if (perf_evlist__add_newtp(evlist, sys, name, NULL)) { if (evlist__add_newtp(evlist, sys, name, NULL)) {
pr_err("Failed to add %s tracepoint to the list\n", *events_tp); pr_err("Failed to add %s tracepoint to the list\n", *events_tp);
free(tp); free(tp);
goto out; goto out;

View File

@ -852,7 +852,7 @@ static int record__open(struct record *rec)
* event synthesis. * event synthesis.
*/ */
if (opts->initial_delay || target__has_cpu(&opts->target)) { if (opts->initial_delay || target__has_cpu(&opts->target)) {
if (perf_evlist__add_dummy(evlist)) if (evlist__add_dummy(evlist))
return -ENOMEM; return -ENOMEM;
/* Disable tracking of mmaps on lead event. */ /* Disable tracking of mmaps on lead event. */
@ -2722,7 +2722,7 @@ int cmd_record(int argc, const char **argv)
record.opts.tail_synthesize = true; record.opts.tail_synthesize = true;
if (rec->evlist->core.nr_entries == 0 && if (rec->evlist->core.nr_entries == 0 &&
__perf_evlist__add_default(rec->evlist, !record.opts.no_samples) < 0) { __evlist__add_default(rec->evlist, !record.opts.no_samples) < 0) {
pr_err("Not enough memory for event selector list\n"); pr_err("Not enough memory for event selector list\n");
goto out; goto out;
} }

View File

@ -1679,19 +1679,17 @@ static int add_default_attributes(void)
if (target__has_cpu(&target)) if (target__has_cpu(&target))
default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK; default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;
if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0) if (evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
return -1; return -1;
if (pmu_have_event("cpu", "stalled-cycles-frontend")) { if (pmu_have_event("cpu", "stalled-cycles-frontend")) {
if (perf_evlist__add_default_attrs(evsel_list, if (evlist__add_default_attrs(evsel_list, frontend_attrs) < 0)
frontend_attrs) < 0)
return -1; return -1;
} }
if (pmu_have_event("cpu", "stalled-cycles-backend")) { if (pmu_have_event("cpu", "stalled-cycles-backend")) {
if (perf_evlist__add_default_attrs(evsel_list, if (evlist__add_default_attrs(evsel_list, backend_attrs) < 0)
backend_attrs) < 0)
return -1; return -1;
} }
if (perf_evlist__add_default_attrs(evsel_list, default_attrs1) < 0) if (evlist__add_default_attrs(evsel_list, default_attrs1) < 0)
return -1; return -1;
} }
@ -1701,21 +1699,21 @@ static int add_default_attributes(void)
return 0; return 0;
/* Append detailed run extra attributes: */ /* Append detailed run extra attributes: */
if (perf_evlist__add_default_attrs(evsel_list, detailed_attrs) < 0) if (evlist__add_default_attrs(evsel_list, detailed_attrs) < 0)
return -1; return -1;
if (detailed_run < 2) if (detailed_run < 2)
return 0; return 0;
/* Append very detailed run extra attributes: */ /* Append very detailed run extra attributes: */
if (perf_evlist__add_default_attrs(evsel_list, very_detailed_attrs) < 0) if (evlist__add_default_attrs(evsel_list, very_detailed_attrs) < 0)
return -1; return -1;
if (detailed_run < 3) if (detailed_run < 3)
return 0; return 0;
/* Append very, very detailed run extra attributes: */ /* Append very, very detailed run extra attributes: */
return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs); return evlist__add_default_attrs(evsel_list, very_very_detailed_attrs);
} }
static const char * const stat_record_usage[] = { static const char * const stat_record_usage[] = {

View File

@ -1627,7 +1627,7 @@ int cmd_top(int argc, const char **argv)
goto out_delete_evlist; goto out_delete_evlist;
if (!top.evlist->core.nr_entries && if (!top.evlist->core.nr_entries &&
perf_evlist__add_default(top.evlist) < 0) { evlist__add_default(top.evlist) < 0) {
pr_err("Not enough memory for event selector list\n"); pr_err("Not enough memory for event selector list\n");
goto out_delete_evlist; goto out_delete_evlist;
} }

View File

@ -3917,8 +3917,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
} }
if (trace->sched && if (trace->sched &&
perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime", evlist__add_newtp(evlist, "sched", "sched_stat_runtime", trace__sched_stat_runtime))
trace__sched_stat_runtime))
goto out_error_sched_stat_runtime; goto out_error_sched_stat_runtime;
/* /*
* If a global cgroup was set, apply it to all the events without an * If a global cgroup was set, apply it to all the events without an

View File

@ -79,7 +79,7 @@ struct evlist *perf_evlist__new_default(void)
{ {
struct evlist *evlist = evlist__new(); struct evlist *evlist = evlist__new();
if (evlist && perf_evlist__add_default(evlist)) { if (evlist && evlist__add_default(evlist)) {
evlist__delete(evlist); evlist__delete(evlist);
evlist = NULL; evlist = NULL;
} }
@ -91,7 +91,7 @@ struct evlist *perf_evlist__new_dummy(void)
{ {
struct evlist *evlist = evlist__new(); struct evlist *evlist = evlist__new();
if (evlist && perf_evlist__add_dummy(evlist)) { if (evlist && evlist__add_dummy(evlist)) {
evlist__delete(evlist); evlist__delete(evlist);
evlist = NULL; evlist = NULL;
} }
@ -231,7 +231,7 @@ void perf_evlist__set_leader(struct evlist *evlist)
} }
} }
int __perf_evlist__add_default(struct evlist *evlist, bool precise) int __evlist__add_default(struct evlist *evlist, bool precise)
{ {
struct evsel *evsel = evsel__new_cycles(precise); struct evsel *evsel = evsel__new_cycles(precise);
@ -242,7 +242,7 @@ int __perf_evlist__add_default(struct evlist *evlist, bool precise)
return 0; return 0;
} }
int perf_evlist__add_dummy(struct evlist *evlist) int evlist__add_dummy(struct evlist *evlist)
{ {
struct perf_event_attr attr = { struct perf_event_attr attr = {
.type = PERF_TYPE_SOFTWARE, .type = PERF_TYPE_SOFTWARE,
@ -258,8 +258,7 @@ int perf_evlist__add_dummy(struct evlist *evlist)
return 0; return 0;
} }
static int evlist__add_attrs(struct evlist *evlist, static int evlist__add_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs)
struct perf_event_attr *attrs, size_t nr_attrs)
{ {
struct evsel *evsel, *n; struct evsel *evsel, *n;
LIST_HEAD(head); LIST_HEAD(head);
@ -282,8 +281,7 @@ static int evlist__add_attrs(struct evlist *evlist,
return -1; return -1;
} }
int __perf_evlist__add_default_attrs(struct evlist *evlist, int __evlist__add_default_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs)
struct perf_event_attr *attrs, size_t nr_attrs)
{ {
size_t i; size_t i;
@ -322,8 +320,7 @@ perf_evlist__find_tracepoint_by_name(struct evlist *evlist,
return NULL; return NULL;
} }
int perf_evlist__add_newtp(struct evlist *evlist, int evlist__add_newtp(struct evlist *evlist, const char *sys, const char *name, void *handler)
const char *sys, const char *name, void *handler)
{ {
struct evsel *evsel = evsel__newtp(sys, name); struct evsel *evsel = evsel__newtp(sys, name);

View File

@ -92,20 +92,20 @@ void evlist__delete(struct evlist *evlist);
void evlist__add(struct evlist *evlist, struct evsel *entry); void evlist__add(struct evlist *evlist, struct evsel *entry);
void evlist__remove(struct evlist *evlist, struct evsel *evsel); void evlist__remove(struct evlist *evlist, struct evsel *evsel);
int __perf_evlist__add_default(struct evlist *evlist, bool precise); int __evlist__add_default(struct evlist *evlist, bool precise);
static inline int perf_evlist__add_default(struct evlist *evlist) static inline int evlist__add_default(struct evlist *evlist)
{ {
return __perf_evlist__add_default(evlist, true); return __evlist__add_default(evlist, true);
} }
int __perf_evlist__add_default_attrs(struct evlist *evlist, int __evlist__add_default_attrs(struct evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs); struct perf_event_attr *attrs, size_t nr_attrs);
#define perf_evlist__add_default_attrs(evlist, array) \ #define evlist__add_default_attrs(evlist, array) \
__perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) __evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array))
int perf_evlist__add_dummy(struct evlist *evlist); int evlist__add_dummy(struct evlist *evlist);
int perf_evlist__add_sb_event(struct evlist *evlist, int perf_evlist__add_sb_event(struct evlist *evlist,
struct perf_event_attr *attr, struct perf_event_attr *attr,
@ -116,8 +116,7 @@ int perf_evlist__start_sb_thread(struct evlist *evlist,
struct target *target); struct target *target);
void perf_evlist__stop_sb_thread(struct evlist *evlist); void perf_evlist__stop_sb_thread(struct evlist *evlist);
int perf_evlist__add_newtp(struct evlist *evlist, int evlist__add_newtp(struct evlist *evlist, const char *sys, const char *name, void *handler);
const char *sys, const char *name, void *handler);
int __evlist__set_tracepoints_handlers(struct evlist *evlist, int __evlist__set_tracepoints_handlers(struct evlist *evlist,
const struct evsel_str_handler *assocs, const struct evsel_str_handler *assocs,