libperf cpumap: Rename perf_cpu_map__dummy_new() to perf_cpu_map__new_any_cpu()
authorIan Rogers <irogers@google.com>
Wed, 29 Nov 2023 06:01:58 +0000 (22:01 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Dec 2023 17:01:47 +0000 (14:01 -0300)
Rename perf_cpu_map__dummy_new() to perf_cpu_map__new_any_cpu() to
better indicate this is creating a CPU map for the perf_event_open "any"
CPU case.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: André Almeida <andrealmeid@igalia.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Atish Patra <atishp@rivosinc.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paran Lee <p4ranlee@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Yang Li <yang.lee@linux.alibaba.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: bpf@vger.kernel.org
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20231129060211.1890454-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
12 files changed:
tools/lib/perf/Documentation/libperf.txt
tools/lib/perf/cpumap.c
tools/lib/perf/evsel.c
tools/lib/perf/include/perf/cpumap.h
tools/lib/perf/libperf.map
tools/lib/perf/tests/test-cpumap.c
tools/lib/perf/tests/test-evlist.c
tools/perf/tests/cpumap.c
tools/perf/tests/sw-clock.c
tools/perf/tests/task-exit.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c

index a8f1a237931b19b182d5a197f7ce6fe4ec019351..a256a26598b040c73752091e31ab4505fa020ce9 100644 (file)
@@ -37,7 +37,7 @@ SYNOPSIS
 
   struct perf_cpu_map;
 
-  struct perf_cpu_map *perf_cpu_map__dummy_new(void);
+  struct perf_cpu_map *perf_cpu_map__new_any_cpu(void);
   struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list);
   struct perf_cpu_map *perf_cpu_map__read(FILE *file);
   struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
index 2a5a292173740bc220c4b7ecd655242912882335..2bd6aba3d8c9af5e0d3043a604d81bbe07296ab9 100644 (file)
@@ -27,7 +27,7 @@ struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus)
        return result;
 }
 
-struct perf_cpu_map *perf_cpu_map__dummy_new(void)
+struct perf_cpu_map *perf_cpu_map__new_any_cpu(void)
 {
        struct perf_cpu_map *cpus = perf_cpu_map__alloc(1);
 
@@ -271,7 +271,7 @@ struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list)
        else if (*cpu_list != '\0')
                cpus = cpu_map__default_new();
        else
-               cpus = perf_cpu_map__dummy_new();
+               cpus = perf_cpu_map__new_any_cpu();
 invalid:
        free(tmp_cpus);
 out:
index 8b51b008a81f142129069bc351c86e6aa2804ed8..c07160953224adf7e7b291f6a47ab33743d20b94 100644 (file)
@@ -120,7 +120,7 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus,
                static struct perf_cpu_map *empty_cpu_map;
 
                if (empty_cpu_map == NULL) {
-                       empty_cpu_map = perf_cpu_map__dummy_new();
+                       empty_cpu_map = perf_cpu_map__new_any_cpu();
                        if (empty_cpu_map == NULL)
                                return -ENOMEM;
                }
index e38d859a384d2c32ef770bd18fa68798fc151bbb..d0bf218ada1190b2a8dcce1c7a2bf130761713b0 100644 (file)
@@ -19,9 +19,9 @@ struct perf_cache {
 struct perf_cpu_map;
 
 /**
- * perf_cpu_map__dummy_new - a map with a singular "any CPU"/dummy -1 value.
+ * perf_cpu_map__new_any_cpu - a map with a singular "any CPU"/dummy -1 value.
  */
-LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
+LIBPERF_API struct perf_cpu_map *perf_cpu_map__new_any_cpu(void);
 LIBPERF_API struct perf_cpu_map *perf_cpu_map__default_new(void);
 LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list);
 LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file);
