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

perf list: Move extra details printing to new option

Move the printing of perf expressions and internal events to a new
clearer --details flag, instead of lumping it together with other debug
options in --debug. This makes it clearer to use.

Before

  perf list --debug
  ...
  unc_m_power_critical_throttle_cycles
         [Cycles all ranks are in critical thermal throttle. Unit: uncore_imc]
          uncore_imc_2/event=0x86/  MetricName: power_critical_throttle_cycles % MetricExpr: (unc_m_power_critical_throttle_cycles / unc_m_clockticks) * 100.

after

  perf list --details
  ...
  unc_m_power_critical_throttle_cycles
         [Cycles all ranks are in critical thermal throttle. Unit: uncore_imc]
          uncore_imc_2/event=0x86/  MetricName: power_critical_throttle_cycles % MetricExpr: (unc_m_power_critical_throttle_cycles / unc_m_clockticks) * 100.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/20170320201711.14142-14-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 96284814
...@@ -24,6 +24,10 @@ Don't print descriptions. ...@@ -24,6 +24,10 @@ Don't print descriptions.
--long-desc:: --long-desc::
Print longer event descriptions. Print longer event descriptions.
--details::
Print how named events are resolved internally into perf events, and also
any extra expressions computed by perf stat.
[[EVENT_MODIFIERS]] [[EVENT_MODIFIERS]]
EVENT MODIFIERS EVENT MODIFIERS
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
static bool desc_flag = true; static bool desc_flag = true;
static bool details_flag;
int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
{ {
...@@ -30,6 +31,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -30,6 +31,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
"Print extra event descriptions. --no-desc to not print."), "Print extra event descriptions. --no-desc to not print."),
OPT_BOOLEAN('v', "long-desc", &long_desc_flag, OPT_BOOLEAN('v', "long-desc", &long_desc_flag,
"Print longer event descriptions."), "Print longer event descriptions."),
OPT_BOOLEAN(0, "details", &details_flag,
"Print information on the perf event names and expressions used internally by events."),
OPT_INCR(0, "debug", &verbose, OPT_INCR(0, "debug", &verbose,
"Enable debugging output"), "Enable debugging output"),
OPT_END() OPT_END()
...@@ -50,7 +53,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -50,7 +53,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
printf("\nList of pre-defined events (to be used in -e):\n\n"); printf("\nList of pre-defined events (to be used in -e):\n\n");
if (argc == 0) { if (argc == 0) {
print_events(NULL, raw_dump, !desc_flag, long_desc_flag); print_events(NULL, raw_dump, !desc_flag, long_desc_flag,
details_flag);
return 0; return 0;
} }
...@@ -72,7 +76,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -72,7 +76,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
print_hwcache_events(NULL, raw_dump); print_hwcache_events(NULL, raw_dump);
else if (strcmp(argv[i], "pmu") == 0) else if (strcmp(argv[i], "pmu") == 0)
print_pmu_events(NULL, raw_dump, !desc_flag, print_pmu_events(NULL, raw_dump, !desc_flag,
long_desc_flag); long_desc_flag, details_flag);
else if (strcmp(argv[i], "sdt") == 0) else if (strcmp(argv[i], "sdt") == 0)
print_sdt_events(NULL, NULL, raw_dump); print_sdt_events(NULL, NULL, raw_dump);
else if ((sep = strchr(argv[i], ':')) != NULL) { else if ((sep = strchr(argv[i], ':')) != NULL) {
...@@ -80,7 +84,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -80,7 +84,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
if (sep == NULL) { if (sep == NULL) {
print_events(argv[i], raw_dump, !desc_flag, print_events(argv[i], raw_dump, !desc_flag,
long_desc_flag); long_desc_flag,
details_flag);
continue; continue;
} }
sep_idx = sep - argv[i]; sep_idx = sep - argv[i];
...@@ -103,7 +108,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -103,7 +108,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump);
print_hwcache_events(s, raw_dump); print_hwcache_events(s, raw_dump);
print_pmu_events(s, raw_dump, !desc_flag, print_pmu_events(s, raw_dump, !desc_flag,
long_desc_flag); long_desc_flag,
details_flag);
print_tracepoint_events(NULL, s, raw_dump); print_tracepoint_events(NULL, s, raw_dump);
print_sdt_events(NULL, s, raw_dump); print_sdt_events(NULL, s, raw_dump);
free(s); free(s);
......
...@@ -2325,7 +2325,7 @@ void print_symbol_events(const char *event_glob, unsigned type, ...@@ -2325,7 +2325,7 @@ void print_symbol_events(const char *event_glob, unsigned type,
* Print the help text for the event symbols: * Print the help text for the event symbols:
*/ */
void print_events(const char *event_glob, bool name_only, bool quiet_flag, void print_events(const char *event_glob, bool name_only, bool quiet_flag,
bool long_desc) bool long_desc, bool details_flag)
{ {
print_symbol_events(event_glob, PERF_TYPE_HARDWARE, print_symbol_events(event_glob, PERF_TYPE_HARDWARE,
event_symbols_hw, PERF_COUNT_HW_MAX, name_only); event_symbols_hw, PERF_COUNT_HW_MAX, name_only);
...@@ -2335,7 +2335,8 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag, ...@@ -2335,7 +2335,8 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag,
print_hwcache_events(event_glob, name_only); print_hwcache_events(event_glob, name_only);
print_pmu_events(event_glob, name_only, quiet_flag, long_desc); print_pmu_events(event_glob, name_only, quiet_flag, long_desc,
details_flag);
if (event_glob != NULL) if (event_glob != NULL)
return; return;
......
...@@ -184,7 +184,7 @@ void parse_events_evlist_error(struct parse_events_evlist *data, ...@@ -184,7 +184,7 @@ void parse_events_evlist_error(struct parse_events_evlist *data,
int idx, const char *str); int idx, const char *str);
void print_events(const char *event_glob, bool name_only, bool quiet, void print_events(const char *event_glob, bool name_only, bool quiet,
bool long_desc); bool long_desc, bool details_flag);
struct event_symbol { struct event_symbol {
const char *symbol; const char *symbol;
......
...@@ -1154,7 +1154,7 @@ static void wordwrap(char *s, int start, int max, int corr) ...@@ -1154,7 +1154,7 @@ static void wordwrap(char *s, int start, int max, int corr)
} }
void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
bool long_desc) bool long_desc, bool details_flag)
{ {
struct perf_pmu *pmu; struct perf_pmu *pmu;
struct perf_pmu_alias *alias; struct perf_pmu_alias *alias;
...@@ -1246,7 +1246,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, ...@@ -1246,7 +1246,7 @@ 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 (details_flag) {
printf("%*s%s/%s/ ", 8, "", aliases[j].pmu, aliases[j].str); printf("%*s%s/%s/ ", 8, "", aliases[j].pmu, aliases[j].str);
if (aliases[j].metric_name) if (aliases[j].metric_name)
printf(" MetricName: %s", aliases[j].metric_name); printf(" MetricName: %s", aliases[j].metric_name);
......
...@@ -80,7 +80,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head); ...@@ -80,7 +80,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);
struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
void print_pmu_events(const char *event_glob, bool name_only, bool quiet, void print_pmu_events(const char *event_glob, bool name_only, bool quiet,
bool long_desc); bool long_desc, bool details_flag);
bool pmu_have_event(const char *pname, const char *name); bool pmu_have_event(const char *pname, const char *name);
int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
......
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