perf list: Move extra details printing to new option
authorAndi Kleen <ak@linux.intel.com>
Mon, 20 Mar 2017 20:17:11 +0000 (13:17 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 23 Mar 2017 14:42:31 +0000 (11:42 -0300)
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: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/20170320201711.14142-14-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/perf-list.txt
tools/perf/builtin-list.c
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h
tools/perf/util/pmu.c
tools/perf/util/pmu.h

index 41857cce5e86f4404929051d4daf0414386452d9..143d98df2df96deb5bb32ea091bb5f963dd241dc 100644 (file)
@@ -24,6 +24,10 @@ Don't print descriptions.
 --long-desc::
 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
index 3b9d98b5feef69182a0036b3c2f57d29a3364fc9..be9195e95c78b9972301138f73aa810c02f995ea 100644 (file)
@@ -18,6 +18,7 @@
 #include <subcmd/parse-options.h>
 
 static bool desc_flag = true;
+static bool details_flag;
 
 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."),
                OPT_BOOLEAN('v', "long-desc", &long_desc_flag,
                            "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,
                             "Enable debugging output"),
                OPT_END()
@@ -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");
 
        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;
        }
 
@@ -72,7 +76,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
                        print_hwcache_events(NULL, raw_dump);
                else if (strcmp(argv[i], "pmu") == 0)
                        print_pmu_events(NULL, raw_dump, !desc_flag,
-                                               long_desc_flag);
+                                               long_desc_flag, details_flag);
                else if (strcmp(argv[i], "sdt") == 0)
                        print_sdt_events(NULL, NULL, raw_dump);
                else if ((sep = strchr(argv[i], ':')) != NULL) {
@@ -80,7 +84,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 
                        if (sep == NULL) {
                                print_events(argv[i], raw_dump, !desc_flag,
-                                                       long_desc_flag);
+                                                       long_desc_flag,
+                                                       details_flag);
                                continue;
                        }
                        sep_idx = sep - argv[i];
@@ -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);
                        print_hwcache_events(s, raw_dump);
                        print_pmu_events(s, raw_dump, !desc_flag,
-                                               long_desc_flag);
+                                               long_desc_flag,
+                                               details_flag);
                        print_tracepoint_events(NULL, s, raw_dump);
                        print_sdt_events(NULL, s, raw_dump);
                        free(s);
index 119eb0b6587689a650de62f010b1ff8ca8462746..6b498aea9fdea012e70bbaa0fafb7f256a5c48d0 100644 (file)
@@ -2325,7 +2325,7 @@ out_enomem:
  * Print the help text for the event symbols:
  */
 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,
                            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,
 
        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)
                return;
index f38086b8dbeaf2f4c5c51ca78d987ddeb63c326f..a235f4d6d5e514f60055db58ce5ebb0b8e723d0b 100644 (file)
@@ -184,7 +184,7 @@ void parse_events_evlist_error(struct parse_events_evlist *data,
                               int idx, const char *str);
 
 void print_events(const char *event_glob, bool name_only, bool quiet,
-                 bool long_desc);
+                 bool long_desc, bool details_flag);
 
 struct event_symbol {
        const char      *symbol;
index bcf752fa345b8971096687db4b1c4285317a8e5d..362051ea7f3deb44f4671ed8488ef99c45dcd5be 100644 (file)
@@ -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,
-                       bool long_desc)
+                       bool long_desc, bool details_flag)
 {
        struct perf_pmu *pmu;
        struct perf_pmu_alias *alias;
@@ -1246,7 +1246,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
                        printf("%*s", 8, "[");
                        wordwrap(aliases[j].desc, 8, columns, 0);
                        printf("]\n");
-                       if (verbose > 0) {
+                       if (details_flag) {
                                printf("%*s%s/%s/ ", 8, "", aliases[j].pmu, aliases[j].str);
                                if (aliases[j].metric_name)
                                        printf(" MetricName: %s", aliases[j].metric_name);
index 3d4b703f5d89c21b4c20eb4eb22f3b019e971f73..ea7f450dc60928ab46e2288cf3acbdd35b31af38 100644 (file)
@@ -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);
 
 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);
 
 int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,