perf evsel: Rename perf_evsel__new*() to evsel__new*()

As these are '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: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2020-05-06 13:27:04 -03:00
parent 35ac0cad7d
commit 8f6725a2c9
12 changed files with 32 additions and 33 deletions

View File

@ -461,11 +461,11 @@ static int evsel__init_raw_syscall_tp(struct evsel *evsel, void *handler)
static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *handler) static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *handler)
{ {
struct evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); struct evsel *evsel = evsel__newtp("raw_syscalls", direction);
/* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */
if (IS_ERR(evsel)) if (IS_ERR(evsel))
evsel = perf_evsel__newtp("syscalls", direction); evsel = evsel__newtp("syscalls", direction);
if (IS_ERR(evsel)) if (IS_ERR(evsel))
return NULL; return NULL;
@ -3045,7 +3045,7 @@ static bool evlist__add_vfs_getname(struct evlist *evlist)
return found; return found;
} }
static struct evsel *perf_evsel__new_pgfault(u64 config) static struct evsel *evsel__new_pgfault(u64 config)
{ {
struct evsel *evsel; struct evsel *evsel;
struct perf_event_attr attr = { struct perf_event_attr attr = {
@ -3841,7 +3841,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
} }
if ((trace->trace_pgfaults & TRACE_PFMAJ)) { if ((trace->trace_pgfaults & TRACE_PFMAJ)) {
pgfault_maj = perf_evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MAJ); pgfault_maj = evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MAJ);
if (pgfault_maj == NULL) if (pgfault_maj == NULL)
goto out_error_mem; goto out_error_mem;
evsel__config_callchain(pgfault_maj, &trace->opts, &callchain_param); evsel__config_callchain(pgfault_maj, &trace->opts, &callchain_param);
@ -3849,7 +3849,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
} }
if ((trace->trace_pgfaults & TRACE_PFMIN)) { if ((trace->trace_pgfaults & TRACE_PFMIN)) {
pgfault_min = perf_evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MIN); pgfault_min = evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MIN);
if (pgfault_min == NULL) if (pgfault_min == NULL)
goto out_error_mem; goto out_error_mem;
evsel__config_callchain(pgfault_min, &trace->opts, &callchain_param); evsel__config_callchain(pgfault_min, &trace->opts, &callchain_param);

View File

@ -35,11 +35,11 @@ static int perf_evsel__test_field(struct evsel *evsel, const char *name,
int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused) int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct evsel *evsel = perf_evsel__newtp("sched", "sched_switch"); struct evsel *evsel = evsel__newtp("sched", "sched_switch");
int ret = 0; int ret = 0;
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel)); pr_debug("evsel__newtp failed with %ld\n", PTR_ERR(evsel));
return -1; return -1;
} }
@ -66,10 +66,10 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
evsel__delete(evsel); evsel__delete(evsel);
evsel = perf_evsel__newtp("sched", "sched_wakeup"); evsel = evsel__newtp("sched", "sched_wakeup");
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel)); pr_debug("evsel__newtp failed with %ld\n", PTR_ERR(evsel));
return -1; return -1;
} }

View File

@ -79,9 +79,9 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
char name[64]; char name[64];
snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]); snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]);
evsels[i] = perf_evsel__newtp("syscalls", name); evsels[i] = evsel__newtp("syscalls", name);
if (IS_ERR(evsels[i])) { if (IS_ERR(evsels[i])) {
pr_debug("perf_evsel__new(%s)\n", name); pr_debug("evsel__new(%s)\n", name);
goto out_delete_evlist; goto out_delete_evlist;
} }

View File

@ -44,7 +44,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
CPU_ZERO(&cpu_set); CPU_ZERO(&cpu_set);
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); evsel = evsel__newtp("syscalls", "sys_enter_openat");
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
pr_debug("%s\n", errbuf); pr_debug("%s\n", errbuf);

View File

@ -46,9 +46,9 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest
goto out; goto out;
} }
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); evsel = evsel__newtp("syscalls", "sys_enter_openat");
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
pr_debug("%s: perf_evsel__newtp\n", __func__); pr_debug("%s: evsel__newtp\n", __func__);
goto out_delete_evlist; goto out_delete_evlist;
} }

View File

@ -27,7 +27,7 @@ int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __m
return -1; return -1;
} }
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); evsel = evsel__newtp("syscalls", "sys_enter_openat");
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
pr_debug("%s\n", errbuf); pr_debug("%s\n", errbuf);

View File

@ -56,7 +56,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
evsel = evsel__new(&attr); evsel = evsel__new(&attr);
if (evsel == NULL) { if (evsel == NULL) {
pr_debug("perf_evsel__new\n"); pr_debug("evsel__new\n");
goto out_delete_evlist; goto out_delete_evlist;
} }
evlist__add(evlist, evsel); evlist__add(evlist, evsel);

View File

