diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-05-21 03:12:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-22 10:21:17 -0400 |
commit | 82ba1f2f614871b388cb1bd58594507b6f0f2b79 (patch) | |
tree | 27947bb93455777ebc75f14afc1f2f1b97d3186e /tools | |
parent | f50246e2e2e33aacc68ac3ec41cf2d6a08860bc4 (diff) |
perf tools: Add support for displaying event parser debug info
Adding PARSER_DEBUG Makefile variable to enable building event scanner/
parser with debug enabled. This results in verbose output right out of
the scanner/parser.
It's useful for debuging the event parser. Keeping this only for event
parser so far.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1337584373-2741-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 12 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 91840e171815..b24623645ef6 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -83,7 +83,13 @@ ifndef PERF_DEBUG | |||
83 | CFLAGS_OPTIMIZE = -O6 | 83 | CFLAGS_OPTIMIZE = -O6 |
84 | endif | 84 | endif |
85 | 85 | ||
86 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) | 86 | ifdef PARSER_DEBUG |
87 | PARSER_DEBUG_BISON := -t | ||
88 | PARSER_DEBUG_FLEX := -d | ||
89 | PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG | ||
90 | endif | ||
91 | |||
92 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) | ||
87 | EXTLIBS = -lpthread -lrt -lelf -lm | 93 | EXTLIBS = -lpthread -lrt -lelf -lm |
88 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 94 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
89 | ALL_LDFLAGS = $(LDFLAGS) | 95 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -216,10 +222,10 @@ FLEX = flex | |||
216 | BISON= bison | 222 | BISON= bison |
217 | 223 | ||
218 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l | 224 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l |
219 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 225 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c |
220 | 226 | ||
221 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y | 227 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
222 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | 228 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c |
223 | 229 | ||
224 | $(OUTPUT)util/pmu-flex.c: util/pmu.l | 230 | $(OUTPUT)util/pmu-flex.c: util/pmu.l |
225 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 231 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index c7fc18a33d54..6704978736cc 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -23,6 +23,9 @@ struct event_symbol { | |||
23 | const char *alias; | 23 | const char *alias; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #ifdef PARSER_DEBUG | ||
27 | extern int parse_events_debug; | ||
28 | #endif | ||
26 | int parse_events_parse(struct list_head *list, struct list_head *list_tmp, | 29 | int parse_events_parse(struct list_head *list, struct list_head *list_tmp, |
27 | int *idx); | 30 | int *idx); |
28 | 31 | ||
@@ -768,6 +771,9 @@ int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) | |||
768 | 771 | ||
769 | buffer = parse_events__scan_string(str); | 772 | buffer = parse_events__scan_string(str); |
770 | 773 | ||
774 | #ifdef PARSER_DEBUG | ||
775 | parse_events_debug = 1; | ||
776 | #endif | ||
771 | ret = parse_events_parse(&list, &list_tmp, &idx); | 777 | ret = parse_events_parse(&list, &list_tmp, &idx); |
772 | 778 | ||
773 | parse_events__flush_buffer(buffer); | 779 | parse_events__flush_buffer(buffer); |