index 190b56ae923addf23446aedbe4215c124bc4cb53..a8ff64baea3e1fd1450fac1394904997f4906c16 100644 (file)
@@ -1,7 +1,7 @@
 LIBPERF_0.0.1 {
        global:
                libperf_init;
-               perf_cpu_map__dummy_new;
+               perf_cpu_map__new_any_cpu;
                perf_cpu_map__default_new;
                perf_cpu_map__get;
                perf_cpu_map__put;
index 87b0510a556ff3215c9df8f951db65d15accb990..2c359bdb951ee2bbc0d434ce88096993c7b3f704 100644 (file)
@@ -21,7 +21,7 @@ int test_cpumap(int argc, char **argv)
 
        libperf_init(libperf_print);
 
-       cpus = perf_cpu_map__dummy_new();
+       cpus = perf_cpu_map__new_any_cpu();
        if (!cpus)
                return -1;
 
index ed616fc19b4f2f82061cee202483a85eb0a51832..ab63878bacb99eca321881542312476b894606c9 100644 (file)
@@ -261,7 +261,7 @@ static int test_mmap_thread(void)
        threads = perf_thread_map__new_dummy();
        __T("failed to create threads", threads);
 
-       cpus = perf_cpu_map__dummy_new();
+       cpus = perf_cpu_map__new_any_cpu();
        __T("failed to create cpus", cpus);
 
        perf_thread_map__set_pid(threads, 0, pid);
index 7730fc2ab40b734274fe89b569def4f9909e0e31..bd8e396f3e57bbb27d46567677a20273877492d6 100644 (file)
@@ -213,7 +213,7 @@ static int test__cpu_map_intersect(struct test_suite *test __maybe_unused,
 
 static int test__cpu_map_equal(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
 {
-       struct perf_cpu_map *any = perf_cpu_map__dummy_new();
+       struct perf_cpu_map *any = perf_cpu_map__new_any_cpu();
        struct perf_cpu_map *one = perf_cpu_map__new("1");
        struct perf_cpu_map *two = perf_cpu_map__new("2");
        struct perf_cpu_map *empty = perf_cpu_map__intersect(one, two);
index 4d7493fa01059112ff283e36b46e22f95839ecdf..290716783ac6a28d06567f7827ccb1bf68ffb135 100644 (file)
@@ -62,7 +62,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
        }
        evlist__add(evlist, evsel);
 
-       cpus = perf_cpu_map__dummy_new();
+       cpus = perf_cpu_map__new_any_cpu();
        threads = thread_map__new_by_tid(getpid());
        if (!cpus || !threads) {
                err = -ENOMEM;
index 968dddde6ddaf0bede4fc7679d57bbb4ad2cd35b..d33d0952025cf5b65e80fb7e8464f634b5c313c1 100644 (file)
@@ -70,7 +70,7 @@ static int test__task_exit(struct test_suite *test __maybe_unused, int subtest _
         * evlist__prepare_workload we'll fill in the only thread
         * we're monitoring, the one forked there.
         */
-       cpus = perf_cpu_map__dummy_new();
+       cpus = perf_cpu_map__new_any_cpu();
        threads = thread_map__new_by_tid(-1);
        if (!cpus || !threads) {
                err = -ENOMEM;
index e36da58522efb3d9639bd6f12c00ff7ecb6e9a8b..ff7f85ded89d73bbdb1c106380619a087d27bc38 100644 (file)
@@ -1056,7 +1056,7 @@ int evlist__create_maps(struct evlist *evlist, struct target *target)
                return -1;
 
        if (target__uses_dummy_map(target))
-               cpus = perf_cpu_map__dummy_new();
+               cpus = perf_cpu_map__new_any_cpu();
        else
                cpus = perf_cpu_map__new(target->cpu_list);
 
index 532f34d9fcb503aeb17b43561481d4443200ef32..6d7c9c58a9bcb8b7ed70e38286026cac16543163 100644 (file)
@@ -1801,7 +1801,7 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
 
        if (cpus == NULL) {
                if (empty_cpu_map == NULL) {
-                       empty_cpu_map = perf_cpu_map__dummy_new();
+                       empty_cpu_map = perf_cpu_map__new_any_cpu();
                        if (empty_cpu_map == NULL)
                                return -ENOMEM;
                }