Commit 7f372a63 authored by Andi Kleen's avatar Andi Kleen Committed by Arnaldo Carvalho de Melo

perf list: Support printing MetricExpr with --debug

Output the metric expr in perf list when --debug is specified, so that
the user can check the formula.

Before:

  % perf list
    ...
    unc_m_power_channel_ppd
         [Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd. Unit:
          uncore_imc]
          uncore_imc_2/event=0x85/

After:

  % perf list --debug
    ...
    unc_m_power_channel_ppd
         [Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd. Unit:
          uncore_imc]
          Perf: uncore_imc_2/event=0x85/ MetricExpr: (unc_m_power_channel_ppd / unc_m_clockticks) * 100.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170320201711.14142-12-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 37932c18
...@@ -1105,6 +1105,7 @@ struct sevent { ...@@ -1105,6 +1105,7 @@ struct sevent {
char *topic; char *topic;
char *str; char *str;
char *pmu; char *pmu;
char *metric_expr;
}; };
static int cmp_sevent(const void *a, const void *b) static int cmp_sevent(const void *a, const void *b)
...@@ -1203,6 +1204,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, ...@@ -1203,6 +1204,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
aliases[j].topic = alias->topic; aliases[j].topic = alias->topic;
aliases[j].str = alias->str; aliases[j].str = alias->str;
aliases[j].pmu = pmu->name; aliases[j].pmu = pmu->name;
aliases[j].metric_expr = alias->metric_expr;
j++; j++;
} }
if (pmu->selectable && if (pmu->selectable &&
...@@ -1237,8 +1239,12 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, ...@@ -1237,8 +1239,12 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
printf("%*s", 8, "["); printf("%*s", 8, "[");
wordwrap(aliases[j].desc, 8, columns, 0); wordwrap(aliases[j].desc, 8, columns, 0);
printf("]\n"); printf("]\n");
if (verbose > 0) if (verbose > 0) {
printf("%*s%s/%s/\n", 8, "", aliases[j].pmu, aliases[j].str); printf("%*s%s/%s/ ", 8, "", aliases[j].pmu, aliases[j].str);
if (aliases[j].metric_expr)
printf(" MetricExpr: %s", aliases[j].metric_expr);
putchar('\n');
}
} else } else
printf(" %-50s [Kernel PMU event]\n", aliases[j].name); printf(" %-50s [Kernel PMU event]\n", aliases[j].name);
printed++; printed++;
......
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