diff options
| author | Ingo Molnar <mingo@kernel.org> | 2012-03-31 03:27:41 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-03-31 03:27:41 -0400 |
| commit | 8ebfdf2babcda5a3b06cc67523bca1f9aed46009 (patch) | |
| tree | 160fe42903b8fdd399347ae9e7a7d72c331570f8 | |
| parent | 12b5da349a8b94c9dbc3430a6bc42eabd9eaf50b (diff) | |
| parent | 65f3e56e0c81d1f581c4bdef7646ae5a8d51f494 (diff) | |
Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
| -rw-r--r-- | tools/perf/Makefile | 47 | ||||
| -rw-r--r-- | tools/perf/util/annotate.c | 8 | ||||
| -rw-r--r-- | tools/perf/util/evsel.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/hist.c | 157 | ||||
| -rw-r--r-- | tools/perf/util/parse-events-bison.c | 1917 | ||||
| -rw-r--r-- | tools/perf/util/parse-events-bison.h | 81 | ||||
| -rw-r--r-- | tools/perf/util/parse-events-flex.c | 2272 | ||||
| -rw-r--r-- | tools/perf/util/parse-events-flex.h | 316 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.l | 1 | ||||
| -rw-r--r-- | tools/perf/util/pmu-bison.c | 1663 | ||||
| -rw-r--r-- | tools/perf/util/pmu-bison.h | 73 | ||||
| -rw-r--r-- | tools/perf/util/pmu-flex.c | 1821 | ||||
| -rw-r--r-- | tools/perf/util/pmu-flex.h | 316 | ||||
| -rw-r--r-- | tools/perf/util/probe-finder.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/symbol.c | 3 |
15 files changed, 135 insertions, 8546 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 2f428863880..820371f10d1 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -61,8 +61,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
| 61 | 61 | ||
| 62 | CC = $(CROSS_COMPILE)gcc | 62 | CC = $(CROSS_COMPILE)gcc |
| 63 | AR = $(CROSS_COMPILE)ar | 63 | AR = $(CROSS_COMPILE)ar |
| 64 | FLEX = $(CROSS_COMPILE)flex | ||
| 65 | BISON= $(CROSS_COMPILE)bison | ||
| 66 | 64 | ||
| 67 | # Additional ARCH settings for x86 | 65 | # Additional ARCH settings for x86 |
| 68 | ifeq ($(ARCH),i386) | 66 | ifeq ($(ARCH),i386) |
| @@ -184,7 +182,7 @@ endif | |||
| 184 | 182 | ||
| 185 | ### --- END CONFIGURATION SECTION --- | 183 | ### --- END CONFIGURATION SECTION --- |
| 186 | 184 | ||
| 187 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 185 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
| 188 | BASIC_LDFLAGS = | 186 | BASIC_LDFLAGS = |
| 189 | 187 | ||
| 190 | # Guard against environment variables | 188 | # Guard against environment variables |
| @@ -236,6 +234,25 @@ endif | |||
| 236 | 234 | ||
| 237 | export PERL_PATH | 235 | export PERL_PATH |
| 238 | 236 | ||
| 237 | FLEX = $(CROSS_COMPILE)flex | ||
| 238 | BISON= $(CROSS_COMPILE)bison | ||
| 239 | |||
| 240 | event-parser: | ||
| 241 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | ||
| 242 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | ||
| 243 | |||
| 244 | $(OUTPUT)util/parse-events-flex.c: event-parser | ||
| 245 | $(OUTPUT)util/parse-events-bison.c: event-parser | ||
| 246 | |||
| 247 | pmu-parser: | ||
| 248 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c | ||
| 249 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | ||
| 250 | |||
| 251 | $(OUTPUT)util/pmu-flex.c: pmu-parser | ||
| 252 | $(OUTPUT)util/pmu-bison.c: pmu-parser | ||
| 253 | |||
| 254 | $(OUTPUT)util/parse-events.o: event-parser pmu-parser | ||
| 255 | |||
| 239 | LIB_FILE=$(OUTPUT)libperf.a | 256 | LIB_FILE=$(OUTPUT)libperf.a |
| 240 | 257 | ||
| 241 | LIB_H += ../../include/linux/perf_event.h | 258 | LIB_H += ../../include/linux/perf_event.h |
| @@ -754,6 +771,15 @@ $(OUTPUT)perf.o perf.spec \ | |||
| 754 | .SUFFIXES: | 771 | .SUFFIXES: |
| 755 | .SUFFIXES: .o .c .S .s | 772 | .SUFFIXES: .o .c .S .s |
| 756 | 773 | ||
| 774 | # These two need to be here so that when O= is not used they take precedence | ||
| 775 | # over the general rule for .o | ||
| 776 | |||
| 777 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS | ||
| 778 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
| 779 | |||
| 780 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS | ||
| 781 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
| 782 | |||
| 757 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS | 783 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
| 758 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | 784 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
| 759 | $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS | 785 | $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS |
| @@ -790,12 +816,6 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS | |||
| 790 | $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS | 816 | $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS |
| 791 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 817 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
| 792 | 818 | ||
| 793 | $(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS | ||
| 794 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
| 795 | |||
| 796 | $(OUTPUT)util/pmu-flex.o: util/pmu-flex.c $(OUTPUT)PERF-CFLAGS | ||
| 797 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
| 798 | |||
| 799 | $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS | 819 | $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS |
| 800 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< | 820 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< |
| 801 | 821 | ||
| @@ -883,14 +903,6 @@ cscope: | |||
| 883 | $(RM) cscope* | 903 | $(RM) cscope* |
| 884 | $(FIND) . -name '*.[hcS]' -print | xargs cscope -b | 904 | $(FIND) . -name '*.[hcS]' -print | xargs cscope -b |
| 885 | 905 | ||
| 886 | event-parser: | ||
| 887 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c | ||
| 888 | $(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c | ||
| 889 | |||
| 890 | pmu-parser: | ||
| 891 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o util/pmu-bison.c | ||
| 892 | $(QUIET_FLEX)$(FLEX) --header-file=util/pmu-flex.h -t util/pmu.l > util/pmu-flex.c | ||
| 893 | |||
| 894 | ### Detect prefix changes | 906 | ### Detect prefix changes |
| 895 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ | 907 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ |
| 896 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) | 908 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) |
| @@ -978,6 +990,7 @@ clean: | |||
| 978 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* | 990 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* |
| 979 | $(MAKE) -C Documentation/ clean | 991 | $(MAKE) -C Documentation/ clean |
| 980 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS | 992 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS |
| 993 | $(RM) $(OUTPUT)util/*-{bison,flex}* | ||
| 981 | $(python-clean) | 994 | $(python-clean) |
| 982 | 995 | ||
| 983 | .PHONY: all install clean strip | 996 | .PHONY: all install clean strip |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index e5a462f1d07..199f69ec656 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym) | |||
| 28 | int symbol__alloc_hist(struct symbol *sym) | 28 | int symbol__alloc_hist(struct symbol *sym) |
| 29 | { | 29 | { |
| 30 | struct annotation *notes = symbol__annotation(sym); | 30 | struct annotation *notes = symbol__annotation(sym); |
| 31 | size_t sizeof_sym_hist = (sizeof(struct sym_hist) + | 31 | const size_t size = sym->end - sym->start + 1; |
| 32 | (sym->end - sym->start) * sizeof(u64)); | 32 | size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64)); |
| 33 | 33 | ||
| 34 | notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist); | 34 | notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist); |
| 35 | if (notes->src == NULL) | 35 | if (notes->src == NULL) |
| @@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
| 64 | 64 | ||
| 65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); | 65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); |
| 66 | 66 | ||
| 67 | if (addr >= sym->end) | 67 | if (addr > sym->end) |
| 68 | return 0; | 68 | return 0; |
| 69 | 69 | ||
| 70 | offset = addr - sym->start; | 70 | offset = addr - sym->start; |
| @@ -408,7 +408,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
| 408 | if (!notes->src->lines) | 408 | if (!notes->src->lines) |
| 409 | return -1; | 409 | return -1; |
| 410 | 410 | ||
| 411 | start = map->unmap_ip(map, sym->start); | 411 | start = map__rip_2objdump(map, sym->start); |
| 412 | 412 | ||
| 413 | for (i = 0; i < len; i++) { | 413 | for (i = 0; i < len; i++) { |
| 414 | char *path = NULL; | 414 | char *path = NULL; |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d9da62a7234..8c13dbcb84b 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, | |||
| 580 | return -EFAULT; | 580 | return -EFAULT; |
| 581 | 581 | ||
| 582 | data->raw_data = (void *) pdata; | 582 | data->raw_data = (void *) pdata; |
| 583 | |||
| 584 | array = (void *)array + data->raw_size + sizeof(u32); | ||
| 583 | } | 585 | } |
| 584 | 586 | ||
| 585 | if (type & PERF_SAMPLE_BRANCH_STACK) { | 587 | if (type & PERF_SAMPLE_BRANCH_STACK) { |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index c61235f8126..2ec4b60aff6 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -607,7 +607,7 @@ static void init_rem_hits(void) | |||
| 607 | rem_hits.ms.sym = rem_sq_bracket; | 607 | rem_hits.ms.sym = rem_sq_bracket; |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | 610 | static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, |
| 611 | u64 total_samples, int depth, | 611 | u64 total_samples, int depth, |
| 612 | int depth_mask, int left_margin) | 612 | int depth_mask, int left_margin) |
| 613 | { | 613 | { |
| @@ -615,21 +615,16 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | |||
| 615 | struct callchain_node *child; | 615 | struct callchain_node *child; |
| 616 | struct callchain_list *chain; | 616 | struct callchain_list *chain; |
| 617 | int new_depth_mask = depth_mask; | 617 | int new_depth_mask = depth_mask; |
| 618 | u64 new_total; | ||
