perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 Nov 2020 17:17:57 +0000 (14:17 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 Nov 2020 17:17:57 +0000 (14:17 -0300)
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
18 files changed:
tools/perf/builtin-script.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/switch-tracking.c
tools/perf/util/auxtrace.c
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/evsel.c
tools/perf/util/header.c
tools/perf/util/intel-pt.c
tools/perf/util/python.c
tools/perf/util/s390-cpumsf.c
tools/perf/util/s390-sample-raw.c
tools/perf/util/session.c
tools/perf/util/sideband_evlist.c
tools/perf/util/stat.c
tools/perf/util/synthetic-events.c

index 983c101..1c322c1 100644 (file)
@@ -2224,7 +2224,7 @@ static int print_event_with_time(struct perf_tool *tool,
 {
        struct perf_script *script = container_of(tool, struct perf_script, tool);
        struct perf_session *session = script->session;
-       struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
+       struct evsel *evsel = evlist__id2evsel(session->evlist, sample->id);
        struct thread *thread = NULL;
 
        if (evsel && !evsel->core.attr.sample_id_all) {
index fff1d5e..88bd1ac 100644 (file)
@@ -1159,7 +1159,7 @@ static int deliver_event(struct ordered_events *qe,
                goto next_event;
        }
 
-       evsel = perf_evlist__id2evsel(session->evlist, sample.id);
+       evsel = evlist__id2evsel(session->evlist, sample.id);
        assert(evsel != NULL);
 
        if (event->header.type == PERF_RECORD_SAMPLE) {
index 6e47b19..a463ce8 100644 (file)
@@ -3105,7 +3105,7 @@ static void trace__handle_event(struct trace *trace, union perf_event *event, st
                return;
        }
 
-       evsel = perf_evlist__id2evsel(trace->evlist, sample->id);
+       evsel = evlist__id2evsel(trace->evlist, sample->id);
        if (evsel == NULL) {
                fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample->id);
                return;
index d826153..c01d7e1 100644 (file)
@@ -133,7 +133,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
                }
 
                err = -1;
-               evsel = perf_evlist__id2evsel(evlist, sample.id);
+               evsel = evlist__id2evsel(evlist, sample.id);
                if (evsel == NULL) {
                        pr_debug("event with id %" PRIu64
                                 " doesn't map to an evsel\n", sample.id);
index b8cdbe6..3c0bc3f 100644 (file)
@@ -133,7 +133,7 @@ static int process_sample_event(struct evlist *evlist,
                return -1;
        }
 
-       evsel = perf_evlist__id2evsel(evlist, sample.id);
+       evsel = evlist__id2evsel(evlist, sample.id);
        if (evsel == switch_tracking->switch_evsel) {
                next_tid = evsel__intval(evsel, &sample, "next_pid");
                prev_tid = evsel__intval(evsel, &sample, "prev_pid");
index 647afdc..b538b90 100644 (file)
@@ -1017,7 +1017,7 @@ struct auxtrace_queue *auxtrace_queues__sample_queue(struct auxtrace_queues *que
        if (!id)
                return NULL;
 
-       sid = perf_evlist__id2sid(session->evlist, id);
+       sid = evlist__id2sid(session->evlist, id);
        if (!sid)
                return NULL;
 
@@ -1047,7 +1047,7 @@ int auxtrace_queues__add_sample(struct auxtrace_queues *queues,
        if (!id)
                return -EINVAL;
 
-       sid = perf_evlist__id2sid(session->evlist, id);
+       sid = evlist__id2sid(session->evlist, id);
        if (!sid)
                return -ENOENT;
 
index 86172ee..51775ff 100644 (file)
@@ -509,7 +509,7 @@ int evlist__poll(struct evlist *evlist, int timeout)
        return perf_evlist__poll(&evlist->core, timeout);
 }
 
-struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id)
+struct perf_sample_id *evlist__id2sid(struct evlist *evlist, u64 id)
 {
        struct hlist_head *head;
        struct perf_sample_id *sid;
@@ -525,14 +525,14 @@ struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id)
        return NULL;
 }
 
-struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id)
+struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id)
 {
        struct perf_sample_id *sid;
 
        if (evlist->core.nr_entries == 1 || !id)
                return evlist__first(evlist);
 
-       sid = perf_evlist__id2sid(evlist, id);
+       sid = evlist__id2sid(evlist, id);
        if (sid)
                return container_of(sid->evsel, struct evsel, core);
 
@@ -542,23 +542,21 @@ struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id)
        return NULL;
 }
 
-struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
-                                               u64 id)
+struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id)
 {
        struct perf_sample_id *sid;
 
        if (!id)
                return NULL;
 
-       sid = perf_evlist__id2sid(evlist, id);
+       sid = evlist__id2sid(evlist, id);
        if (sid)
                return container_of(sid->evsel, struct evsel, core);
 
        return NULL;
 }
 
