diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 4ee40de698a47f..b81ae5053218ae 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1472,7 +1472,10 @@ static int perf_stat_init_aggr_mode(void) * taking the highest cpu number to be the size of * the aggregation translate cpumap. */ - nr = perf_cpu_map__max(evsel_list->core.cpus).cpu; + if (evsel_list->core.cpus) + nr = perf_cpu_map__max(evsel_list->core.cpus).cpu; + else + nr = 0; stat_config.cpus_aggr_map = cpu_aggr_map__empty_new(nr + 1); return stat_config.cpus_aggr_map ? 0 : -ENOMEM; }