perf counts: Rename perf_evsel__*counts() to evsel__*counts()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 May 2020 16:38:26 +0000 (13:38 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 May 2020 13:03:24 +0000 (10:03 -0300)
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>
tools/perf/tests/openat-syscall-all-cpus.c
tools/perf/util/counts.c
tools/perf/util/counts.h
tools/perf/util/evsel.c
tools/perf/util/stat.c

index 579c4d0902e51448cf1937b594a9c187d521fbdc..71f85e2cc127110753e30a4dc3aa7bc466bf2909 100644 (file)
@@ -90,8 +90,8 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
         * we use the auto allocation it will allocate just for 1 cpu,
         * as we start by cpu 0.
         */
-       if (perf_evsel__alloc_counts(evsel, cpus->nr, 1) < 0) {
-               pr_debug("perf_evsel__alloc_counts(ncpus=%d)\n", cpus->nr);
+       if (evsel__alloc_counts(evsel, cpus->nr, 1) < 0) {
+               pr_debug("evsel__alloc_counts(ncpus=%d)\n", cpus->nr);
                goto out_close_fd;
        }
 
@@ -117,7 +117,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
                }
        }
 
-       perf_evsel__free_counts(evsel);
+       evsel__free_counts(evsel);
 out_close_fd:
        perf_evsel__close_fd(&evsel->core);
 out_evsel_delete:
index f94e1a23dad639313bdafcf6602e1f6c3ceff42e..615c9f3e95cb5f4f3dcd25d6f22c094676e44078 100644 (file)
@@ -48,18 +48,18 @@ static void perf_counts__reset(struct perf_counts *counts)
        xyarray__reset(counts->values);
 }
 
-void perf_evsel__reset_counts(struct evsel *evsel)
+void evsel__reset_counts(struct evsel *evsel)
 {
        perf_counts__reset(evsel->counts);
 }
 
-int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads)
+int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads)
 {
        evsel->counts = perf_counts__new(ncpus, nthreads);
        return evsel->counts != NULL ? 0 : -ENOMEM;
 }
 
-void perf_evsel__free_counts(struct evsel *evsel)
+void evsel__free_counts(struct evsel *evsel)
 {
        perf_counts__delete(evsel->counts);
        evsel->counts = NULL;
index 92196df4945f74c914695447bdfaf1ad4d4f3bc1..8f556c6d98fa1c9ea235c90f6cf3e71e55b8f0bd 100644 (file)
@@ -38,8 +38,8 @@ perf_counts__set_loaded(struct perf_counts *counts, int cpu, int thread, bool lo
 struct perf_counts *perf_counts__new(int ncpus, int nthreads);
 void perf_counts__delete(struct perf_counts *counts);
 
-void perf_evsel__reset_counts(struct evsel *evsel);
-int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads);
-void perf_evsel__free_counts(struct evsel *evsel);
+void evsel__reset_counts(struct evsel *evsel);
+int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads);
+void evsel__free_counts(struct evsel *evsel);
 
 #endif /* __PERF_COUNTS_H */
index 320f3a292d3566747a67441692394aab35fe84ed..28683b0eb7382e0f729dd71a0092e19fd39bd874 100644 (file)
@@ -1252,7 +1252,7 @@ void evsel__exit(struct evsel *evsel)
 {
        assert(list_empty(&evsel->core.node));
        assert(evsel->evlist == NULL);
-       perf_evsel__free_counts(evsel);
+       evsel__free_counts(evsel);
        perf_evsel__free_fd(&evsel->core);
        perf_evsel__free_id(&evsel->core);
        evsel__free_config_terms(evsel);
@@ -1420,7 +1420,7 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu, int thread, bool scale)
        if (FD(evsel, cpu, thread) < 0)
                return -EINVAL;
 
-       if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
+       if (evsel->counts == NULL && evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
                return -ENOMEM;
 
        if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
index 774468341851c3c52837a283a1ace08cba766841..f4a44df9b221c41f92b6664027830c369ff504ab 100644 (file)
@@ -115,7 +115,7 @@ static void perf_stat_evsel_id_init(struct evsel *evsel)
        }
 }
 
