aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-03-15 15:09:15 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-03-16 13:20:21 -0400
commit89812fc81f8d62d70433a8ff63d26819f372e8ec (patch)
tree8d2c6ad6eee1200f5107fa8063a002f415887ba3 /tools/perf/Makefile
parent641cc938815dfd09f8fa1ec72deb814f0938ac33 (diff)
perf tools: Add parser generator for events parsing
Changing event parsing to use flex/bison parse generator. The event syntax stays as it was. grammar description: events: events ',' event | event event: event_def PE_MODIFIER_EVENT | event_def event_def: event_legacy_symbol sep_dc | event_legacy_cache sep_dc | event_legacy_breakpoint sep_dc | event_legacy_tracepoint sep_dc | event_legacy_numeric sep_dc | event_legacy_raw sep_dc event_legacy_symbol: PE_NAME_SYM event_legacy_cache: PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT | PE_NAME_CACHE_TYPE event_legacy_raw: PE_SEP_RAW PE_VALUE event_legacy_numeric: PE_VALUE ':' PE_VALUE event_legacy_breakpoint: PE_SEP_BP ':' PE_VALUE ':' PE_MODIFIER_BP event_breakpoint_type: PE_MODIFIER_BPTYPE | empty PE_NAME_SYM: cpu-cycles|cycles | stalled-cycles-frontend|idle-cycles-frontend | stalled-cycles-backend|idle-cycles-backend | instructions | cache-references | cache-misses | branch-instructions|branches | branch-misses | bus-cycles | cpu-clock | task-clock | page-faults|faults | minor-faults | major-faults | context-switches|cs | cpu-migrations|migrations | alignment-faults | emulation-faults PE_NAME_CACHE_TYPE: L1-dcache|l1-d|l1d|L1-data | L1-icache|l1-i|l1i|L1-instruction | LLC|L2 | dTLB|d-tlb|Data-TLB | iTLB|i-tlb|Instruction-TLB | branch|branches|bpu|btb|bpc | node PE_NAME_CACHE_OP_RESULT: load|loads|read | store|stores|write | prefetch|prefetches | speculative-read|speculative-load | refs|Reference|ops|access | misses|miss PE_MODIFIER_EVENT: [ukhp]{0,5} PE_MODIFIER_BP: [rwx] PE_SEP_BP: 'mem' PE_SEP_RAW: 'r' sep_dc: ':' | Added flex/bison files for event grammar parsing. The generated parser is part of the patch. Added makefile rule 'event-parser' to generate the parser code out of the bison/flex sources. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-u4pfig5waq3ll2bfcdex8fgi@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bd328554aec..dfc80289d7f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -61,6 +61,8 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
61 61
62CC = $(CROSS_COMPILE)gcc 62CC = $(CROSS_COMPILE)gcc
63AR = $(CROSS_COMPILE)ar 63AR = $(CROSS_COMPILE)ar
64FLEX = $(CROSS_COMPILE)flex
65BISON= $(CROSS_COMPILE)bison
64 66
65# Additional ARCH settings for x86 67# Additional ARCH settings for x86
66ifeq ($(ARCH),i386) 68ifeq ($(ARCH),i386)
@@ -357,6 +359,8 @@ LIB_OBJS += $(OUTPUT)util/session.o
357LIB_OBJS += $(OUTPUT)util/thread.o 359LIB_OBJS += $(OUTPUT)util/thread.o
358LIB_OBJS += $(OUTPUT)util/thread_map.o 360LIB_OBJS += $(OUTPUT)util/thread_map.o
359LIB_OBJS += $(OUTPUT)util/trace-event-parse.o 361LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
362LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
363LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
360LIB_OBJS += $(OUTPUT)util/trace-event-read.o 364LIB_OBJS += $(OUTPUT)util/trace-event-read.o
361LIB_OBJS += $(OUTPUT)util/trace-event-info.o 365LIB_OBJS += $(OUTPUT)util/trace-event-info.o
362LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o 366LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
@@ -645,6 +649,8 @@ ifndef V
645 QUIET_LINK = @echo ' ' LINK $@; 649 QUIET_LINK = @echo ' ' LINK $@;
646 QUIET_MKDIR = @echo ' ' MKDIR $@; 650 QUIET_MKDIR = @echo ' ' MKDIR $@;
647 QUIET_GEN = @echo ' ' GEN $@; 651 QUIET_GEN = @echo ' ' GEN $@;
652 QUIET_FLEX = @echo ' ' FLEX $@;
653 QUIET_BISON = @echo ' ' BISON $@;
648endif 654endif
649endif 655endif
650 656
@@ -725,6 +731,9 @@ $(OUTPUT)perf.o perf.spec \
725 $(SCRIPTS) \ 731 $(SCRIPTS) \
726 : $(OUTPUT)PERF-VERSION-FILE 732 : $(OUTPUT)PERF-VERSION-FILE
727 733
734.SUFFIXES:
735.SUFFIXES: .o .c .S .s
736
728$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 737$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
729 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 738 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
730$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS 739$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
@@ -761,6 +770,9 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
761$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 770$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
762 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 771 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
763 772
773$(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS
774 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
775
764$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS 776$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
765 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< 777 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
766 778
@@ -797,6 +809,7 @@ help:
797 @echo ' html - make html documentation' 809 @echo ' html - make html documentation'
798 @echo ' info - make GNU info documentation (access with info <foo>)' 810 @echo ' info - make GNU info documentation (access with info <foo>)'
799 @echo ' pdf - make pdf documentation' 811 @echo ' pdf - make pdf documentation'
812 @echo ' event-parser - make event parser code'
800 @echo ' TAGS - use etags to make tag information for source browsing' 813 @echo ' TAGS - use etags to make tag information for source browsing'
801 @echo ' tags - use ctags to make tag information for source browsing' 814 @echo ' tags - use ctags to make tag information for source browsing'
802 @echo ' cscope - use cscope to make interactive browsing database' 815 @echo ' cscope - use cscope to make interactive browsing database'
@@ -846,6 +859,10 @@ cscope:
846 $(RM) cscope* 859 $(RM) cscope*
847 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b 860 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
848 861
862event-parser:
863 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c
864 $(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c
865
849### Detect prefix changes 866### Detect prefix changes
850TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ 867TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
851 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) 868 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)