-static int perf_evlist__event2id(struct evlist *evlist,
-                                union perf_event *event, u64 *id)
+static int evlist__event2id(struct evlist *evlist, union perf_event *event, u64 *id)
 {
        const __u64 *array = event->sample.array;
        ssize_t n;
@@ -578,8 +576,7 @@ static int perf_evlist__event2id(struct evlist *evlist,
        return 0;
 }
 
-struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
-                                           union perf_event *event)
+struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event)
 {
        struct evsel *first = evlist__first(evlist);
        struct hlist_head *head;
@@ -594,7 +591,7 @@ struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
            event->header.type != PERF_RECORD_SAMPLE)
                return first;
 
-       if (perf_evlist__event2id(evlist, event, &id))
+       if (evlist__event2id(evlist, event, &id))
                return NULL;
 
        /* Synthesized events have an id of zero */
@@ -1427,7 +1424,7 @@ int evlist__start_workload(struct evlist *evlist)
 
 int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct perf_sample *sample)
 {
-       struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
+       struct evsel *evsel = evlist__event2evsel(evlist, event);
 
        if (!evsel)
                return -EFAULT;
@@ -1436,7 +1433,7 @@ int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct
 
 int evlist__parse_sample_timestamp(struct evlist *evlist, union perf_event *event, u64 *timestamp)
 {
-       struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
+       struct evsel *evsel = evlist__event2evsel(evlist, event);
 
        if (!evsel)
                return -EFAULT;
index a1288b3..90f1127 100644 (file)
@@ -144,11 +144,10 @@ int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask);
 
 int evlist__poll(struct evlist *evlist, int timeout);
 
-struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id);
-struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
-                                               u64 id);
+struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id);
+struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id);
 
-struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id);
+struct perf_sample_id *evlist__id2sid(struct evlist *evlist, u64 id);
 
 void evlist__toggle_bkw_mmap(struct evlist *evlist, enum bkw_mmap_state state);
 
@@ -325,8 +324,7 @@ bool evsel__cpu_iter_skip_no_inc(struct evsel *ev, int cpu);
 
 struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str);
 
-struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
-                                           union perf_event *event);
+struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event);
 
 bool perf_evlist__exclude_kernel(struct evlist *evlist);
 
