perf evlist: Use the right prefix for 'struct evlist' sample parsing methods
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 Nov 2020 12:43:07 +0000 (09:43 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 Nov 2020 12:43:07 +0000 (09:43 -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>
14 files changed:
tools/perf/builtin-kvm.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/code-reading.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/parse-no-sample-id-all.c
tools/perf/tests/perf-record.c
tools/perf/tests/sw-clock.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/s390-cpumsf.c
tools/perf/util/session.c

index 460945d..e1b60aa 100644 (file)
@@ -764,7 +764,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
                return (err == -EAGAIN) ? 0 : -1;
 
        while ((event = perf_mmap__read_event(&md->core)) != NULL) {
-               err = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
+               err = evlist__parse_sample_timestamp(evlist, event, &timestamp);
                if (err) {
                        perf_mmap__consume(&md->core);
                        pr_err("Failed to parse sample\n");
index 50dd42d..fff1d5e 100644 (file)
@@ -890,7 +890,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
        while ((event = perf_mmap__read_event(&md->core)) != NULL) {
                int ret;
 
-               ret = perf_evlist__parse_sample_timestamp(evlist, event, &last_timestamp);
+               ret = evlist__parse_sample_timestamp(evlist, event, &last_timestamp);
                if (ret && ret != -1)
                        break;
 
@@ -1153,7 +1153,7 @@ static int deliver_event(struct ordered_events *qe,
                return 0;
        }
 
-       ret = perf_evlist__parse_sample(evlist, event, &sample);
+       ret = evlist__parse_sample(evlist, event, &sample);
        if (ret) {
                pr_err("Can't parse sample, err = %d\n", ret);
                goto next_event;
index 9f6f0f8..5638eae 100644 (file)
@@ -3700,9 +3700,8 @@ static int __trace__deliver_event(struct trace *trace, union perf_event *event)
 {
        struct evlist *evlist = trace->evlist;
        struct perf_sample sample;
-       int err;
+       int err = evlist__parse_sample(evlist, event, &sample);
 
-       err = perf_evlist__parse_sample(evlist, event, &sample);
        if (err)
                fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
        else
@@ -3735,7 +3734,7 @@ static int trace__deliver_event(struct trace *trace, union perf_event *event)
        if (!trace->sort_events)
                return __trace__deliver_event(trace, event);
 
-       err = perf_evlist__parse_sample_timestamp(trace->evlist, event, &trace->oe.last);
+       err = evlist__parse_sample_timestamp(trace->evlist, event, &trace->oe.last);
        if (err && err != -1)
                return err;
 
index 035c912..339d432 100644 (file)
@@ -378,8 +378,8 @@ static int process_sample_event(struct machine *machine,
        struct thread *thread;
        int ret;
 
-       if (perf_evlist__parse_sample(evlist, event, &sample)) {
-               pr_debug("perf_evlist__parse_sample failed\n");
+       if (evlist__parse_sample(evlist, event, &sample)) {
+               pr_debug("evlist__parse_sample failed\n");
                return -1;
        }
 
index 7b0dbfc..d826153 100644 (file)
@@ -126,7 +126,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
                        goto out_delete_evlist;
                }
 
-               err = perf_evlist__parse_sample(evlist, event, &sample);
+               err = evlist__parse_sample(evlist, event, &sample);
                if (err) {
                        pr_err("Can't parse sample, err = %d\n", err);
                        goto out_delete_evlist;
index adf3c9c..4712736 100644 (file)
@@ -27,8 +27,8 @@ static int process_event(struct evlist **pevlist, union perf_event *event)
        if (!*pevlist)
                return -1;
 
-       if (perf_evlist__parse_sample(*pevlist, event, &sample)) {
-               pr_debug("perf_evlist__parse_sample failed\n");
+       if (evlist__parse_sample(*pevlist, event, &sample)) {
+               pr_debug("evlist__parse_sample failed\n");
                return -1;
        }
 
index 8745bf5..f0b2066 100644 (file)
@@ -182,7 +182,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
                                if (type < PERF_RECORD_MAX)
                                        nr_events[type]++;
 
-                               err = perf_evlist__parse_sample(evlist, event, &sample);
+                               err = evlist__parse_sample(evlist, event, &sample);
                                if (err < 0) {
                                        if (verbose > 0)
                                                perf_event__fprintf(event, NULL, stderr);
index 4b9b731..a49c9e2 100644 (file)
@@ -109,7 +109,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
                if (event->header.type != PERF_RECORD_SAMPLE)
                        goto next_event;
 
-               err = perf_evlist__parse_sample(evlist, event, &sample);
+               err = evlist__parse_sample(evlist, event, &sample);
                if (err < 0) {
                        pr_debug("Error during parse sample\n");
                        goto out_delete_evlist;
index db5e1f7..b8cdbe6 100644 (file)
@@ -128,8 +128,8 @@ static int process_sample_event(struct evlist *evlist,
        pid_t next_tid, prev_tid;
        int cpu, err;
 
-       if (perf_evlist__parse_sample(evlist, event, &sample)) {
-               pr_debug("perf_evlist__parse_sample failed\n");
+       if (evlist__parse_sample(evlist, event, &sample)) {
+               pr_debug("evlist__parse_sample failed\n");
                return -1;
        }
 
@@ -223,8 +223,8 @@ static int add_event(struct evlist *evlist, struct list_head *events,
        node->event = event;
        list_add(&node->list, events);
 
-       if (perf_evlist__parse_sample(evlist, event, &sample)) {
-               pr_debug("perf_evlist__parse_sample failed\n");
+       if (evlist__parse_sample(evlist, event, &sample)) {
+               pr_debug("evlist__parse_sample failed\n");
                return -1;
        }
 
index 62e7f6c..647afdc 100644 (file)
@@ -1082,7 +1082,7 @@ static int auxtrace_queue_data_cb(struct perf_session *session,
        if (!qd->samples || event->header.type != PERF_RECORD_SAMPLE)
                return 0;
 
-       err = perf_evlist__parse_sample(session->evlist, event, &sample);
+       err = evlist__parse_sample(session->evlist, event, &sample);
        if (err)
                return err;
 
index 725f9f5..943262a 100644 (file)
@@ -1447,8 +1447,7 @@ int evlist__start_workload(struct evlist *evlist)
        return 0;
 }
 
-int perf_evlist__parse_sample(struct evlist *evlist, union perf_event *event,
-                             struct perf_sample *sample)
+int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct perf_sample *sample)
 {
        struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
 
@@ -1457,9 +1456,7 @@ int perf_evlist__parse_sample(struct evlist *evlist, union perf_event *event,
        return evsel__parse_sample(evsel, event, sample);
 }
 
-int perf_evlist__parse_sample_timestamp(struct evlist *evlist,
-                                       union perf_event *event,
-                                       u64 *timestamp)
+int evlist__parse_sample_timestamp(struct evlist *evlist, union perf_event *event, u64 *timestamp)
 {
        struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
 
index 736cb63..c59a08c 100644 (file)
@@ -224,12 +224,8 @@ u64 evlist__combined_branch_type(struct evlist *evlist);
 bool evlist__sample_id_all(struct evlist *evlist);
 u16 perf_evlist__id_hdr_size(struct evlist *evlist);
 
-int perf_evlist__parse_sample(struct evlist *evlist, union perf_event *event,
-                             struct perf_sample *sample);
-
-int perf_evlist__parse_sample_timestamp(struct evlist *evlist,
-                                       union perf_event *event,
-                                       u64 *timestamp);
+int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct perf_sample *sample);
+int evlist__parse_sample_timestamp(struct evlist *evlist, union perf_event *event, u64 *timestamp);
 
 bool evlist__valid_sample_type(struct evlist *evlist);
 bool evlist__valid_sample_id_all(struct evlist *evlist);
index f886199..959e989 100644 (file)
@@ -96,9 +96,9 @@
  * |    than PERF_RECORD_USER_TYPE_START) are handled by
  * |    perf_session__process_user_event(see below)
  * |  - Those generated by the kernel are handled by
- * |    perf_evlist__parse_sample_timestamp()
+ * |    evlist__parse_sample_timestamp()
  * |
- * perf_evlist__parse_sample_timestamp()
+ * evlist__parse_sample_timestamp()
  * |  Extract time stamp from sample data.
  * |
  * perf_session__queue_event()
index 5cc722b..61e4b3c 100644 (file)
@@ -1523,9 +1523,8 @@ static int perf_session__deliver_event(struct perf_session *session,
                                       u64 file_offset)
 {
        struct perf_sample sample;
-       int ret;
+       int ret = evlist__parse_sample(session->evlist, event, &sample);
 
-       ret = perf_evlist__parse_sample(session->evlist, event, &sample);
        if (ret) {
                pr_err("Can't parse sample, err = %d\n", ret);
                return ret;
@@ -1697,7 +1696,7 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset,
 out_parse_sample:
 
        if (sample && event->header.type < PERF_RECORD_USER_TYPE_START &&
-           perf_evlist__parse_sample(session->evlist, event, sample))
+           evlist__parse_sample(session->evlist, event, sample))
                return -1;
 
        *event_ptr = event;
@@ -1754,7 +1753,7 @@ static s64 perf_session__process_event(struct perf_session *session,
        if (tool->ordered_events) {
                u64 timestamp = -1ULL;
 
-               ret = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
+               ret = evlist__parse_sample_timestamp(evlist, event, &timestamp);
                if (ret && ret != -1)
                        return ret;