@ -233,7 +233,7 @@ void perf_evlist__set_leader(struct evlist *evlist)
int __perf_evlist__add_default(struct evlist *evlist, bool precise) int __perf_evlist__add_default(struct evlist *evlist, bool precise)
{ {
struct evsel *evsel = perf_evsel__new_cycles(precise); struct evsel *evsel = evsel__new_cycles(precise);
if (evsel == NULL) if (evsel == NULL)
return -ENOMEM; return -ENOMEM;
@ -249,7 +249,7 @@ int perf_evlist__add_dummy(struct evlist *evlist)
.config = PERF_COUNT_SW_DUMMY, .config = PERF_COUNT_SW_DUMMY,
.size = sizeof(attr), /* to capture ABI version */ .size = sizeof(attr), /* to capture ABI version */
}; };
struct evsel *evsel = perf_evsel__new_idx(&attr, evlist->core.nr_entries); struct evsel *evsel = evsel__new_idx(&attr, evlist->core.nr_entries);
if (evsel == NULL) if (evsel == NULL)
return -ENOMEM; return -ENOMEM;
@ -266,7 +266,7 @@ static int evlist__add_attrs(struct evlist *evlist,
size_t i; size_t i;
for (i = 0; i < nr_attrs; i++) { for (i = 0; i < nr_attrs; i++) {
evsel = perf_evsel__new_idx(attrs + i, evlist->core.nr_entries + i); evsel = evsel__new_idx(attrs + i, evlist->core.nr_entries + i);
if (evsel == NULL) if (evsel == NULL)
goto out_delete_partial_list; goto out_delete_partial_list;
list_add_tail(&evsel->core.node, &head); list_add_tail(&evsel->core.node, &head);
@ -325,7 +325,7 @@ perf_evlist__find_tracepoint_by_name(struct evlist *evlist,
int perf_evlist__add_newtp(struct evlist *evlist, int perf_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 = perf_evsel__newtp(sys, name); struct evsel *evsel = evsel__newtp(sys, name);
if (IS_ERR(evsel)) if (IS_ERR(evsel))
return -1; return -1;

View File

@ -258,7 +258,7 @@ void evsel__init(struct evsel *evsel,
evsel->pmu_name = NULL; evsel->pmu_name = NULL;
} }
struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) struct evsel *evsel__new_idx(struct perf_event_attr *attr, int idx)
{ {
struct evsel *evsel = zalloc(perf_evsel__object.size); struct evsel *evsel = zalloc(perf_evsel__object.size);
@ -291,7 +291,7 @@ static bool perf_event_can_profile_kernel(void)
return perf_event_paranoid_check(1); return perf_event_paranoid_check(1);
} }
struct evsel *perf_evsel__new_cycles(bool precise) struct evsel *evsel__new_cycles(bool precise)
{ {
struct perf_event_attr attr = { struct perf_event_attr attr = {
.type = PERF_TYPE_HARDWARE, .type = PERF_TYPE_HARDWARE,
@ -333,7 +333,7 @@ struct evsel *perf_evsel__new_cycles(bool precise)
/* /*
* Returns pointer with encoded error via <linux/err.h> interface. * Returns pointer with encoded error via <linux/err.h> interface.
*/ */
struct evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx) struct evsel *evsel__newtp_idx(const char *sys, const char *name, int idx)
{ {
struct evsel *evsel = zalloc(perf_evsel__object.size); struct evsel *evsel = zalloc(perf_evsel__object.size);
int err = -ENOMEM; int err = -ENOMEM;

View File

@ -161,24 +161,24 @@ int evsel__object_config(size_t object_size,
struct perf_pmu *evsel__find_pmu(struct evsel *evsel); struct perf_pmu *evsel__find_pmu(struct evsel *evsel);
bool evsel__is_aux_event(struct evsel *evsel); bool evsel__is_aux_event(struct evsel *evsel);
struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); struct evsel *evsel__new_idx(struct perf_event_attr *attr, int idx);
static inline struct evsel *evsel__new(struct perf_event_attr *attr) static inline struct evsel *evsel__new(struct perf_event_attr *attr)
{ {
return perf_evsel__new_idx(attr, 0); return evsel__new_idx(attr, 0);
} }
struct evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx); struct evsel *evsel__newtp_idx(const char *sys, const char *name, int idx);
/* /*
* Returns pointer with encoded error via <linux/err.h> interface. * Returns pointer with encoded error via <linux/err.h> interface.
*/ */
static inline struct evsel *perf_evsel__newtp(const char *sys, const char *name) static inline struct evsel *evsel__newtp(const char *sys, const char *name)
{ {
return perf_evsel__newtp_idx(sys, name, 0); return evsel__newtp_idx(sys, name, 0);
} }
struct evsel *perf_evsel__new_cycles(bool precise); struct evsel *evsel__new_cycles(bool precise);
struct tep_event *event_format__new(const char *sys, const char *name); struct tep_event *event_format__new(const char *sys, const char *name);

View File

@ -354,7 +354,7 @@ __add_event(struct list_head *list, int *idx,
event_attr_init(attr); event_attr_init(attr);
evsel = perf_evsel__new_idx(attr, *idx); evsel = evsel__new_idx(attr, *idx);
if (!evsel) if (!evsel)
return NULL; return NULL;
@ -538,9 +538,8 @@ static int add_tracepoint(struct list_head *list, int *idx,
struct parse_events_error *err, struct parse_events_error *err,
struct list_head *head_config) struct list_head *head_config)
{ {
struct evsel *evsel; struct evsel *evsel = evsel__newtp_idx(sys_name, evt_name, (*idx)++);
evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++);
if (IS_ERR(evsel)) { if (IS_ERR(evsel)) {
tracepoint_error(err, PTR_ERR(evsel), sys_name, evt_name); tracepoint_error(err, PTR_ERR(evsel), sys_name, evt_name);
return PTR_ERR(evsel); return PTR_ERR(evsel);

View File

@ -22,7 +22,7 @@ int perf_evlist__add_sb_event(struct evlist *evlist, struct perf_event_attr *att
attr->sample_id_all = 1; attr->sample_id_all = 1;
} }
evsel = perf_evsel__new_idx(attr, evlist->core.nr_entries); evsel = evsel__new_idx(attr, evlist->core.nr_entries);
if (!evsel) if (!evsel)
return -1; return -1;