summaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/topology.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2020-11-26 16:13:20 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-12-24 10:04:19 -0300
commit2760f5a14fe7aa466e38bbb92d0284fffc0e4da0 (patch)
tree4900ff590ce904072523c32b2c9756d7311fe5aa /tools/perf/tests/topology.c
parentfa265e59b81a09fa3d88f3322b1e44d583cac9b0 (diff)
downloadlinux-2760f5a14fe7aa466e38bbb92d0284fffc0e4da0.tar.bz2
perf stat: Replace aggregation ID with a struct
Replace all occurences of the usage of int with the new struct cpu_aggr_id. No functional changes. 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-5-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/topology.c')
-rw-r--r--tools/perf/tests/topology.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index f988b3109afc..7a7d16b3950a 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -64,7 +64,8 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
.path = path,
.mode = PERF_DATA_MODE_READ,
};
- int i, id;
+ int i;
+ struct aggr_cpu_id id;
session = perf_session__new(&data, false, NULL);
TEST_ASSERT_VAL("can't get session", !IS_ERR(session));
@@ -110,14 +111,14 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
for (i = 0; i < map->nr; i++) {
id = cpu_map__get_core(map, i, NULL);
TEST_ASSERT_VAL("Core map - Core ID doesn't match",
- session->header.env.cpu[map->map[i]].core_id == cpu_map__id_to_cpu(id));
+ session->header.env.cpu[map->map[i]].core_id == cpu_map__id_to_cpu(id.id));
TEST_ASSERT_VAL("Core map - Socket ID doesn't match",
session->header.env.cpu[map->map[i]].socket_id ==
- cpu_map__id_to_socket(id));
+ cpu_map__id_to_socket(id.id));
TEST_ASSERT_VAL("Core map - Die ID doesn't match",
- session->header.env.cpu[map->map[i]].die_id == cpu_map__id_to_die(id));
+ session->header.env.cpu[map->map[i]].die_id == cpu_map__id_to_die(id.id));
}
// Test that die ID contains socket and die
@@ -125,25 +126,25 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
id = cpu_map__get_die(map, i, NULL);
TEST_ASSERT_VAL("Die map - Socket ID doesn't match",
session->header.env.cpu[map->map[i]].socket_id ==
- cpu_map__id_to_socket(id << 16));
+ cpu_map__id_to_socket(id.id << 16));
TEST_ASSERT_VAL("Die map - Die ID doesn't match",
session->header.env.cpu[map->map[i]].die_id ==
- cpu_map__id_to_die(id << 16));
+ cpu_map__id_to_die(id.id << 16));
}
// Test that socket ID contains only socket
for (i = 0; i < map->nr; i++) {
id = cpu_map__get_socket(map, i, NULL);
TEST_ASSERT_VAL("Socket map - Socket ID doesn't match",
- session->header.env.cpu[map->map[i]].socket_id == id);
+ session->header.env.cpu[map->map[i]].socket_id == id.id);
}
// Test that node ID contains only node
for (i = 0; i < map->nr; i++) {
id = cpu_map__get_node(map, i, NULL);
TEST_ASSERT_VAL("Node map - Node ID doesn't match",
- cpu__get_node(map->map[i]) == id);
+ cpu__get_node(map->map[i]) == id.id);
}
perf_session__delete(session);