* [PATCH] perf cpumap: Migrate to libperf cpumap api
@ 2022-02-17 1:27 tangmeng
0 siblings, 0 replies; only message in thread
From: tangmeng @ 2022-02-17 1:27 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung
Cc: linux-kernel, tangmeng
Switch from directly accessing the perf_cpu_map__cpu to using the
appropriate libperf API when possible. Using the API simplifies
the job of refactoring use of perf_cpu_map__cpu.
Signed-off-by: tangmeng <tangmeng@uniontech.com>
---
tools/perf/util/cpumap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 12b2243222b0..986d580d8984 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -508,17 +508,18 @@ size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size)
"%s%d", COMMA,
map->map[i].cpu);
}
- } else if (((i - start) != (cpu.cpu - map->map[start].cpu)) || last) {
+ } else if (((i - start) != (cpu.cpu - perf_cpu_map__cpu(map, start).cpu)) || last) {
int end = i - 1;
if (start == end) {
ret += snprintf(buf + ret, size - ret,
"%s%d", COMMA,
- map->map[start].cpu);
+ perf_cpu_map__cpu(map, start).cpu);
} else {
ret += snprintf(buf + ret, size - ret,
"%s%d-%d", COMMA,
- map->map[start].cpu, map->map[end].cpu);
+ perf_cpu_map__cpu(map, start).cpu,
+ perf_cpu_map__cpu(map, end).cpu);
}
first = false;
start = i;
--
2.20.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-17 1:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 1:27 [PATCH] perf cpumap: Migrate to libperf cpumap api tangmeng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®