perf cpumap: Migrate to libperf cpumap api
PATCH 1/1 perf cpumap: Migrate to libperf cpumap api
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 <[email protected]>
--- tools/perf/util/cpumap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/util/cpumap.c +4 -3
@@ -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;
Signature · 1 line
2.20.1