Commit 03f23570 authored by Weilin Wang's avatar Weilin Wang Committed by Arnaldo Carvalho de Melo

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: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarWeilin 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 10b6ee3b
...@@ -2085,6 +2085,7 @@ static int add_default_attributes(void) ...@@ -2085,6 +2085,7 @@ static int add_default_attributes(void)
stat_config.metric_no_threshold, stat_config.metric_no_threshold,
stat_config.user_requested_cpu_list, stat_config.user_requested_cpu_list,
stat_config.system_wide, stat_config.system_wide,
stat_config.hardware_aware_grouping,
&stat_config.metric_events); &stat_config.metric_events);
} }
...@@ -2118,6 +2119,7 @@ static int add_default_attributes(void) ...@@ -2118,6 +2119,7 @@ static int add_default_attributes(void)
stat_config.metric_no_threshold, stat_config.metric_no_threshold,
stat_config.user_requested_cpu_list, stat_config.user_requested_cpu_list,
stat_config.system_wide, stat_config.system_wide,
stat_config.hardware_aware_grouping,
&stat_config.metric_events); &stat_config.metric_events);
} }
...@@ -2152,6 +2154,7 @@ static int add_default_attributes(void) ...@@ -2152,6 +2154,7 @@ static int add_default_attributes(void)
/*metric_no_threshold=*/true, /*metric_no_threshold=*/true,
stat_config.user_requested_cpu_list, stat_config.user_requested_cpu_list,
stat_config.system_wide, stat_config.system_wide,
stat_config.hardware_aware_grouping,
&stat_config.metric_events) < 0) &stat_config.metric_events) < 0)
return -1; return -1;
} }
...@@ -2193,6 +2196,7 @@ static int add_default_attributes(void) ...@@ -2193,6 +2196,7 @@ static int add_default_attributes(void)
/*metric_no_threshold=*/true, /*metric_no_threshold=*/true,
stat_config.user_requested_cpu_list, stat_config.user_requested_cpu_list,
stat_config.system_wide, stat_config.system_wide,
stat_config.hardware_aware_grouping,
&stat_config.metric_events) < 0) &stat_config.metric_events) < 0)
return -1; return -1;
...@@ -2727,6 +2731,7 @@ int cmd_stat(int argc, const char **argv) ...@@ -2727,6 +2731,7 @@ int cmd_stat(int argc, const char **argv)
stat_config.metric_no_threshold, stat_config.metric_no_threshold,
stat_config.user_requested_cpu_list, stat_config.user_requested_cpu_list,
stat_config.system_wide, stat_config.system_wide,
stat_config.hardware_aware_grouping,
&stat_config.metric_events); &stat_config.metric_events);
zfree(&metrics); zfree(&metrics);
......
...@@ -1690,12 +1690,15 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, ...@@ -1690,12 +1690,15 @@ int metricgroup__parse_groups(struct evlist *perf_evlist,
bool metric_no_threshold, bool metric_no_threshold,
const char *user_requested_cpu_list, const char *user_requested_cpu_list,
bool system_wide, bool system_wide,
bool hardware_aware_grouping,
struct rblist *metric_events) struct rblist *metric_events)
{ {
const struct pmu_metrics_table *table = pmu_metrics_table__find(); const struct pmu_metrics_table *table = pmu_metrics_table__find();
if (!table) if (!table)
return -EINVAL; return -EINVAL;
if (hardware_aware_grouping)
pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n");
return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge, return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge,
metric_no_threshold, user_requested_cpu_list, system_wide, metric_no_threshold, user_requested_cpu_list, system_wide,
......
...@@ -77,6 +77,7 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, ...@@ -77,6 +77,7 @@ int metricgroup__parse_groups(struct evlist *perf_evlist,
bool metric_no_threshold, bool metric_no_threshold,
const char *user_requested_cpu_list, const char *user_requested_cpu_list,
bool system_wide, bool system_wide,
bool hardware_aware_grouping,
struct rblist *metric_events); struct rblist *metric_events);
int metricgroup__parse_groups_test(struct evlist *evlist, int metricgroup__parse_groups_test(struct evlist *evlist,
const struct pmu_metrics_table *table, const struct pmu_metrics_table *table,
......
...@@ -87,6 +87,7 @@ struct perf_stat_config { ...@@ -87,6 +87,7 @@ struct perf_stat_config {
bool metric_no_group; bool metric_no_group;
bool metric_no_merge; bool metric_no_merge;
bool metric_no_threshold; bool metric_no_threshold;
bool hardware_aware_grouping;
bool stop_read_counter; bool stop_read_counter;
bool iostat_run; bool iostat_run;
char *user_requested_cpu_list; char *user_requested_cpu_list;
......
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