aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2017-01-27 21:03:40 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-02-08 06:55:04 -0500
commitf23610245c1aa0e912476e642bd5107d04122230 (patch)
treef853f9d295fe1abdbad2c641b69c1e24c6a42621 /tools/perf
parent231bb2aa32498cbebef1306889a02114e9dfc934 (diff)
perf list: Add debug support for outputing alias string
For debugging and testing it is useful to see the converted alias string. Add support to perf stat/record and perf list to print the alias conversion. The text string is saved in the alias structure. For perf stat/record it is folded into the normal -v. For perf list -v was taken, so we use --debug. Before: % perf list ... cache: l1d.replacement [L1D data line replacements] l1d_pend_miss.fb_full [Cycles a demand request was blocked due to Fill Buffers inavailability] After % perf list --debug ... cache: l1d.replacement [L1D data line replacements] cpu/umask=0x1,period=2000003,event=0x51/ l1d_pend_miss.fb_full [Cycles a demand request was blocked due to Fill Buffers inavailability] cpu/umask=0x2,period=2000003,cmask=1,event=0x48/ Signed-off-by: Andi Kleen <ak@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20170128020345.19007-6-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-list.c3
-rw-r--r--tools/perf/util/parse-events.y3
-rw-r--r--tools/perf/util/pmu.c8
-rw-r--r--tools/perf/util/pmu.h1
4 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index ba9322ff858b..3b9d98b5feef 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -14,6 +14,7 @@
14#include "util/parse-events.h" 14#include "util/parse-events.h"
15#include "util/cache.h" 15#include "util/cache.h"
16#include "util/pmu.h" 16#include "util/pmu.h"
17#include "util/debug.h"
17#include <subcmd/parse-options.h> 18#include <subcmd/parse-options.h>
18 19
19static bool desc_flag = true; 20static bool desc_flag = true;
@@ -29,6 +30,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
29 "Print extra event descriptions. --no-desc to not print."), 30 "Print extra event descriptions. --no-desc to not print."),
30 OPT_BOOLEAN('v', "long-desc", &long_desc_flag, 31 OPT_BOOLEAN('v', "long-desc", &long_desc_flag,
31 "Print longer event descriptions."), 32 "Print longer event descriptions."),
33 OPT_INCR(0, "debug", &verbose,
34 "Enable debugging output"),
32 OPT_END() 35 OPT_END()
33 }; 36 };
34 const char * const list_usage[] = { 37 const char * const list_usage[] = {
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index f3b5ec901600..3a5196380609 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -13,6 +13,7 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include "util.h" 14#include "util.h"
15#include "pmu.h" 15#include "pmu.h"
16#include "debug.h"
16#include "parse-events.h" 17#include "parse-events.h"
17#include "parse-events-bison.h" 18#include "parse-events-bison.h"
18 19
@@ -254,6 +255,8 @@ PE_KERNEL_PMU_EVENT sep_dc
254 255
255 if (!parse_events_add_pmu(data, list, 256 if (!parse_events_add_pmu(data, list,
256 pmu->name, head)) { 257 pmu->name, head)) {
258 pr_debug("%s -> %s/%s/\n", $1,
259 pmu->name, alias->str);
257 ok++; 260 ok++;
258 } 261 }
259 262
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8e9d00fd418e..82a654dec666 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -275,6 +275,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
275 snprintf(alias->unit, sizeof(alias->unit), "%s", unit); 275 snprintf(alias->unit, sizeof(alias->unit), "%s", unit);
276 } 276 }
277 alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1; 277 alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1;
278 alias->str = strdup(val);
279
278 list_add_tail(&alias->list, list); 280 list_add_tail(&alias->list, list);
279 281
280 return 0; 282 return 0;
@@ -1087,6 +1089,8 @@ struct sevent {
1087 char *name; 1089 char *name;
1088 char *desc; 1090 char *desc;
1089 char *topic; 1091 char *topic;
1092 char *str;
1093 char *pmu;
1090}; 1094};
1091 1095
1092static int cmp_sevent(const void *a, const void *b) 1096static int cmp_sevent(const void *a, const void *b)
@@ -1183,6 +1187,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
1183 aliases[j].desc = long_desc ? alias->long_desc : 1187 aliases[j].desc = long_desc ? alias->long_desc :
1184 alias->desc; 1188 alias->desc;
1185 aliases[j].topic = alias->topic; 1189 aliases[j].topic = alias->topic;
1190 aliases[j].str = alias->str;
1191 aliases[j].pmu = pmu->name;
1186 j++; 1192 j++;
1187 } 1193 }
1188 if (pmu->selectable && 1194 if (pmu->selectable &&
@@ -1217,6 +1223,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
1217 printf("%*s", 8, "["); 1223 printf("%*s", 8, "[");
1218 wordwrap(aliases[j].desc, 8, columns, 0); 1224 wordwrap(aliases[j].desc, 8, columns, 0);
1219 printf("]\n"); 1225 printf("]\n");
1226 if (verbose)
1227 printf("%*s%s/%s/\n", 8, "", aliases[j].pmu, aliases[j].str);
1220 } else 1228 } else
1221 printf(" %-50s [Kernel PMU event]\n", aliases[j].name); 1229 printf(" %-50s [Kernel PMU event]\n", aliases[j].name);
1222 printed++; 1230 printed++;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 25712034c815..00852ddc7741 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -43,6 +43,7 @@ struct perf_pmu_alias {
43 char *desc; 43 char *desc;
44 char *long_desc; 44 char *long_desc;
45 char *topic; 45 char *topic;
46 char *str;
46 struct list_head terms; /* HEAD struct parse_events_term -> list */ 47 struct list_head terms; /* HEAD struct parse_events_term -> list */
47 struct list_head list; /* ELEM */ 48 struct list_head list; /* ELEM */
48 char unit[UNIT_MAX_LEN+1]; 49 char unit[UNIT_MAX_LEN+1];