Commit 2760f5a1 authored by James Clark's avatar James Clark Committed by Arnaldo Carvalho de Melo

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: default avatarJames Clark <james.clark@arm.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: default avatarJohn 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fa265e59
...@@ -1186,65 +1186,67 @@ static struct option stat_options[] = { ...@@ -1186,65 +1186,67 @@ static struct option stat_options[] = {
OPT_END() OPT_END()
}; };
static int perf_stat__get_socket(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_socket(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int cpu) struct perf_cpu_map *map, int cpu)
{ {
return cpu_map__get_socket(map, cpu, NULL); return cpu_map__get_socket(map, cpu, NULL);
} }
static int perf_stat__get_die(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_die(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int cpu) struct perf_cpu_map *map, int cpu)
{ {
return cpu_map__get_die(map, cpu, NULL); return cpu_map__get_die(map, cpu, NULL);
} }
static int perf_stat__get_core(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_core(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int cpu) struct perf_cpu_map *map, int cpu)
{ {
return cpu_map__get_core(map, cpu, NULL); return cpu_map__get_core(map, cpu, NULL);
} }
static int perf_stat__get_node(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_node(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int cpu) struct perf_cpu_map *map, int cpu)
{ {
return cpu_map__get_node(map, cpu, NULL); return cpu_map__get_node(map, cpu, NULL);
} }
static int perf_stat__get_aggr(struct perf_stat_config *config, static struct aggr_cpu_id perf_stat__get_aggr(struct perf_stat_config *config,
aggr_get_id_t get_id, struct perf_cpu_map *map, int idx) aggr_get_id_t get_id, struct perf_cpu_map *map, int idx)
{ {
int cpu; int cpu;
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (idx >= map->nr) if (idx >= map->nr)
return -1; return id;
cpu = map->map[idx]; cpu = map->map[idx];
if (config->cpus_aggr_map->map[cpu] == -1) if (config->cpus_aggr_map->map[cpu] == -1)
config->cpus_aggr_map->map[cpu] = get_id(config, map, idx); config->cpus_aggr_map->map[cpu] = get_id(config, map, idx).id;
return config->cpus_aggr_map->map[cpu]; id.id = config->cpus_aggr_map->map[cpu];
return id;
} }
static int perf_stat__get_socket_cached(struct perf_stat_config *config, static struct aggr_cpu_id perf_stat__get_socket_cached(struct perf_stat_config *config,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_stat__get_aggr(config, perf_stat__get_socket, map, idx); return perf_stat__get_aggr(config, perf_stat__get_socket, map, idx);
} }
static int perf_stat__get_die_cached(struct perf_stat_config *config, static struct aggr_cpu_id perf_stat__get_die_cached(struct perf_stat_config *config,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_stat__get_aggr(config, perf_stat__get_die, map, idx); return perf_stat__get_aggr(config, perf_stat__get_die, map, idx);
} }
static int perf_stat__get_core_cached(struct perf_stat_config *config, static struct aggr_cpu_id perf_stat__get_core_cached(struct perf_stat_config *config,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_stat__get_aggr(config, perf_stat__get_core, map, idx); return perf_stat__get_aggr(config, perf_stat__get_core, map, idx);
} }
static int perf_stat__get_node_cached(struct perf_stat_config *config, static struct aggr_cpu_id perf_stat__get_node_cached(struct perf_stat_config *config,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_stat__get_aggr(config, perf_stat__get_node, map, idx); return perf_stat__get_aggr(config, perf_stat__get_node, map, idx);
...@@ -1345,18 +1347,23 @@ static inline int perf_env__get_cpu(struct perf_env *env, struct perf_cpu_map *m ...@@ -1345,18 +1347,23 @@ static inline int perf_env__get_cpu(struct perf_env *env, struct perf_cpu_map *m
return cpu; return cpu;
} }
static int perf_env__get_socket(struct perf_cpu_map *map, int idx, void *data) static struct aggr_cpu_id perf_env__get_socket(struct perf_cpu_map *map, int idx, void *data)
{ {
struct perf_env *env = data; struct perf_env *env = data;
int cpu = perf_env__get_cpu(env, map, idx); int cpu = perf_env__get_cpu(env, map, idx);
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (cpu != -1)
id.id = env->cpu[cpu].socket_id;
return cpu == -1 ? -1 : env->cpu[cpu].socket_id; return id;
} }
static int perf_env__get_die(struct perf_cpu_map *map, int idx, void *data) static struct aggr_cpu_id perf_env__get_die(struct perf_cpu_map *map, int idx, void *data)
{ {
struct perf_env *env = data; struct perf_env *env = data;
int die_id = -1, cpu = perf_env__get_cpu(env, map, idx); struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
int cpu = perf_env__get_cpu(env, map, idx);
if (cpu != -1) { if (cpu != -1) {
/* /*
...@@ -1366,21 +1373,22 @@ static int perf_env__get_die(struct perf_cpu_map *map, int idx, void *data) ...@@ -1366,21 +1373,22 @@ static int perf_env__get_die(struct perf_cpu_map *map, int idx, void *data)
* socket + die id * socket + die id
*/ */
if (WARN_ONCE(env->cpu[cpu].socket_id >> 8, "The socket id number is too big.\n")) if (WARN_ONCE(env->cpu[cpu].socket_id >> 8, "The socket id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
if (WARN_ONCE(env->cpu[cpu].die_id >> 8, "The die id number is too big.\n")) if (WARN_ONCE(env->cpu[cpu].die_id >> 8, "The die id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
die_id = (env->cpu[cpu].socket_id << 8) | (env->cpu[cpu].die_id & 0xff); id.id = (env->cpu[cpu].socket_id << 8) | (env->cpu[cpu].die_id & 0xff);
} }
return die_id; return id;
} }
static int perf_env__get_core(struct perf_cpu_map *map, int idx, void *data) static struct aggr_cpu_id perf_env__get_core(struct perf_cpu_map *map, int idx, void *data)
{ {
struct perf_env *env = data; struct perf_env *env = data;
int core = -1, cpu = perf_env__get_cpu(env, map, idx); struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
int cpu = perf_env__get_cpu(env, map, idx);
if (cpu != -1) { if (cpu != -1) {
/* /*
...@@ -1391,27 +1399,29 @@ static int perf_env__get_core(struct perf_cpu_map *map, int idx, void *data) ...@@ -1391,27 +1399,29 @@ static int perf_env__get_core(struct perf_cpu_map *map, int idx, void *data)
* socket + die id + core id * socket + die id + core id
*/ */
if (WARN_ONCE(env->cpu[cpu].socket_id >> 8, "The socket id number is too big.\n")) if (WARN_ONCE(env->cpu[cpu].socket_id >> 8, "The socket id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
if (WARN_ONCE(env->cpu[cpu].die_id >> 8, "The die id number is too big.\n")) if (WARN_ONCE(env->cpu[cpu].die_id >> 8, "The die id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
if (WARN_ONCE(env->cpu[cpu].core_id >> 16, "The core id number is too big.\n")) if (WARN_ONCE(env->cpu[cpu].core_id >> 16, "The core id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
core = (env->cpu[cpu].socket_id << 24) | id.id = (env->cpu[cpu].socket_id << 24) |
(env->cpu[cpu].die_id << 16) | (env->cpu[cpu].die_id << 16) |
(env->cpu[cpu].core_id & 0xffff); (env->cpu[cpu].core_id & 0xffff);
} }
return core; return id;
} }
static int perf_env__get_node(struct perf_cpu_map *map, int idx, void *data) static struct aggr_cpu_id perf_env__get_node(struct perf_cpu_map *map, int idx, void *data)
{ {
int cpu = perf_env__get_cpu(data, map, idx); int cpu = perf_env__get_cpu(data, map, idx);
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
return perf_env__numa_node(data, cpu); id.id = perf_env__numa_node(data, cpu);
return id;
} }
static int perf_env__build_socket_map(struct perf_env *env, struct perf_cpu_map *cpus, static int perf_env__build_socket_map(struct perf_env *env, struct perf_cpu_map *cpus,
...@@ -1438,24 +1448,24 @@ static int perf_env__build_node_map(struct perf_env *env, struct perf_cpu_map *c ...@@ -1438,24 +1448,24 @@ static int perf_env__build_node_map(struct perf_env *env, struct perf_cpu_map *c
return cpu_map__build_map(cpus, nodep, perf_env__get_node, env); return cpu_map__build_map(cpus, nodep, perf_env__get_node, env);
} }
static int perf_stat__get_socket_file(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_socket_file(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_env__get_socket(map, idx, &perf_stat.session->header.env); return perf_env__get_socket(map, idx, &perf_stat.session->header.env);
} }
static int perf_stat__get_die_file(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_die_file(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_env__get_die(map, idx, &perf_stat.session->header.env); return perf_env__get_die(map, idx, &perf_stat.session->header.env);
} }
static int perf_stat__get_core_file(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_core_file(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_env__get_core(map, idx, &perf_stat.session->header.env); return perf_env__get_core(map, idx, &perf_stat.session->header.env);
} }
static int perf_stat__get_node_file(struct perf_stat_config *config __maybe_unused, static struct aggr_cpu_id perf_stat__get_node_file(struct perf_stat_config *config __maybe_unused,
struct perf_cpu_map *map, int idx) struct perf_cpu_map *map, int idx)
{ {
return perf_env__get_node(map, idx, &perf_stat.session->header.env); return perf_env__get_node(map, idx, &perf_stat.session->header.env);
......
...@@ -64,7 +64,8 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -64,7 +64,8 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
.path = path, .path = path,
.mode = PERF_DATA_MODE_READ, .mode = PERF_DATA_MODE_READ,
}; };
int i, id; int i;
struct aggr_cpu_id id;
session = perf_session__new(&data, false, NULL); session = perf_session__new(&data, false, NULL);
TEST_ASSERT_VAL("can't get session", !IS_ERR(session)); 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) ...@@ -110,14 +111,14 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
for (i = 0; i < map->nr; i++) { for (i = 0; i < map->nr; i++) {
id = cpu_map__get_core(map, i, NULL); id = cpu_map__get_core(map, i, NULL);
TEST_ASSERT_VAL("Core map - Core ID doesn't match", 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", TEST_ASSERT_VAL("Core map - Socket ID doesn't match",
session->header.env.cpu[map->map[i]].socket_id == 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", 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 // Test that die ID contains socket and die
...@@ -125,25 +126,25 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) ...@@ -125,25 +126,25 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
id = cpu_map__get_die(map, i, NULL); id = cpu_map__get_die(map, i, NULL);
TEST_ASSERT_VAL("Die map - Socket ID doesn't match", TEST_ASSERT_VAL("Die map - Socket ID doesn't match",
session->header.env.cpu[map->map[i]].socket_id == 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", TEST_ASSERT_VAL("Die map - Die ID doesn't match",
session->header.env.cpu[map->map[i]].die_id == 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 // Test that socket ID contains only socket
for (i = 0; i < map->nr; i++) { for (i = 0; i < map->nr; i++) {
id = cpu_map__get_socket(map, i, NULL); id = cpu_map__get_socket(map, i, NULL);
TEST_ASSERT_VAL("Socket map - Socket ID doesn't match", 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 // Test that node ID contains only node
for (i = 0; i < map->nr; i++) { for (i = 0; i < map->nr; i++) {
id = cpu_map__get_node(map, i, NULL); id = cpu_map__get_node(map, i, NULL);
TEST_ASSERT_VAL("Node map - Node ID doesn't match", 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); perf_session__delete(session);
......
...@@ -111,30 +111,37 @@ int cpu_map__get_socket_id(int cpu) ...@@ -111,30 +111,37 @@ int cpu_map__get_socket_id(int cpu)
return ret ?: value; return ret ?: value;
} }
int cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data __maybe_unused) struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx,
void *data __maybe_unused)
{ {
int cpu; int cpu;
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (idx > map->nr) if (idx > map->nr)
return -1; return id;
cpu = map->map[idx]; cpu = map->map[idx];
return cpu_map__get_socket_id(cpu); id.id = cpu_map__get_socket_id(cpu);
return id;
} }
static int cmp_ids(const void *a, const void *b) static int cmp_aggr_cpu_id(const void *a_pointer, const void *b_pointer)
{ {
return *(int *)a - *(int *)b; 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;
} }
int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res, int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res,
int (*f)(struct perf_cpu_map *map, int cpu, void *data), struct aggr_cpu_id (*f)(struct perf_cpu_map *map, int cpu, void *data),
void *data) void *data)
{ {
int nr = cpus->nr; int nr = cpus->nr;
struct perf_cpu_map *c = perf_cpu_map__empty_new(nr); struct perf_cpu_map *c = perf_cpu_map__empty_new(nr);
int cpu, s1, s2; int cpu, s2;
struct aggr_cpu_id s1;
if (!c) if (!c)
return -1; return -1;
...@@ -145,16 +152,16 @@ int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res, ...@@ -145,16 +152,16 @@ int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res,
for (cpu = 0; cpu < nr; cpu++) { for (cpu = 0; cpu < nr; cpu++) {
s1 = f(cpus, cpu, data); s1 = f(cpus, cpu, data);
for (s2 = 0; s2 < c->nr; s2++) { for (s2 = 0; s2 < c->nr; s2++) {
if (s1 == c->map[s2]) if (s1.id == c->map[s2])
break; break;
} }
if (s2 == c->nr) { if (s2 == c->nr) {
c->map[c->nr] = s1; c->map[c->nr] = s1.id;
c->nr++; c->nr++;
} }
} }
/* ensure we process id in increasing order */ /* ensure we process id in increasing order */
qsort(c->map, c->nr, sizeof(int), cmp_ids); qsort(c->map, c->nr, sizeof(struct aggr_cpu_id), cmp_aggr_cpu_id);
*res = c; *res = c;
return 0; return 0;
...@@ -167,23 +174,24 @@ int cpu_map__get_die_id(int cpu) ...@@ -167,23 +174,24 @@ int cpu_map__get_die_id(int cpu)
return ret ?: value; return ret ?: value;
} }
int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data) struct aggr_cpu_id cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data)
{ {
int cpu, die_id, s; int cpu, s;
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (idx > map->nr) if (idx > map->nr)
return -1; return id;
cpu = map->map[idx]; cpu = map->map[idx];
die_id = cpu_map__get_die_id(cpu); id.id = cpu_map__get_die_id(cpu);
/* There is no die_id on legacy system. */ /* There is no die_id on legacy system. */
if (die_id == -1) if (id.id == -1)
die_id = 0; id.id = 0;
s = cpu_map__get_socket(map, idx, data); s = cpu_map__get_socket(map, idx, data).id;
if (s == -1) if (s == -1)
return -1; return cpu_map__empty_aggr_cpu_id();
/* /*
* Encode socket in bit range 15:8 * Encode socket in bit range 15:8
...@@ -191,13 +199,14 @@ int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data) ...@@ -191,13 +199,14 @@ int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data)
* we need a global id. So we combine * we need a global id. So we combine
* socket + die id * socket + die id
*/ */
if (WARN_ONCE(die_id >> 8, "The die id number is too big.\n")) if (WARN_ONCE(id.id >> 8, "The die id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
if (WARN_ONCE(s >> 8, "The socket id number is too big.\n")) if (WARN_ONCE(s >> 8, "The socket id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
return (s << 8) | (die_id & 0xff); id.id = (s << 8) | (id.id & 0xff);
return id;
} }
int cpu_map__get_core_id(int cpu) int cpu_map__get_core_id(int cpu)
...@@ -211,21 +220,22 @@ int cpu_map__get_node_id(int cpu) ...@@ -211,21 +220,22 @@ int cpu_map__get_node_id(int cpu)
return cpu__get_node(cpu); return cpu__get_node(cpu);
} }
int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data) struct aggr_cpu_id cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data)
{ {
int cpu, s_die; int cpu;
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (idx > map->nr) if (idx > map->nr)
return -1; return id;
cpu = map->map[idx]; cpu = map->map[idx];
cpu = cpu_map__get_core_id(cpu); cpu = cpu_map__get_core_id(cpu);
/* s_die is the combination of socket + die id */ /* cpu_map__get_die returns the combination of socket + die id */
s_die = cpu_map__get_die(map, idx, data); id = cpu_map__get_die(map, idx, data);
if (s_die == -1) if (cpu_map__aggr_cpu_id_is_empty(id))
return -1; return id;
/* /*
* encode socket in bit range 31:24 * encode socket in bit range 31:24
...@@ -235,17 +245,21 @@ int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data) ...@@ -235,17 +245,21 @@ int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data)
* socket + die id + core id * socket + die id + core id
*/ */
if (WARN_ONCE(cpu >> 16, "The core id number is too big.\n")) if (WARN_ONCE(cpu >> 16, "The core id number is too big.\n"))
return -1; return cpu_map__empty_aggr_cpu_id();
return (s_die << 16) | (cpu & 0xffff); id.id = (id.id << 16) | (cpu & 0xffff);
return id;
} }
int cpu_map__get_node(struct perf_cpu_map *map, int idx, void *data __maybe_unused) struct aggr_cpu_id cpu_map__get_node(struct perf_cpu_map *map, int idx, void *data __maybe_unused)
{ {
struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id();
if (idx < 0 || idx >= map->nr) if (idx < 0 || idx >= map->nr)
return -1; return id;
return cpu_map__get_node_id(map->map[idx]); id.id = cpu_map__get_node_id(map->map[idx]);
return id;
} }
int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp) int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp)
......
...@@ -19,13 +19,13 @@ size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size); ...@@ -19,13 +19,13 @@ size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size);
size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size); size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size);
size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp); size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp);
int cpu_map__get_socket_id(int cpu); int cpu_map__get_socket_id(int cpu);
int cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data); struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data);
int cpu_map__get_die_id(int cpu); int cpu_map__get_die_id(int cpu);
int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data); struct aggr_cpu_id cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data);
int cpu_map__get_core_id(int cpu); int cpu_map__get_core_id(int cpu);
int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data); struct aggr_cpu_id cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data);
int cpu_map__get_node_id(int cpu); int cpu_map__get_node_id(int cpu);
int cpu_map__get_node(struct perf_cpu_map *map, int idx, void *data); struct aggr_cpu_id cpu_map__get_node(struct perf_cpu_map *map, int idx, void *data);
int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp); int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp);
int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep); int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep);
int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep); int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep);
...@@ -62,7 +62,7 @@ int cpu__max_present_cpu(void); ...@@ -62,7 +62,7 @@ int cpu__max_present_cpu(void);
int cpu__get_node(int cpu); int cpu__get_node(int cpu);
int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res, int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res,
int (*f)(struct perf_cpu_map *map, int cpu, void *data), struct aggr_cpu_id (*f)(struct perf_cpu_map *map, int cpu, void *data),
void *data); void *data);
int cpu_map__cpu(struct perf_cpu_map *cpus, int idx); int cpu_map__cpu(struct perf_cpu_map *cpus, int idx);
......
This diff is collapsed.
...@@ -313,7 +313,7 @@ static int check_per_pkg(struct evsel *counter, ...@@ -313,7 +313,7 @@ static int check_per_pkg(struct evsel *counter,
if (!(vals->run && vals->ena)) if (!(vals->run && vals->ena))
return 0; return 0;
s = cpu_map__get_socket(cpus, cpu, NULL); s = cpu_map__get_socket(cpus, cpu, NULL).id;
if (s < 0) if (s < 0)
return -1; return -1;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/resource.h> #include <sys/resource.h>
#include "cpumap.h"
#include "rblist.h" #include "rblist.h"
struct perf_cpu_map; struct perf_cpu_map;
...@@ -99,7 +100,7 @@ struct runtime_stat { ...@@ -99,7 +100,7 @@ struct runtime_stat {
struct rblist value_list; struct rblist value_list;
}; };
typedef int (*aggr_get_id_t)(struct perf_stat_config *config, typedef struct aggr_cpu_id (*aggr_get_id_t)(struct perf_stat_config *config,
struct perf_cpu_map *m, int cpu); struct perf_cpu_map *m, int cpu);
struct perf_stat_config { struct perf_stat_config {
...@@ -170,7 +171,7 @@ struct evlist; ...@@ -170,7 +171,7 @@ struct evlist;
struct perf_aggr_thread_value { struct perf_aggr_thread_value {
struct evsel *counter; struct evsel *counter;
int id; struct aggr_cpu_id id;
double uval; double uval;
u64 val; u64 val;
u64 run; u64 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