aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a3c060878faa..24b8e690fb69 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -847,6 +847,18 @@ static int perf_stat__get_core_cached(struct perf_stat_config *config,
847 return perf_stat__get_aggr(config, perf_stat__get_core, map, idx); 847 return perf_stat__get_aggr(config, perf_stat__get_core, map, idx);
848} 848}
849 849
850static bool term_percore_set(void)
851{
852 struct perf_evsel *counter;
853
854 evlist__for_each_entry(evsel_list, counter) {
855 if (counter->percore)
856 return true;
857 }
858
859 return false;
860}
861
850static int perf_stat_init_aggr_mode(void) 862static int perf_stat_init_aggr_mode(void)
851{ 863{
852 int nr; 864 int nr;
@@ -867,6 +879,15 @@ static int perf_stat_init_aggr_mode(void)
867 stat_config.aggr_get_id = perf_stat__get_core_cached; 879 stat_config.aggr_get_id = perf_stat__get_core_cached;
868 break; 880 break;
869 case AGGR_NONE: 881 case AGGR_NONE:
882 if (term_percore_set()) {
883 if (cpu_map__build_core_map(evsel_list->cpus,
884 &stat_config.aggr_map)) {
885 perror("cannot build core map");
886 return -1;
887 }
888 stat_config.aggr_get_id = perf_stat__get_core_cached;
889 }
890 break;
870 case AGGR_GLOBAL: 891 case AGGR_GLOBAL:
871 case AGGR_THREAD: 892 case AGGR_THREAD:
872 case AGGR_UNSET: 893 case AGGR_UNSET: