aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/cpumap.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2020-11-26 16:13:24 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-12-24 10:04:52 -0300
commitfcd83a35dd93b89d3f48cfcd33c31b112cc96180 (patch)
treef500e86bccadf4822b56ff5a65565c6550d94528 /tools/perf/util/cpumap.c
parentperf stat aggregation: Start using cpu_aggr_id in map (diff)
downloadlinux-dev-fcd83a35dd93b89d3f48cfcd33c31b112cc96180.tar.xz
linux-dev-fcd83a35dd93b89d3f48cfcd33c31b112cc96180.zip
perf stat aggregation: Add separate node member
Add node as a separate member so that it doesn't have to be packed into the int value. Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: John Garry <john.garry@huawei.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Richter <tmricht@linux.ibm.com> Link: https://lore.kernel.org/r/20201126141328.6509-9-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/cpumap.c')
-rw-r--r--tools/perf/util/cpumap.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index b50609b9a585..5f9e98ddbe34 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -148,7 +148,10 @@ static int cmp_aggr_cpu_id(const void *a_pointer, const void *b_pointer)
struct aggr_cpu_id *a = (struct aggr_cpu_id *)a_pointer;
struct aggr_cpu_id *b = (struct aggr_cpu_id *)b_pointer;
- return a->id - b->id;
+ if (a->id != b->id)
+ return a->id - b->id;
+ else
+ return a->node - b->node;
}
int cpu_map__build_map(struct perf_cpu_map *cpus, struct cpu_aggr_map **res,
@@ -275,7 +278,7 @@ struct aggr_cpu_id cpu_map__get_node(struct perf_cpu_map *map, int idx, void *da
if (idx < 0 || idx >= map->nr)
return id;
- id.id = cpu_map__get_node_id(map->map[idx]);
+ id.node = cpu_map__get_node_id(map->map[idx]);
return id;
}
@@ -620,18 +623,21 @@ const struct perf_cpu_map *cpu_map__online(void) /* thread unsafe */
bool cpu_map__compare_aggr_cpu_id(struct aggr_cpu_id a, struct aggr_cpu_id b)
{
- return a.id == b.id;
+ return a.id == b.id &&
+ a.node == b.node;
}
bool cpu_map__aggr_cpu_id_is_empty(struct aggr_cpu_id a)
{
- return a.id == -1;
+ return a.id == -1 &&
+ a.node == -1;
}
struct aggr_cpu_id cpu_map__empty_aggr_cpu_id(void)
{
struct aggr_cpu_id ret = {
- .id = -1
+ .id = -1,
+ .node = -1
};
return ret;
}