for (cpu = 0; cpu < nr; cpu++) {
s1 = f(cpu, data);
for (s2 = 0; s2 < c->nr; s2++) {
- if (cpu_map__compare_aggr_cpu_id(s1, c->map[s2]))
+ if (aggr_cpu_id__equal(&s1, &c->map[s2]))
break;
}
if (s2 == c->nr) {
return online;
}
-bool cpu_map__compare_aggr_cpu_id(struct aggr_cpu_id a, 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 &&
- a.node == b.node &&
- a.socket == b.socket &&
- a.die == b.die &&
- a.core == b.core;
+ return a->thread == b->thread &&
+ a->node == b->node &&
+ a->socket == b->socket &&
+ a->die == b->die &&
+ a->core == b->core;
}
bool cpu_map__aggr_cpu_id_is_empty(struct aggr_cpu_id a)
}
static int first_shadow_cpu(struct perf_stat_config *config,
- struct evsel *evsel, struct aggr_cpu_id id)
+ struct evsel *evsel, const struct aggr_cpu_id *id)
{
struct perf_cpu_map *cpus;
int cpu, idx;
if (config->aggr_mode == AGGR_NONE)
- return id.core;
+ return id->core;
if (!config->aggr_get_id)
return 0;
cpus = evsel__cpus(evsel);
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
- if (cpu_map__compare_aggr_cpu_id(config->aggr_get_id(config, cpu), id))
+ struct aggr_cpu_id cpu_id = config->aggr_get_id(config, cpu);
+
+ if (aggr_cpu_id__equal(&cpu_id, id))
return cpu;
}
return 0;
}
perf_stat__print_shadow_stats(config, counter, uval,
- first_shadow_cpu(config, counter, id),
+ first_shadow_cpu(config, counter, &id),
&out, &config->metric_events, st);
if (!config->csv_output && !config->metric_only) {
print_noise(config, counter, noise);
val = 0;
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
s2 = config->aggr_get_id(config, cpu);
- if (!cpu_map__compare_aggr_cpu_id(s2, id))
+ if (!aggr_cpu_id__equal(&s2, &id))
continue;
val += perf_counts(counter->counts, idx, 0)->val;
}
perf_stat__update_shadow_stats(counter, val,
- first_shadow_cpu(config, counter, id),
+ first_shadow_cpu(config, counter, &id),
&rt_stat);
}
}
struct perf_counts_values *counts;
s2 = config->aggr_get_id(config, cpu);
- if (!cpu_map__compare_aggr_cpu_id(s2, ad->id))
+ if (!aggr_cpu_id__equal(&s2, &ad->id))
continue;
if (first)
ad->nr++;
s2 = config->aggr_get_id(config, cpu);
for (s = 0; s < config->aggr_map->nr; s++) {
id = config->aggr_map->map[s];
- if (cpu_map__compare_aggr_cpu_id(s2, id))
+ if (aggr_cpu_id__equal(&s2, &id))
break;
}