diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-01-13 03:58:37 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 04:08:50 -0500 |
commit | 61405fea92c42d072d9b8bd189689f1502a838af (patch) | |
tree | 013ea3e7ed71f4114004d5852d40b6e89e128f76 /tools | |
parent | 9c443dfdd31eddea6cbe6ee0ca469fbcc4e1dc3b (diff) | |
parent | 1703f2c321a8a531c393e137a82602e16c6061cb (diff) |
Merge branch 'perf/urgent' into perf/core
Merge reason: queue up dependent patch, update to -rc4
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 44 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 4 | ||||
-rw-r--r-- | tools/perf/design.txt | 8 |
3 files changed, 34 insertions, 22 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 7c846424aebf..2c03a9411317 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -250,7 +250,19 @@ PTHREAD_LIBS = -lpthread | |||
250 | # explicitly what architecture to check for. Fix this up for yours.. | 250 | # explicitly what architecture to check for. Fix this up for yours.. |
251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | 251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
252 | 252 | ||
253 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y) | 253 | ifeq ($(V), 2) |
254 | QUIET_STDERR = ">/dev/null" | ||
255 | else | ||
256 | QUIET_STDERR = ">/dev/null 2>&1" | ||
257 | endif | ||
258 | |||
259 | BITBUCKET = "/dev/null" | ||
260 | |||
261 | ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
262 | BITBUCKET = .perf.dev.null | ||
263 | endif | ||
264 | |||
265 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
254 | CFLAGS := $(CFLAGS) -fstack-protector-all | 266 | CFLAGS := $(CFLAGS) -fstack-protector-all |
255 | endif | 267 | endif |
256 | 268 | ||
@@ -452,11 +464,6 @@ BUILTIN_OBJS += builtin-kmem.o | |||
452 | 464 | ||
453 | PERFLIBS = $(LIB_FILE) | 465 | PERFLIBS = $(LIB_FILE) |
454 | 466 | ||
455 | ifeq ($(V), 2) | ||
456 | QUIET_STDERR = ">/dev/null" | ||
457 | else | ||
458 | QUIET_STDERR = ">/dev/null 2>&1" | ||
459 | endif | ||
460 | # | 467 | # |
461 | # Platform specific tweaks | 468 | # Platform specific tweaks |
462 | # | 469 | # |
@@ -484,19 +491,19 @@ ifeq ($(uname_S),Darwin) | |||
484 | PTHREAD_LIBS = | 491 | PTHREAD_LIBS = |
485 | endif | 492 | endif |
486 | 493 | ||
487 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 494 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
488 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 495 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
489 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 496 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
490 | endif | 497 | endif |
491 | 498 | ||
492 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 499 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
493 | BASIC_CFLAGS += -DLIBELF_NO_MMAP | 500 | BASIC_CFLAGS += -DLIBELF_NO_MMAP |
494 | endif | 501 | endif |
495 | else | 502 | else |
496 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | 503 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
497 | endif | 504 | endif |
498 | 505 | ||
499 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 506 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
500 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); | 507 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); |
501 | BASIC_CFLAGS += -DNO_LIBDWARF | 508 | BASIC_CFLAGS += -DNO_LIBDWARF |
502 | else | 509 | else |
@@ -510,7 +517,7 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` | |||
510 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | 517 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
511 | endif | 518 | endif |
512 | 519 | ||
513 | ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) | 520 | ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) |
514 | BASIC_CFLAGS += -DNO_LIBPERL | 521 | BASIC_CFLAGS += -DNO_LIBPERL |
515 | else | 522 | else |
516 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) | 523 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) |
@@ -520,20 +527,20 @@ endif | |||
520 | ifdef NO_DEMANGLE | 527 | ifdef NO_DEMANGLE |
521 | BASIC_CFLAGS += -DNO_DEMANGLE | 528 | BASIC_CFLAGS += -DNO_DEMANGLE |
522 | else | 529 | else |
523 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") | 530 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") |
524 | 531 | ||
525 | ifeq ($(has_bfd),y) | 532 | ifeq ($(has_bfd),y) |
526 | EXTLIBS += -lbfd | 533 | EXTLIBS += -lbfd |
527 | else | 534 | else |
528 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") | 535 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") |
529 | ifeq ($(has_bfd_iberty),y) | 536 | ifeq ($(has_bfd_iberty),y) |
530 | EXTLIBS += -lbfd -liberty | 537 | EXTLIBS += -lbfd -liberty |
531 | else | 538 | else |
532 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") | 539 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") |
533 | ifeq ($(has_bfd_iberty_z),y) | 540 | ifeq ($(has_bfd_iberty_z),y) |
534 | EXTLIBS += -lbfd -liberty -lz | 541 | EXTLIBS += -lbfd -liberty -lz |
535 | else | 542 | else |
536 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") | 543 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") |
537 | ifeq ($(has_cplus_demangle),y) | 544 | ifeq ($(has_cplus_demangle),y) |
538 | EXTLIBS += -liberty | 545 | EXTLIBS += -liberty |
539 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | 546 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE |
@@ -781,7 +788,7 @@ export TAR INSTALL DESTDIR SHELL_PATH | |||
781 | 788 | ||
782 | SHELL = $(SHELL_PATH) | 789 | SHELL = $(SHELL_PATH) |
783 | 790 | ||
784 | all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS | 791 | all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS |
785 | ifneq (,$X) | 792 | ifneq (,$X) |
786 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) | 793 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) |
787 | endif | 794 | endif |
@@ -1108,6 +1115,11 @@ clean: | |||
1108 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS | 1115 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS |
1109 | .PHONY: .FORCE-PERF-BUILD-OPTIONS | 1116 | .PHONY: .FORCE-PERF-BUILD-OPTIONS |
1110 | 1117 | ||
1118 | .perf.dev.null: | ||
1119 | touch .perf.dev.null | ||
1120 | |||
1121 | .INTERMEDIATE: .perf.dev.null | ||
1122 | |||
1111 | ### Make sure built-ins do not have dups and listed in perf.c | 1123 | ### Make sure built-ins do not have dups and listed in perf.c |
1112 | # | 1124 | # |
1113 | check-builtins:: | 1125 | check-builtins:: |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 05dc5a735039..88c570c18e3e 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -132,7 +132,7 @@ static void insert_alloc_stat(unsigned long call_site, unsigned long ptr, | |||
132 | if (data && data->ptr == ptr) { | 132 | if (data && data->ptr == ptr) { |
133 | data->hit++; | 133 | data->hit++; |
134 | data->bytes_req += bytes_req; | 134 | data->bytes_req += bytes_req; |
135 | data->bytes_alloc += bytes_req; | 135 | data->bytes_alloc += bytes_alloc; |
136 | } else { | 136 | } else { |
137 | data = malloc(sizeof(*data)); | 137 | data = malloc(sizeof(*data)); |
138 | if (!data) | 138 | if (!data) |
@@ -172,7 +172,7 @@ static void insert_caller_stat(unsigned long call_site, | |||
172 | if (data && data->call_site == call_site) { | 172 | if (data && data->call_site == call_site) { |
173 | data->hit++; | 173 | data->hit++; |
174 | data->bytes_req += bytes_req; | 174 | data->bytes_req += bytes_req; |
175 | data->bytes_alloc += bytes_req; | 175 | data->bytes_alloc += bytes_alloc; |
176 | } else { | 176 | } else { |
177 | data = malloc(sizeof(*data)); | 177 | data = malloc(sizeof(*data)); |
178 | if (!data) | 178 | if (!data) |
diff --git a/tools/perf/design.txt b/tools/perf/design.txt index f000c30877ac..8d0de5130db3 100644 --- a/tools/perf/design.txt +++ b/tools/perf/design.txt | |||
@@ -21,7 +21,7 @@ There's one file descriptor per virtual counter used. | |||
21 | The special file descriptor is opened via the perf_event_open() | 21 | The special file descriptor is opened via the perf_event_open() |
22 | system call: | 22 | system call: |
23 | 23 | ||
24 | int sys_perf_event_open(struct perf_event_hw_event *hw_event_uptr, | 24 | int sys_perf_event_open(struct perf_event_attr *hw_event_uptr, |
25 | pid_t pid, int cpu, int group_fd, | 25 | pid_t pid, int cpu, int group_fd, |
26 | unsigned long flags); | 26 | unsigned long flags); |
27 | 27 | ||
@@ -32,9 +32,9 @@ can be used to set the blocking mode, etc. | |||
32 | Multiple counters can be kept open at a time, and the counters | 32 | Multiple counters can be kept open at a time, and the counters |
33 | can be poll()ed. | 33 | can be poll()ed. |
34 | 34 | ||
35 | When creating a new counter fd, 'perf_event_hw_event' is: | 35 | When creating a new counter fd, 'perf_event_attr' is: |
36 | 36 | ||
37 | struct perf_event_hw_event { | 37 | struct perf_event_attr { |
38 | /* | 38 | /* |
39 | * The MSB of the config word signifies if the rest contains cpu | 39 | * The MSB of the config word signifies if the rest contains cpu |
40 | * specific (raw) counter configuration data, if unset, the next | 40 | * specific (raw) counter configuration data, if unset, the next |
@@ -399,7 +399,7 @@ Notification of new events is possible through poll()/select()/epoll() and | |||
399 | fcntl() managing signals. | 399 | fcntl() managing signals. |
400 | 400 | ||
401 | Normally a notification is generated for every page filled, however one can | 401 | Normally a notification is generated for every page filled, however one can |
402 | additionally set perf_event_hw_event.wakeup_events to generate one every | 402 | additionally set perf_event_attr.wakeup_events to generate one every |
403 | so many counter overflow events. | 403 | so many counter overflow events. |
404 | 404 | ||
405 | Future work will include a splice() interface to the ring-buffer. | 405 | Future work will include a splice() interface to the ring-buffer. |