diff options
-rw-r--r-- | tools/perf/Documentation/perf-list.txt | 6 | ||||
-rw-r--r-- | tools/perf/builtin-list.c | 16 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 5 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 3 | ||||
-rw-r--r-- | tools/perf/util/pmu.c | 15 | ||||
-rw-r--r-- | tools/perf/util/pmu.h | 4 |
6 files changed, 34 insertions, 15 deletions
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 72209bc0f523..41857cce5e86 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt | |||
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types | |||
8 | SYNOPSIS | 8 | SYNOPSIS |
9 | -------- | 9 | -------- |
10 | [verse] | 10 | [verse] |
11 | 'perf list' [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob] | 11 | 'perf list' [--no-desc] [--long-desc] [hw|sw|cache|tracepoint|pmu|event_glob] |
12 | 12 | ||
13 | DESCRIPTION | 13 | DESCRIPTION |
14 | ----------- | 14 | ----------- |
@@ -20,6 +20,10 @@ OPTIONS | |||
20 | --no-desc:: | 20 | --no-desc:: |
21 | Don't print descriptions. | 21 | Don't print descriptions. |
22 | 22 | ||
23 | -v:: | ||
24 | --long-desc:: | ||
25 | Print longer event descriptions. | ||
26 | |||
23 | 27 | ||
24 | [[EVENT_MODIFIERS]] | 28 | [[EVENT_MODIFIERS]] |
25 | EVENT MODIFIERS | 29 | EVENT MODIFIERS |
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index b14cb162f841..ba9322ff858b 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c | |||
@@ -22,14 +22,17 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
22 | { | 22 | { |
23 | int i; | 23 | int i; |
24 | bool raw_dump = false; | 24 | bool raw_dump = false; |
25 | bool long_desc_flag = false; | ||
25 | struct option list_options[] = { | 26 | struct option list_options[] = { |
26 | OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), | 27 | OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), |
27 | OPT_BOOLEAN('d', "desc", &desc_flag, | 28 | OPT_BOOLEAN('d', "desc", &desc_flag, |
28 | "Print extra event descriptions. --no-desc to not print."), | 29 | "Print extra event descriptions. --no-desc to not print."), |
30 | OPT_BOOLEAN('v', "long-desc", &long_desc_flag, | ||
31 | "Print longer event descriptions."), | ||
29 | OPT_END() | 32 | OPT_END() |
30 | }; | 33 | }; |
31 | const char * const list_usage[] = { | 34 | const char * const list_usage[] = { |
32 | "perf list [--no-desc] [hw|sw|cache|tracepoint|pmu|sdt|event_glob]", | 35 | "perf list [<options>] [hw|sw|cache|tracepoint|pmu|sdt|event_glob]", |
33 | NULL | 36 | NULL |
34 | }; | 37 | }; |
35 | 38 | ||
@@ -44,7 +47,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
44 | printf("\nList of pre-defined events (to be used in -e):\n\n"); | 47 | printf("\nList of pre-defined events (to be used in -e):\n\n"); |
45 | 48 | ||
46 | if (argc == 0) { | 49 | if (argc == 0) { |
47 | print_events(NULL, raw_dump, !desc_flag); | 50 | print_events(NULL, raw_dump, !desc_flag, long_desc_flag); |
48 | return 0; | 51 | return 0; |
49 | } | 52 | } |
50 | 53 | ||
@@ -65,14 +68,16 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
65 | strcmp(argv[i], "hwcache") == 0) | 68 | strcmp(argv[i], "hwcache") == 0) |
66 | print_hwcache_events(NULL, raw_dump); | 69 | print_hwcache_events(NULL, raw_dump); |
67 | else if (strcmp(argv[i], "pmu") == 0) | 70 | else if (strcmp(argv[i], "pmu") == 0) |
68 | print_pmu_events(NULL, raw_dump, !desc_flag); | 71 | print_pmu_events(NULL, raw_dump, !desc_flag, |
72 | long_desc_flag); | ||
69 | else if (strcmp(argv[i], "sdt") == 0) | 73 | else if (strcmp(argv[i], "sdt") == 0) |
70 | print_sdt_events(NULL, NULL, raw_dump); | 74 | print_sdt_events(NULL, NULL, raw_dump); |
71 | else if ((sep = strchr(argv[i], ':')) != NULL) { | 75 | else if ((sep = strchr(argv[i], ':')) != NULL) { |
72 | int sep_idx; | 76 | int sep_idx; |
73 | 77 | ||
74 | if (sep == NULL) { | 78 | if (sep == NULL) { |
75 | print_events(argv[i], raw_dump, !desc_flag); | 79 | print_events(argv[i], raw_dump, !desc_flag, |
80 | long_desc_flag); | ||
76 | continue; | 81 | continue; |
77 | } | 82 | } |
78 | sep_idx = sep - argv[i]; | 83 | sep_idx = sep - argv[i]; |
@@ -94,7 +99,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) | |||
94 | print_symbol_events(s, PERF_TYPE_SOFTWARE, | 99 | print_symbol_events(s, PERF_TYPE_SOFTWARE, |
95 | event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); | 100 | event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); |
96 | print_hwcache_events(s, raw_dump); | 101 | print_hwcache_events(s, raw_dump); |
97 | print_pmu_events(s, raw_dump, !desc_flag); | 102 | print_pmu_events(s, raw_dump, !desc_flag, |
103 | long_desc_flag); | ||
98 | print_tracepoint_events(NULL, s, raw_dump); | 104 | print_tracepoint_events(NULL, s, raw_dump); |
99 | print_sdt_events(NULL, s, raw_dump); | 105 | print_sdt_events(NULL, s, raw_dump); |
100 | free(s); | 106 | free(s); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 3966ad79ee8d..8f88f63bf96c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -2263,7 +2263,8 @@ 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, bool quiet_flag) | 2266 | void print_events(const char *event_glob, bool name_only, bool quiet_flag, |
2267 | bool long_desc) | ||
2267 | { | 2268 | { |
2268 | print_symbol_events(event_glob, PERF_TYPE_HARDWARE, | 2269 | print_symbol_events(event_glob, PERF_TYPE_HARDWARE, |
2269 | event_symbols_hw, PERF_COUNT_HW_MAX, name_only); | 2270 | event_symbols_hw, PERF_COUNT_HW_MAX, name_only); |
@@ -2273,7 +2274,7 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag) | |||
2273 | 2274 | ||
2274 | print_hwcache_events(event_glob, name_only); | 2275 | print_hwcache_events(event_glob, name_only); |
2275 | 2276 | ||
2276 | print_pmu_events(event_glob, name_only, quiet_flag); | 2277 | print_pmu_events(event_glob, name_only, quiet_flag, long_desc); |
2277 | 2278 | ||
2278 | if (event_glob != NULL) | 2279 | if (event_glob != NULL) |
2279 | return; | 2280 | return; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 3bf376b42bf9..da246a3ddb69 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -172,7 +172,8 @@ 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, bool quiet); | 175 | void print_events(const char *event_glob, bool name_only, bool quiet, |
176 | bool long_desc); | ||
176 | 177 | ||
177 | struct event_symbol { | 178 | struct event_symbol { |
178 | const char *symbol; | 179 | const char *symbol; |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 79242cf9bb79..8ff382cb161d 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -223,7 +223,7 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, | |||
223 | } | 223 | } |
224 | 224 | ||
225 | static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, | 225 | static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, |
226 | char *desc, char *val) | 226 | char *desc, char *val, char *long_desc) |
227 | { | 227 | { |
228 | struct perf_pmu_alias *alias; | 228 | struct perf_pmu_alias *alias; |
229 | int ret; | 229 | int ret; |
@@ -257,6 +257,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, | |||
257 | } | 257 | } |
258 | 258 | ||
259 | alias->desc = desc ? strdup(desc) : NULL; | 259 | alias->desc = desc ? strdup(desc) : NULL; |
260 | alias->long_desc = long_desc ? strdup(long_desc) : | ||
261 | desc ? strdup(desc) : NULL; | ||
260 | 262 | ||
261 | list_add_tail(&alias->list, list); | 263 | list_add_tail(&alias->list, list); |
262 | 264 | ||
@@ -274,7 +276,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI | |||
274 | 276 | ||
275 | buf[ret] = 0; | 277 | buf[ret] = 0; |
276 | 278 | ||
277 | return __perf_pmu__new_alias(list, dir, name, NULL, buf); | 279 | return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL); |
278 | } | 280 | } |
279 | 281 | ||
280 | static inline bool pmu_alias_info_file(char *name) | 282 | static inline bool pmu_alias_info_file(char *name) |
@@ -532,7 +534,8 @@ static void pmu_add_cpu_aliases(struct list_head *head) | |||
532 | 534 | ||
533 | /* need type casts to override 'const' */ | 535 | /* need type casts to override 'const' */ |
534 | __perf_pmu__new_alias(head, NULL, (char *)pe->name, | 536 | __perf_pmu__new_alias(head, NULL, (char *)pe->name, |
535 | (char *)pe->desc, (char *)pe->event); | 537 | (char *)pe->desc, (char *)pe->event, |
538 | (char *)pe->long_desc); | ||
536 | } | 539 | } |
537 | 540 | ||
538 | out: | 541 | out: |
@@ -1090,7 +1093,8 @@ static void wordwrap(char *s, int start, int max, int corr) | |||
1090 | } | 1093 | } |
1091 | } | 1094 | } |
1092 | 1095 | ||
1093 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) | 1096 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, |
1097 | bool long_desc) | ||
1094 | { | 1098 | { |
1095 | struct perf_pmu *pmu; | 1099 | struct perf_pmu *pmu; |
1096 | struct perf_pmu_alias *alias; | 1100 | struct perf_pmu_alias *alias; |
@@ -1138,7 +1142,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) | |||
1138 | if (!aliases[j].name) | 1142 | if (!aliases[j].name) |
1139 | goto out_enomem; | 1143 | goto out_enomem; |
1140 | 1144 | ||
1141 | aliases[j].desc = alias->desc; | 1145 | aliases[j].desc = long_desc ? alias->long_desc : |
1146 | alias->desc; | ||
1142 | j++; | 1147 | j++; |
1143 | } | 1148 | } |
1144 | if (pmu->selectable && | 1149 | if (pmu->selectable && |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 7b47192e03b5..2fb8aa0fb47f 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
@@ -41,6 +41,7 @@ struct perf_pmu_info { | |||
41 | struct perf_pmu_alias { | 41 | struct perf_pmu_alias { |
42 | char *name; | 42 | char *name; |
43 | char *desc; | 43 | char *desc; |
44 | char *long_desc; | ||
44 | struct list_head terms; /* HEAD struct parse_events_term -> list */ | 45 | struct list_head terms; /* HEAD struct parse_events_term -> list */ |
45 | struct list_head list; /* ELEM */ | 46 | struct list_head list; /* ELEM */ |
46 | char unit[UNIT_MAX_LEN+1]; | 47 | char unit[UNIT_MAX_LEN+1]; |
@@ -72,7 +73,8 @@ int perf_pmu__format_parse(char *dir, struct list_head *head); | |||
72 | 73 | ||
73 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); | 74 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); |
74 | 75 | ||
75 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet); | 76 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet, |
77 | bool long_desc); | ||
76 | bool pmu_have_event(const char *pname, const char *name); | 78 | bool pmu_have_event(const char *pname, const char *name); |
77 | 79 | ||
78 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, | 80 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, |