Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libperf cpumap: Rename perf_cpu_map__dummy_new() to perf_cpu_map__new_any_cpu()

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>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
48219b08 8596ba32

+14 -14
+1 -1
tools/lib/perf/Documentation/libperf.txt
··· 37 37 38 38 struct perf_cpu_map; 39 39 40 - struct perf_cpu_map *perf_cpu_map__dummy_new(void); 40 + struct perf_cpu_map *perf_cpu_map__new_any_cpu(void); 41 41 struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); 42 42 struct perf_cpu_map *perf_cpu_map__read(FILE *file); 43 43 struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
+2 -2
tools/lib/perf/cpumap.c
··· 27 27 return result; 28 28 } 29 29 30 - struct perf_cpu_map *perf_cpu_map__dummy_new(void) 30 + struct perf_cpu_map *perf_cpu_map__new_any_cpu(void) 31 31 { 32 32 struct perf_cpu_map *cpus = perf_cpu_map__alloc(1); 33 33 ··· 271 271 else if (*cpu_list != '\0') 272 272 cpus = cpu_map__default_new(); 273 273 else 274 - cpus = perf_cpu_map__dummy_new(); 274 + cpus = perf_cpu_map__new_any_cpu(); 275 275 invalid: 276 276 free(tmp_cpus); 277 277 out:
+1 -1
tools/lib/perf/evsel.c
··· 120 120 static struct perf_cpu_map *empty_cpu_map; 121 121 122 122 if (empty_cpu_map == NULL) { 123 - empty_cpu_map = perf_cpu_map__dummy_new(); 123 + empty_cpu_map = perf_cpu_map__new_any_cpu(); 124 124 if (empty_cpu_map == NULL) 125 125 return -ENOMEM; 126 126 }
+2 -2
tools/lib/perf/include/perf/cpumap.h
··· 19 19 struct perf_cpu_map; 20 20 21 21 /** 22 - * perf_cpu_map__dummy_new - a map with a singular "any CPU"/dummy -1 value. 22 + * perf_cpu_map__new_any_cpu - a map with a singular "any CPU"/dummy -1 value. 23 23 */ 24 - LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); 24 + LIBPERF_API struct perf_cpu_map *perf_cpu_map__new_any_cpu(void); 25 25 LIBPERF_API struct perf_cpu_map *perf_cpu_map__default_new(void); 26 26 LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); 27 27 LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file);
+1 -1
tools/lib/perf/libperf.map
··· 1 1 LIBPERF_0.0.1 { 2 2 global: 3 3 libperf_init; 4 - perf_cpu_map__dummy_new; 4 + perf_cpu_map__new_any_cpu; 5 5 perf_cpu_map__default_new; 6 6 perf_cpu_map__get; 7 7 perf_cpu_map__put;
+1 -1
tools/lib/perf/tests/test-cpumap.c
··· 21 21 22 22 libperf_init(libperf_print); 23 23 24 - cpus = perf_cpu_map__dummy_new(); 24 + cpus = perf_cpu_map__new_any_cpu(); 25 25 if (!cpus) 26 26 return -1; 27 27
+1 -1
tools/lib/perf/tests/test-evlist.c
··· 261 261 threads = perf_thread_map__new_dummy(); 262 262 __T("failed to create threads", threads); 263 263 264 - cpus = perf_cpu_map__dummy_new(); 264 + cpus = perf_cpu_map__new_any_cpu(); 265 265 __T("failed to create cpus", cpus); 266 266 267 267 perf_thread_map__set_pid(threads, 0, pid);
+1 -1
tools/perf/tests/cpumap.c
··· 213 213 214 214 static int test__cpu_map_equal(struct test_suite *test __maybe_unused, int subtest __maybe_unused) 215 215 { 216 - struct perf_cpu_map *any = perf_cpu_map__dummy_new(); 216 + struct perf_cpu_map *any = perf_cpu_map__new_any_cpu(); 217 217 struct perf_cpu_map *one = perf_cpu_map__new("1"); 218 218 struct perf_cpu_map *two = perf_cpu_map__new("2"); 219 219 struct perf_cpu_map *empty = perf_cpu_map__intersect(one, two);
+1 -1
tools/perf/tests/sw-clock.c
··· 62 62 } 63 63 evlist__add(evlist, evsel); 64 64 65 - cpus = perf_cpu_map__dummy_new(); 65 + cpus = perf_cpu_map__new_any_cpu(); 66 66 threads = thread_map__new_by_tid(getpid()); 67 67 if (!cpus || !threads) { 68 68 err = -ENOMEM;
+1 -1
tools/perf/tests/task-exit.c
··· 70 70 * evlist__prepare_workload we'll fill in the only thread 71 71 * we're monitoring, the one forked there. 72 72 */ 73 - cpus = perf_cpu_map__dummy_new(); 73 + cpus = perf_cpu_map__new_any_cpu(); 74 74 threads = thread_map__new_by_tid(-1); 75 75 if (!cpus || !threads) { 76 76 err = -ENOMEM;
+1 -1
tools/perf/util/evlist.c
··· 1056 1056 return -1; 1057 1057 1058 1058 if (target__uses_dummy_map(target)) 1059 - cpus = perf_cpu_map__dummy_new(); 1059 + cpus = perf_cpu_map__new_any_cpu(); 1060 1060 else 1061 1061 cpus = perf_cpu_map__new(target->cpu_list); 1062 1062
+1 -1
tools/perf/util/evsel.c
··· 1801 1801 1802 1802 if (cpus == NULL) { 1803 1803 if (empty_cpu_map == NULL) { 1804 - empty_cpu_map = perf_cpu_map__dummy_new(); 1804 + empty_cpu_map = perf_cpu_map__new_any_cpu(); 1805 1805 if (empty_cpu_map == NULL) 1806 1806 return -ENOMEM; 1807 1807 }