diff options
author | Andi Kleen <ak@linux.intel.com> | 2016-09-15 18:24:45 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-10-03 20:35:45 -0400 |
commit | 1c5f01fe8660fc48625a94a5ed10e4dbaea95d5f (patch) | |
tree | 8eb39e4fdca4c54be11a0f38edcb17de820f8a93 | |
parent | 61eb2eb434b3430c6ef70536eb3d16b616b5ee52 (diff) |
perf list: Add a --no-desc flag
Add a --no-desc flag to 'perf list' to not print the event descriptions
that were earlier added for JSON events. This may be useful to get a
less crowded listing.
It's still default to print descriptions as that is the more useful
default for most users.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1473978296-20712-9-git-send-email-sukadev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-list.txt | 8 | ||||
-rw-r--r-- | tools/perf/builtin-list.c | 14 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 4 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 2 | ||||
-rw-r--r-- | tools/perf/util/pmu.c | 4 | ||||
-rw-r--r-- | tools/perf/util/pmu.h | 2 |
6 files changed, 22 insertions, 12 deletions
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index a126e97a8114..72209bc0f523 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt | |||
@@ -8,13 +8,19 @@ perf-list - List all symbolic event types | |||
8 | SYNOPSIS | 8 | SYNOPSIS |
9 | -------- | 9 | -------- |
10 | [verse] | 10 | [verse] |
11 | 'perf list' [hw|sw|cache|tracepoint|pmu|event_glob] | 11 | 'perf list' [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob] |
12 | 12 | ||
13 | DESCRIPTION | 13 | DESCRIPTION |
14 | ----------- | 14 | ----------- |
15 | This command displays the symbolic event types which can be selected in the | 15 | This command displays the symbolic event types which can be selected in the |
16 | various perf commands with the -e option. | 16 | various perf commands with the -e option. |
17 | 17 | ||
18 | OPTIONS | ||
19 | ------- | ||
20 | --no-desc:: | ||
21 | Don't print descriptions. | ||
22 | |||
23 | |||
18 | [[EVENT_MODIFIERS]] | 24 | [[EVENT_MODIFIERS]] |
19 | EVENT MODIFIERS | 25 | EVENT MODIFIERS |
20 | --------------- | 26 | --------------- |
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 88ee419e5189..b14cb162f841 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c | |||
@@ -16,16 +16,20 @@ | |||
16 | #include "util/pmu.h" | 16 | #include "util/pmu.h" |
17 | #include <subcmd/parse-options.h> | 17 | #include <subcmd/parse-options.h> |
18 | 18 | ||
19 | static bool desc_flag = true; | ||
20 | |||
19 | int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | 21 | int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) |
20 | { | 22 | { |
21 | int i; | 23 | int i; |
22 | bool raw_dump = false; | 24 | bool raw_dump = false; |
23 | struct option list_options[] = { | 25 | struct option list_options[] = { |
24 | OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), | 26 | OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), |
27 | OPT_BOOLEAN('d', "desc", &desc_flag, | ||
28 | "Print extra event descriptions. --no-desc to not print."), | ||
25 | OPT_END() | 29 | OPT_END() |
26 | }; | 30 | }; |
27 | const char * const list_usage[] = { | 31 | const char * const list_usage[] = { |
28 | "perf list [hw|sw|cache|tracepoint|pmu|sdt|event_glob]", | 32 | "perf list [--no-desc] [hw|sw|cache|tracepoint|pmu|sdt|event_glob]", |
29 | NULL | 33 | NULL |
30 | }; | 34 | }; |
31 | 35 | ||
@@ -40,7 +44,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
40 | printf("\nList of pre-defined events (to be used in -e):\n\n"); | 44 | printf("\nList of pre-defined events (to be used in -e):\n\n"); |
41 | 45 | ||
42 | if (argc == 0) { | 46 | if (argc == 0) { |
43 | print_events(NULL, raw_dump); | 47 | print_events(NULL, raw_dump, !desc_flag); |
44 | return 0; | 48 | return 0; |
45 | } | 49 | } |
46 | 50 | ||
@@ -61,14 +65,14 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
61 | strcmp(argv[i], "hwcache") == 0) | 65 | strcmp(argv[i], "hwcache") == 0) |
62 | print_hwcache_events(NULL, raw_dump); | 66 | print_hwcache_events(NULL, raw_dump); |
63 | else if (strcmp(argv[i], "pmu") == 0) | 67 | else if (strcmp(argv[i], "pmu") == 0) |
64 | print_pmu_events(NULL, raw_dump); | 68 | print_pmu_events(NULL, raw_dump, !desc_flag); |
65 | else if (strcmp(argv[i], "sdt") == 0) | 69 | else if (strcmp(argv[i], "sdt") == 0) |
66 | print_sdt_events(NULL, NULL, raw_dump); | 70 | print_sdt_events(NULL, NULL, raw_dump); |
67 | else if ((sep = strchr(argv[i], ':')) != NULL) { | 71 | else if ((sep = strchr(argv[i], ':')) != NULL) { |
68 | int sep_idx; | 72 | int sep_idx; |
69 | 73 | ||
70 | if (sep == NULL) { | 74 | if (sep == NULL) { |
71 | print_events(argv[i], raw_dump); | 75 | print_events(argv[i], raw_dump, !desc_flag); |
72 | continue; | 76 | continue; |
73 | } | 77 | } |
74 | sep_idx = sep - argv[i]; | 78 | sep_idx = sep - argv[i]; |
@@ -90,7 +94,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
90 | print_symbol_events(s, PERF_TYPE_SOFTWARE, | 94 | print_symbol_events(s, PERF_TYPE_SOFTWARE, |
91 | event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); | 95 | event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); |
92 | print_hwcache_events(s, raw_dump); | 96 | print_hwcache_events(s, raw_dump); |
93 | print_pmu_events(s, raw_dump); | 97 | print_pmu_events(s, raw_dump, !desc_flag); |
94 | print_tracepoint_events(NULL, s, raw_dump); | 98 | print_tracepoint_events(NULL, s, raw_dump); |
95 | print_sdt_events(NULL, s, raw_dump); | 99 | print_sdt_events(NULL, s, raw_dump); |
96 | free(s); | 100 | free(s); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 33546c3ac1fe..3966ad79ee8d 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -2263,7 +2263,7 @@ out_enomem: | |||
2263 | /* | 2263 | /* |
2264 | * Print the help text for the event symbols: | 2264 | * Print the help text for the event symbols: |
2265 | */ | 2265 | */ |
2266 | void print_events(const char *event_glob, bool name_only) | 2266 | void print_events(const char *event_glob, bool name_only, bool quiet_flag) |
2267 | { | 2267 | { |
2268 | print_symbol_events(event_glob, PERF_TYPE_HARDWARE, | 2268 | print_symbol_events(event_glob, PERF_TYPE_HARDWARE, |
2269 | event_symbols_hw, PERF_COUNT_HW_MAX, name_only); | 2269 | event_symbols_hw, PERF_COUNT_HW_MAX, name_only); |
@@ -2273,7 +2273,7 @@ void print_events(const char *event_glob, bool name_only) | |||
2273 | 2273 | ||
2274 | print_hwcache_events(event_glob, name_only); | 2274 | print_hwcache_events(event_glob, name_only); |
2275 | 2275 | ||
2276 | print_pmu_events(event_glob, name_only); | 2276 | print_pmu_events(event_glob, name_only, quiet_flag); |
2277 | 2277 | ||
2278 | if (event_glob != NULL) | 2278 | if (event_glob != NULL) |
2279 | return; | 2279 | return; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 8d09a976fca8..3bf376b42bf9 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -172,7 +172,7 @@ void parse_events_update_lists(struct list_head *list_event, | |||
172 | void parse_events_evlist_error(struct parse_events_evlist *data, | 172 | void parse_events_evlist_error(struct parse_events_evlist *data, |
173 | int idx, const char *str); | 173 | int idx, const char *str); |
174 | 174 | ||
175 | void print_events(const char *event_glob, bool name_only); | 175 | void print_events(const char *event_glob, bool name_only, bool quiet); |
176 | 176 | ||
177 | struct event_symbol { | 177 | struct event_symbol { |
178 | const char *symbol; | 178 | const char *symbol; |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7b46e772f5f9..9dc3506d23fc 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -1084,7 +1084,7 @@ static void wordwrap(char *s, int start, int max, int corr) | |||
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | void print_pmu_events(const char *event_glob, bool name_only) | 1087 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) |
1088 | { | 1088 | { |
1089 | struct perf_pmu *pmu; | 1089 | struct perf_pmu *pmu; |
1090 | struct perf_pmu_alias *alias; | 1090 | struct perf_pmu_alias *alias; |
@@ -1151,7 +1151,7 @@ void print_pmu_events(const char *event_glob, bool name_only) | |||
1151 | printf("%s ", aliases[j].name); | 1151 | printf("%s ", aliases[j].name); |
1152 | continue; | 1152 | continue; |
1153 | } | 1153 | } |
1154 | if (aliases[j].desc) { | 1154 | if (aliases[j].desc && !quiet_flag) { |
1155 | if (numdesc++ == 0) | 1155 | if (numdesc++ == 0) |
1156 | printf("\n"); | 1156 | printf("\n"); |
1157 | printf(" %-50s\n", aliases[j].name); | 1157 | printf(" %-50s\n", aliases[j].name); |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 51d8d0d35e63..7b47192e03b5 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
@@ -72,7 +72,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head); | |||
72 | 72 | ||
73 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); | 73 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); |
74 | 74 | ||
75 | void print_pmu_events(const char *event_glob, bool name_only); | 75 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet); |
76 | bool pmu_have_event(const char *pname, const char *name); | 76 | bool pmu_have_event(const char *pname, const char *name); |
77 | 77 | ||
78 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, | 78 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, |