perf stat: Support new per thread TopDown metrics

Icelake has support for reporting per thread TopDown metrics.

These are reported differently than the previous TopDown support,
each metric is standalone, but scaled to pipeline "slots".

We don't need to do anything special for HyperThreading anymore.
Teach perf stat --topdown to handle these new metrics and
print them in the same way as the previous TopDown metrics.

The restrictions of only being able to report information per core is
gone.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Co-developed-by: Kan Liang <kan.liang@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200911144808.27603-4-kan.liang@linux.intel.com
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Andi Kleen
2020-09-11 07:48:07 -07:00
committed by Arnaldo Carvalho de Melo
parent acb65150a4
commit 55c36a9fc2
5 changed files with 134 additions and 4 deletions

View File

@@ -128,6 +128,15 @@ static const char * topdown_attrs[] = {
NULL,
};
static const char *topdown_metric_attrs[] = {
"slots",
"topdown-retiring",
"topdown-bad-spec",
"topdown-fe-bound",
"topdown-be-bound",
NULL,
};
static const char *smi_cost_attrs = {
"{"
"msr/aperf/,"
@@ -1677,6 +1686,24 @@ static int add_default_attributes(void)
char *str = NULL;
bool warn = false;
if (!force_metric_only)
stat_config.metric_only = true;
if (topdown_filter_events(topdown_metric_attrs, &str, 1) < 0) {
pr_err("Out of memory\n");
return -1;
}
if (topdown_metric_attrs[0] && str) {
if (!stat_config.interval && !stat_config.metric_only) {
fprintf(stat_config.output,
"Topdown accuracy may decrease when measuring long periods.\n"
"Please print the result regularly, e.g. -I1000\n");
}
goto setup_metrics;
}
zfree(&str);
if (stat_config.aggr_mode != AGGR_GLOBAL &&
stat_config.aggr_mode != AGGR_CORE) {
pr_err("top down event configuration requires --per-core mode\n");
@@ -1688,8 +1715,6 @@ static int add_default_attributes(void)
return -1;
}
if (!force_metric_only)
stat_config.metric_only = true;
if (topdown_filter_events(topdown_attrs, &str,
arch_topdown_check_group(&warn)) < 0) {
pr_err("Out of memory\n");
@@ -1698,6 +1723,7 @@ static int add_default_attributes(void)
if (topdown_attrs[0] && str) {
if (warn)
arch_topdown_group_warn();
setup_metrics:
err = parse_events(evsel_list, str, &errinfo);
if (err) {
fprintf(stderr,