-static void perf_evsel__reset_stat_priv(struct evsel *evsel)
+static void evsel__reset_stat_priv(struct evsel *evsel)
 {
        int i;
        struct perf_stat_evsel *ps = evsel->stats;
@@ -126,16 +126,16 @@ static void perf_evsel__reset_stat_priv(struct evsel *evsel)
        perf_stat_evsel_id_init(evsel);
 }
 
-static int perf_evsel__alloc_stat_priv(struct evsel *evsel)
+static int evsel__alloc_stat_priv(struct evsel *evsel)
 {
        evsel->stats = zalloc(sizeof(struct perf_stat_evsel));
        if (evsel->stats == NULL)
                return -ENOMEM;
-       perf_evsel__reset_stat_priv(evsel);
+       evsel__reset_stat_priv(evsel);
        return 0;
 }
 
-static void perf_evsel__free_stat_priv(struct evsel *evsel)
+static void evsel__free_stat_priv(struct evsel *evsel)
 {
        struct perf_stat_evsel *ps = evsel->stats;
 
@@ -144,8 +144,7 @@ static void perf_evsel__free_stat_priv(struct evsel *evsel)
        zfree(&evsel->stats);
 }
 
-static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel,
-                                            int ncpus, int nthreads)
+static int evsel__alloc_prev_raw_counts(struct evsel *evsel, int ncpus, int nthreads)
 {
        struct perf_counts *counts;
 
@@ -156,13 +155,13 @@ static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel,
        return counts ? 0 : -ENOMEM;
 }
 
-static void perf_evsel__free_prev_raw_counts(struct evsel *evsel)
+static void evsel__free_prev_raw_counts(struct evsel *evsel)
 {
        perf_counts__delete(evsel->prev_raw_counts);
        evsel->prev_raw_counts = NULL;
 }
 
-static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel)
+static void evsel__reset_prev_raw_counts(struct evsel *evsel)
 {
        if (evsel->prev_raw_counts) {
                evsel->prev_raw_counts->aggr.val = 0;
@@ -171,14 +170,14 @@ static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel)
        }
 }
 
-static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)
+static int evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)
 {
        int ncpus = evsel__nr_cpus(evsel);
        int nthreads = perf_thread_map__nr(evsel->core.threads);
 
-       if (perf_evsel__alloc_stat_priv(evsel) < 0 ||
-           perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 ||
-           (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0))
+       if (evsel__alloc_stat_priv(evsel) < 0 ||
+           evsel__alloc_counts(evsel, ncpus, nthreads) < 0 ||
+           (alloc_raw && evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0))
                return -ENOMEM;
 
        return 0;
@@ -189,7 +188,7 @@ int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw)
        struct evsel *evsel;
 
        evlist__for_each_entry(evlist, evsel) {
-               if (perf_evsel__alloc_stats(evsel, alloc_raw))
+               if (evsel__alloc_stats(evsel, alloc_raw))
                        goto out_free;
        }
 
@@ -205,9 +204,9 @@ void perf_evlist__free_stats(struct evlist *evlist)
        struct evsel *evsel;
 
        evlist__for_each_entry(evlist, evsel) {
-               perf_evsel__free_stat_priv(evsel);
-               perf_evsel__free_counts(evsel);
-               perf_evsel__free_prev_raw_counts(evsel);
+               evsel__free_stat_priv(evsel);
+               evsel__free_counts(evsel);
+               evsel__free_prev_raw_counts(evsel);
        }
 }
 
@@ -216,8 +215,8 @@ void perf_evlist__reset_stats(struct evlist *evlist)
        struct evsel *evsel;
 
        evlist__for_each_entry(evlist, evsel) {
-               perf_evsel__reset_stat_priv(evsel);
-               perf_evsel__reset_counts(evsel);
+               evsel__reset_stat_priv(evsel);
+               evsel__reset_counts(evsel);
        }
 }
 
@@ -226,7 +225,7 @@ void perf_evlist__reset_prev_raw_counts(struct evlist *evlist)
        struct evsel *evsel;
 
        evlist__for_each_entry(evlist, evsel)
-               perf_evsel__reset_prev_raw_counts(evsel);
+               evsel__reset_prev_raw_counts(evsel);
 }
 
 static void zero_per_pkg(struct evsel *counter)