Commit 48219b08 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

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: default avatarJames Clark <james.clark@arm.com>
Signed-off-by: default avatarIan 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8596ba32
...@@ -37,7 +37,7 @@ SYNOPSIS ...@@ -37,7 +37,7 @@ SYNOPSIS
struct perf_cpu_map; 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__new(const char *cpu_list);
struct perf_cpu_map *perf_cpu_map__read(FILE *file); struct perf_cpu_map *perf_cpu_map__read(FILE *file);
struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
......
...@@ -27,7 +27,7 @@ struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus) ...@@ -27,7 +27,7 @@ struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus)
return result; 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); 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) ...@@ -271,7 +271,7 @@ struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list)
else if (*cpu_list != '\0') else if (*cpu_list != '\0')
cpus = cpu_map__default_new(); cpus = cpu_map__default_new();
else else
cpus = perf_cpu_map__dummy_new(); cpus = perf_cpu_map__new_any_cpu();
invalid: invalid:
free(tmp_cpus); free(tmp_cpus);
out: out:
......
...@@ -120,7 +120,7 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, ...@@ -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; static struct perf_cpu_map *empty_cpu_map;
if (empty_cpu_map == 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) if (empty_cpu_map == NULL)
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -19,9 +19,9 @@ struct perf_cache { ...@@ -19,9 +19,9 @@ struct perf_cache {
struct perf_cpu_map; 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__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__new(const char *cpu_list);
LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file); LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file);
......
LIBPERF_0.0.1 { LIBPERF_0.0.1 {
global: global:
libperf_init; libperf_init;
perf_cpu_map__dummy_new; perf_cpu_map__new_any_cpu;
perf_cpu_map__default_new; perf_cpu_map__default_new;
perf_cpu_map__get; perf_cpu_map__get;
perf_cpu_map__put; perf_cpu_map__put;
......
...@@ -21,7 +21,7 @@ int test_cpumap(int argc, char **argv) ...@@ -21,7 +21,7 @@ int test_cpumap(int argc, char **argv)
libperf_init(libperf_print); libperf_init(libperf_print);
cpus = perf_cpu_map__dummy_new(); cpus = perf_cpu_map__new_any_cpu();
if (!cpus) if (!cpus)
return -1; return -1;
......
...@@ -261,7 +261,7 @@ static int test_mmap_thread(void) ...@@ -261,7 +261,7 @@ static int test_mmap_thread(void)
threads = perf_thread_map__new_dummy(); threads = perf_thread_map__new_dummy();
__T("failed to create threads", threads); __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); __T("failed to create cpus", cpus);
perf_thread_map__set_pid(threads, 0, pid); perf_thread_map__set_pid(threads, 0, pid);
......
...@@ -213,7 +213,7 @@ static int test__cpu_map_intersect(struct test_suite *test __maybe_unused, ...@@ -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) 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 *one = perf_cpu_map__new("1");
struct perf_cpu_map *two = perf_cpu_map__new("2"); struct perf_cpu_map *two = perf_cpu_map__new("2");
struct perf_cpu_map *empty = perf_cpu_map__intersect(one, two); struct perf_cpu_map *empty = perf_cpu_map__intersect(one, two);
......
...@@ -62,7 +62,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) ...@@ -62,7 +62,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
} }
evlist__add(evlist, evsel); evlist__add(evlist, evsel);
cpus = perf_cpu_map__dummy_new(); cpus = perf_cpu_map__new_any_cpu();
threads = thread_map__new_by_tid(getpid()); threads = thread_map__new_by_tid(getpid());
if (!cpus || !threads) { if (!cpus || !threads) {
err = -ENOMEM; err = -ENOMEM;
......
...@@ -70,7 +70,7 @@ static int test__task_exit(struct test_suite *test __maybe_unused, int subtest _ ...@@ -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 * evlist__prepare_workload we'll fill in the only thread
* we're monitoring, the one forked there. * 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); threads = thread_map__new_by_tid(-1);
if (!cpus || !threads) { if (!cpus || !threads) {
err = -ENOMEM; err = -ENOMEM;
......
...@@ -1056,7 +1056,7 @@ int evlist__create_maps(struct evlist *evlist, struct target *target) ...@@ -1056,7 +1056,7 @@ int evlist__create_maps(struct evlist *evlist, struct target *target)
return -1; return -1;
if (target__uses_dummy_map(target)) if (target__uses_dummy_map(target))
cpus = perf_cpu_map__dummy_new(); cpus = perf_cpu_map__new_any_cpu();
else else
cpus = perf_cpu_map__new(target->cpu_list); cpus = perf_cpu_map__new(target->cpu_list);
......
...@@ -1801,7 +1801,7 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus, ...@@ -1801,7 +1801,7 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
if (cpus == NULL) { if (cpus == NULL) {
if (empty_cpu_map == 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) if (empty_cpu_map == NULL)
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment