Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf stat: Add new field in stat_config to enable hardware aware grouping

Hardware counter and event information could be used to help creating event
groups that better utilize hardware counters and improve multiplexing.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Weilin Wang <weilin.wang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Caleb Biggers <caleb.biggers@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Perry Taylor <perry.taylor@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Samantha Alt <samantha.alt@intel.com>
Link: https://lore.kernel.org/r/20240412210756.309828-2-weilin.wang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Weilin Wang and committed by
Arnaldo Carvalho de Melo
03f23570 10b6ee3b

+10
+5
tools/perf/builtin-stat.c
··· 2085 2085 stat_config.metric_no_threshold, 2086 2086 stat_config.user_requested_cpu_list, 2087 2087 stat_config.system_wide, 2088 + stat_config.hardware_aware_grouping, 2088 2089 &stat_config.metric_events); 2089 2090 } 2090 2091 ··· 2119 2118 stat_config.metric_no_threshold, 2120 2119 stat_config.user_requested_cpu_list, 2121 2120 stat_config.system_wide, 2121 + stat_config.hardware_aware_grouping, 2122 2122 &stat_config.metric_events); 2123 2123 } 2124 2124 ··· 2154 2152 /*metric_no_threshold=*/true, 2155 2153 stat_config.user_requested_cpu_list, 2156 2154 stat_config.system_wide, 2155 + stat_config.hardware_aware_grouping, 2157 2156 &stat_config.metric_events) < 0) 2158 2157 return -1; 2159 2158 } ··· 2196 2193 /*metric_no_threshold=*/true, 2197 2194 stat_config.user_requested_cpu_list, 2198 2195 stat_config.system_wide, 2196 + stat_config.hardware_aware_grouping, 2199 2197 &stat_config.metric_events) < 0) 2200 2198 return -1; 2201 2199 ··· 2731 2727 stat_config.metric_no_threshold, 2732 2728 stat_config.user_requested_cpu_list, 2733 2729 stat_config.system_wide, 2730 + stat_config.hardware_aware_grouping, 2734 2731 &stat_config.metric_events); 2735 2732 2736 2733 zfree(&metrics);
+3
tools/perf/util/metricgroup.c
··· 1690 1690 bool metric_no_threshold, 1691 1691 const char *user_requested_cpu_list, 1692 1692 bool system_wide, 1693 + bool hardware_aware_grouping, 1693 1694 struct rblist *metric_events) 1694 1695 { 1695 1696 const struct pmu_metrics_table *table = pmu_metrics_table__find(); 1696 1697 1697 1698 if (!table) 1698 1699 return -EINVAL; 1700 + if (hardware_aware_grouping) 1701 + pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n"); 1699 1702 1700 1703 return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge, 1701 1704 metric_no_threshold, user_requested_cpu_list, system_wide,
+1
tools/perf/util/metricgroup.h
··· 77 77 bool metric_no_threshold, 78 78 const char *user_requested_cpu_list, 79 79 bool system_wide, 80 + bool hardware_aware_grouping, 80 81 struct rblist *metric_events); 81 82 int metricgroup__parse_groups_test(struct evlist *evlist, 82 83 const struct pmu_metrics_table *table,
+1
tools/perf/util/stat.h
··· 87 87 bool metric_no_group; 88 88 bool metric_no_merge; 89 89 bool metric_no_threshold; 90 + bool hardware_aware_grouping; 90 91 bool stop_read_counter; 91 92 bool iostat_run; 92 93 char *user_requested_cpu_list;