index 9005cc9..3dd0eae 100644 (file)
@@ -1469,7 +1469,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu, int thread,
        for (i = 1; i < nr; i++) {
                struct evsel *counter;
 
-               counter = perf_evlist__id2evsel(leader->evlist, v[i].id);
+               counter = evlist__id2evsel(leader->evlist, v[i].id);
                if (!counter)
                        return -EINVAL;
 
index 64a3b83..be21905 100644 (file)
@@ -4030,7 +4030,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,
 
        evlist = *pevlist;
 
-       evsel = perf_evlist__id2evsel(evlist, ev->id);
+       evsel = evlist__id2evsel(evlist, ev->id);
        if (evsel == NULL)
                return -EINVAL;
 
index 3a0348c..60214de 100644 (file)
@@ -2520,11 +2520,10 @@ static int intel_pt_sync_switch(struct intel_pt *pt, int cpu, pid_t tid,
 static int intel_pt_process_switch(struct intel_pt *pt,
                                   struct perf_sample *sample)
 {
-       struct evsel *evsel;
        pid_t tid;
        int cpu, ret;
+       struct evsel *evsel = evlist__id2evsel(pt->session->evlist, sample->id);
 
-       evsel = perf_evlist__id2evsel(pt->session->evlist, sample->id);
        if (evsel != pt->switch_evsel)
                return 0;
 
index 3d3b465..cc5ade8 100644 (file)
@@ -1055,7 +1055,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
                if (pyevent == NULL)
                        return PyErr_NoMemory();
 
-               evsel = perf_evlist__event2evsel(evlist, event);
+               evsel = evlist__event2evsel(evlist, event);
                if (!evsel) {
                        Py_INCREF(Py_None);
                        return Py_None;
index 959e989..078a717 100644 (file)
@@ -932,7 +932,7 @@ s390_cpumsf_process_event(struct perf_session *session,
        if (event->header.type == PERF_RECORD_SAMPLE &&
            sample->raw_size) {
                /* Handle event with raw data */
-               ev_bc000 = perf_evlist__event2evsel(session->evlist, event);
+               ev_bc000 = evlist__event2evsel(session->evlist, event);
                if (ev_bc000 &&
                    ev_bc000->core.attr.config == PERF_EVENT_CPUM_CF_DIAG)
                        err = s390_cpumcf_dumpctr(sf, sample);
index 05b43ab..d177e61 100644 (file)
@@ -205,7 +205,7 @@ void perf_evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event
        if (event->header.type != PERF_RECORD_SAMPLE)
                return;
 
-       ev_bc000 = perf_evlist__event2evsel(evlist, event);
+       ev_bc000 = evlist__event2evsel(evlist, event);
        if (ev_bc000 == NULL ||
            ev_bc000->core.attr.config != PERF_EVENT_CPUM_CF_DIAG)
                return;
index 61e4b3c..ce381b3 100644 (file)
@@ -1364,7 +1364,7 @@ static int deliver_sample_value(struct evlist *evlist,
                                struct sample_read_value *v,
                                struct machine *machine)
 {
-       struct perf_sample_id *sid = perf_evlist__id2sid(evlist, v->id);
+       struct perf_sample_id *sid = evlist__id2sid(evlist, v->id);
        struct evsel *evsel;
 
        if (sid) {
@@ -1445,7 +1445,7 @@ static int machines__deliver_event(struct machines *machines,
 
        dump_event(evlist, event, file_offset, sample);
 
-       evsel = perf_evlist__id2evsel(evlist, sample->id);
+       evsel = evlist__id2evsel(evlist, sample->id);
 
        machine = machines__find_for_cpumode(machines, event, sample);
 
@@ -2476,7 +2476,7 @@ int perf_event__process_id_index(struct perf_session *session,
                        fprintf(stdout, "  tid: %"PRI_ld64"\n", e->tid);
                }
 
-               sid = perf_evlist__id2sid(evlist, e->id);
+               sid = evlist__id2sid(evlist, e->id);
                if (!sid)
                        return -ENOENT;
                sid->idx = e->idx;
index 90ed016..9c04c71 100644 (file)
@@ -62,7 +62,7 @@ static void *perf_evlist__poll_thread(void *arg)
                        if (perf_mmap__read_init(&map->core))
                                continue;
                        while ((event = perf_mmap__read_event(&map->core)) != NULL) {
-                               struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
+                               struct evsel *evsel = evlist__event2evsel(evlist, event);
 
                                if (evsel && evsel->side_band.cb)
                                        evsel->side_band.cb(event, evsel->side_band.data);
index 8be9c3d..1e125e3 100644 (file)
@@ -458,7 +458,7 @@ int perf_event__process_stat_event(struct perf_session *session,
        count.ena = st->ena;
        count.run = st->run;
 
-       counter = perf_evlist__id2evsel(session->evlist, st->id);
+       counter = evlist__id2evsel(session->evlist, st->id);
        if (!counter) {
                pr_err("Failed to resolve counter for stat event.\n");
                return -EINVAL;
index d9c6243..297987c 100644 (file)
@@ -1643,7 +1643,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_
 
                        e->id = evsel->core.id[j];
 
-                       sid = perf_evlist__id2sid(evlist, e->id);
+                       sid = evlist__id2sid(evlist, e->id);
                        if (!sid) {
                                free(ev);
                                return -ENOENT;