Commit fa2edc07 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Rename to aggr_cpu_id.thread_idx

The aggr_cpu_id has a thread value but it's actually an index to the
thread_map.  To reduce possible confusion, rename it to thread_idx.
Suggested-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20220930202110.845199-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 01b8957b
...@@ -147,7 +147,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -147,7 +147,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
TEST_ASSERT_VAL("Cpu map - Die ID doesn't match", TEST_ASSERT_VAL("Cpu map - Die ID doesn't match",
session->header.env.cpu[perf_cpu_map__cpu(map, i).cpu].die_id == id.die); session->header.env.cpu[perf_cpu_map__cpu(map, i).cpu].die_id == id.die);
TEST_ASSERT_VAL("Cpu map - Node ID is set", id.node == -1); TEST_ASSERT_VAL("Cpu map - Node ID is set", id.node == -1);
TEST_ASSERT_VAL("Cpu map - Thread is set", id.thread == -1); TEST_ASSERT_VAL("Cpu map - Thread IDX is set", id.thread_idx == -1);
} }
// Test that core ID contains socket, die and core // Test that core ID contains socket, die and core
...@@ -163,7 +163,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -163,7 +163,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
TEST_ASSERT_VAL("Core map - Die ID doesn't match", TEST_ASSERT_VAL("Core map - Die ID doesn't match",
session->header.env.cpu[perf_cpu_map__cpu(map, i).cpu].die_id == id.die); session->header.env.cpu[perf_cpu_map__cpu(map, i).cpu].die_id == id.die);
TEST_ASSERT_VAL("Core map - Node ID is set", id.node == -1); TEST_ASSERT_VAL("Core map - Node ID is set", id.node == -1);
TEST_ASSERT_VAL("Core map - Thread is set", id.thread == -1); TEST_ASSERT_VAL("Core map - Thread IDX is set", id.thread_idx == -1);
} }
// Test that die ID contains socket and die // Test that die ID contains socket and die
...@@ -179,7 +179,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -179,7 +179,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
TEST_ASSERT_VAL("Die map - Node ID is set", id.node == -1); TEST_ASSERT_VAL("Die map - Node ID is set", id.node == -1);
TEST_ASSERT_VAL("Die map - Core is set", id.core == -1); TEST_ASSERT_VAL("Die map - Core is set", id.core == -1);
TEST_ASSERT_VAL("Die map - CPU is set", id.cpu.cpu == -1); TEST_ASSERT_VAL("Die map - CPU is set", id.cpu.cpu == -1);
TEST_ASSERT_VAL("Die map - Thread is set", id.thread == -1); TEST_ASSERT_VAL("Die map - Thread IDX is set", id.thread_idx == -1);
} }
// Test that socket ID contains only socket // Test that socket ID contains only socket
...@@ -193,7 +193,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -193,7 +193,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
TEST_ASSERT_VAL("Socket map - Die ID is set", id.die == -1); TEST_ASSERT_VAL("Socket map - Die ID is set", id.die == -1);
TEST_ASSERT_VAL("Socket map - Core is set", id.core == -1); TEST_ASSERT_VAL("Socket map - Core is set", id.core == -1);
TEST_ASSERT_VAL("Socket map - CPU is set", id.cpu.cpu == -1); TEST_ASSERT_VAL("Socket map - CPU is set", id.cpu.cpu == -1);
TEST_ASSERT_VAL("Socket map - Thread is set", id.thread == -1); TEST_ASSERT_VAL("Socket map - Thread IDX is set", id.thread_idx == -1);
} }
// Test that node ID contains only node // Test that node ID contains only node
...@@ -205,7 +205,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -205,7 +205,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
TEST_ASSERT_VAL("Node map - Die ID is set", id.die == -1); TEST_ASSERT_VAL("Node map - Die ID is set", id.die == -1);
TEST_ASSERT_VAL("Node map - Core is set", id.core == -1); TEST_ASSERT_VAL("Node map - Core is set", id.core == -1);
TEST_ASSERT_VAL("Node map - CPU is set", id.cpu.cpu == -1); TEST_ASSERT_VAL("Node map - CPU is set", id.cpu.cpu == -1);
TEST_ASSERT_VAL("Node map - Thread is set", id.thread == -1); TEST_ASSERT_VAL("Node map - Thread IDX is set", id.thread_idx == -1);
} }
perf_session__delete(session); perf_session__delete(session);
......
...@@ -229,7 +229,7 @@ static int aggr_cpu_id__cmp(const void *a_pointer, const void *b_pointer) ...@@ -229,7 +229,7 @@ static int aggr_cpu_id__cmp(const void *a_pointer, const void *b_pointer)
else if (a->core != b->core) else if (a->core != b->core)
return a->core - b->core; return a->core - b->core;
else else
return a->thread - b->thread; return a->thread_idx - b->thread_idx;
} }
struct cpu_aggr_map *cpu_aggr_map__new(const struct perf_cpu_map *cpus, struct cpu_aggr_map *cpu_aggr_map__new(const struct perf_cpu_map *cpus,
...@@ -667,7 +667,7 @@ const struct perf_cpu_map *cpu_map__online(void) /* thread unsafe */ ...@@ -667,7 +667,7 @@ const struct perf_cpu_map *cpu_map__online(void) /* thread unsafe */
bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b) bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b)
{ {
return a->thread == b->thread && return a->thread_idx == b->thread_idx &&
a->node == b->node && a->node == b->node &&
a->socket == b->socket && a->socket == b->socket &&
a->die == b->die && a->die == b->die &&
...@@ -677,7 +677,7 @@ bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b ...@@ -677,7 +677,7 @@ bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b
bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a) bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a)
{ {
return a->thread == -1 && return a->thread_idx == -1 &&
a->node == -1 && a->node == -1 &&
a->socket == -1 && a->socket == -1 &&
a->die == -1 && a->die == -1 &&
...@@ -688,7 +688,7 @@ bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a) ...@@ -688,7 +688,7 @@ bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a)
struct aggr_cpu_id aggr_cpu_id__empty(void) struct aggr_cpu_id aggr_cpu_id__empty(void)
{ {
struct aggr_cpu_id ret = { struct aggr_cpu_id ret = {
.thread = -1, .thread_idx = -1,
.node = -1, .node = -1,
.socket = -1, .socket = -1,
.die = -1, .die = -1,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
/** Identify where counts are aggregated, -1 implies not to aggregate. */ /** Identify where counts are aggregated, -1 implies not to aggregate. */
struct aggr_cpu_id { struct aggr_cpu_id {
/** A value in the range 0 to number of threads. */ /** A value in the range 0 to number of threads. */
int thread; int thread_idx;
/** The numa node X as read from /sys/devices/system/node/nodeX. */ /** The numa node X as read from /sys/devices/system/node/nodeX. */
int node; int node;
/** /**
......
...@@ -189,14 +189,14 @@ static void aggr_printout(struct perf_stat_config *config, ...@@ -189,14 +189,14 @@ static void aggr_printout(struct perf_stat_config *config,
case AGGR_THREAD: case AGGR_THREAD:
if (config->json_output) { if (config->json_output) {
fprintf(config->output, "\"thread\" : \"%s-%d\", ", fprintf(config->output, "\"thread\" : \"%s-%d\", ",
perf_thread_map__comm(evsel->core.threads, id.thread), perf_thread_map__comm(evsel->core.threads, id.thread_idx),
perf_thread_map__pid(evsel->core.threads, id.thread)); perf_thread_map__pid(evsel->core.threads, id.thread_idx));
} else { } else {
fprintf(config->output, "%*s-%*d%s", fprintf(config->output, "%*s-%*d%s",
config->csv_output ? 0 : 16, config->csv_output ? 0 : 16,
perf_thread_map__comm(evsel->core.threads, id.thread), perf_thread_map__comm(evsel->core.threads, id.thread_idx),
config->csv_output ? 0 : -8, config->csv_output ? 0 : -8,
perf_thread_map__pid(evsel->core.threads, id.thread), perf_thread_map__pid(evsel->core.threads, id.thread_idx),
config->csv_sep); config->csv_sep);
} }
break; break;
...@@ -453,7 +453,7 @@ static int first_shadow_map_idx(struct perf_stat_config *config, ...@@ -453,7 +453,7 @@ static int first_shadow_map_idx(struct perf_stat_config *config,
return perf_cpu_map__idx(cpus, id->cpu); return perf_cpu_map__idx(cpus, id->cpu);
if (config->aggr_mode == AGGR_THREAD) if (config->aggr_mode == AGGR_THREAD)
return id->thread; return id->thread_idx;
if (!config->aggr_get_id) if (!config->aggr_get_id)
return 0; return 0;
...@@ -946,7 +946,7 @@ static struct perf_aggr_thread_value *sort_aggr_thread( ...@@ -946,7 +946,7 @@ static struct perf_aggr_thread_value *sort_aggr_thread(
buf[i].counter = counter; buf[i].counter = counter;
buf[i].id = aggr_cpu_id__empty(); buf[i].id = aggr_cpu_id__empty();
buf[i].id.thread = thread; buf[i].id.thread_idx = thread;
buf[i].uval = uval; buf[i].uval = uval;
buf[i].val = val; buf[i].val = val;
buf[i].run = run; buf[i].run = run;
......
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