diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-01-31 04:20:14 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-01-31 04:20:14 -0500 |
| commit | 152fefa921535665f95840c08062844ab2f5593e (patch) | |
| tree | b6ff202ebeca4341a1332258a04403f8ce95e75a | |
| parent | a2d28d0c198b65fac28ea6212f5f8edc77b29c27 (diff) | |
| parent | 5809fde040de2afa477a6c593ce2e8fd2c11d9d3 (diff) | |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
. Fix some leaks in exit paths.
. Use memdup where applicable
. Remove some die() calls, allowing callers to handle exit paths
gracefully.
. Correct typo in tools Makefile, fix from Borislav Petkov.
. Add 'perf bench numa mem' NUMA performance measurement suite, from Ingo Molnar.
. Handle dynamic array's element size properly, fix from Jiri Olsa.
. Fix memory leaks on evsel->counts, from Namhyung Kim.
. Make numa benchmark optional, allowing the build in machines where required
numa libraries are not present, fix from Peter Hurley.
. Add interval printing in 'perf stat', from Stephane Eranian.
. Fix compile warnings in tests/attr.c, from Sukadev Bhattiprolu.
. Fix double free, pclose instead of fclose, leaks and double fclose errors
found with the cppcheck tool, from Thomas Jarosch.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/Makefile | 2 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.c | 39 | ||||
| -rw-r--r-- | tools/perf/Documentation/perf-stat.txt | 4 | ||||
| -rw-r--r-- | tools/perf/Makefile | 13 | ||||
| -rw-r--r-- | tools/perf/arch/common.c | 1 | ||||
| -rw-r--r-- | tools/perf/bench/bench.h | 1 | ||||
| -rw-r--r-- | tools/perf/bench/numa.c | 1731 | ||||
| -rw-r--r-- | tools/perf/builtin-bench.c | 17 | ||||
| -rw-r--r-- | tools/perf/builtin-kmem.c | 6 | ||||
| -rw-r--r-- | tools/perf/builtin-stat.c | 158 | ||||
| -rw-r--r-- | tools/perf/config/feature-tests.mak | 11 | ||||
| -rw-r--r-- | tools/perf/tests/attr.c | 5 | ||||
| -rw-r--r-- | tools/perf/tests/open-syscall-all-cpus.c | 1 | ||||
| -rw-r--r-- | tools/perf/tests/perf-record.c | 12 | ||||
| -rw-r--r-- | tools/perf/tests/vmlinux-kallsyms.c | 4 | ||||
| -rw-r--r-- | tools/perf/ui/browser.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/event.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/evsel.c | 31 | ||||
| -rw-r--r-- | tools/perf/util/evsel.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/header.c | 25 | ||||
| -rw-r--r-- | tools/perf/util/map.c | 118 | ||||
| -rw-r--r-- | tools/perf/util/map.h | 24 | ||||
| -rw-r--r-- | tools/perf/util/sort.c | 7 | ||||
| -rw-r--r-- | tools/perf/util/strlist.c | 54 | ||||
| -rw-r--r-- | tools/perf/util/strlist.h | 42 |
25 files changed, 2154 insertions, 160 deletions
diff --git a/tools/Makefile b/tools/Makefile index 1f9a529fe544..798fa0ef048e 100644 --- a/tools/Makefile +++ b/tools/Makefile | |||
| @@ -15,7 +15,7 @@ help: | |||
| 15 | @echo ' x86_energy_perf_policy - Intel energy policy tool' | 15 | @echo ' x86_energy_perf_policy - Intel energy policy tool' |
| 16 | @echo '' | 16 | @echo '' |
| 17 | @echo 'You can do:' | 17 | @echo 'You can do:' |
| 18 | @echo ' $$ make -C tools/<tool>_install' | 18 | @echo ' $$ make -C tools/ <tool>_install' |
| 19 | @echo '' | 19 | @echo '' |
| 20 | @echo ' from the kernel command line to build and install one of' | 20 | @echo ' from the kernel command line to build and install one of' |
| 21 | @echo ' the tools above' | 21 | @echo ' the tools above' |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index bb8b3db0e583..82b0606dcb8a 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
| @@ -1223,6 +1223,34 @@ static int field_is_long(struct format_field *field) | |||
| 1223 | return 0; | 1223 | return 0; |
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| 1226 | static unsigned int type_size(const char *name) | ||
| 1227 | { | ||
| 1228 | /* This covers all FIELD_IS_STRING types. */ | ||
| 1229 | static struct { | ||
| 1230 | const char *type; | ||
| 1231 | unsigned int size; | ||
| 1232 | } table[] = { | ||
| 1233 | { "u8", 1 }, | ||
| 1234 | { "u16", 2 }, | ||
| 1235 | { "u32", 4 }, | ||
| 1236 | { "u64", 8 }, | ||
| 1237 | { "s8", 1 }, | ||
| 1238 | { "s16", 2 }, | ||
| 1239 | { "s32", 4 }, | ||
| 1240 | { "s64", 8 }, | ||
| 1241 | { "char", 1 }, | ||
| 1242 | { }, | ||
| 1243 | }; | ||
| 1244 | int i; | ||
| 1245 | |||
| 1246 | for (i = 0; table[i].type; i++) { | ||
| 1247 | if (!strcmp(table[i].type, name)) | ||
| 1248 | return table[i].size; | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | return 0; | ||
| 1252 | } | ||
| 1253 | |||
| 1226 | static int event_read_fields(struct event_format *event, struct format_field **fields) | 1254 | static int event_read_fields(struct event_format *event, struct format_field **fields) |
| 1227 | { | 1255 | { |
| 1228 | struct format_field *field = NULL; | 1256 | struct format_field *field = NULL; |
| @@ -1232,6 +1260,8 @@ static int event_read_fields(struct event_format *event, struct format_field **f | |||
| 1232 | int count = 0; | 1260 | int count = 0; |
| 1233 | 1261 | ||
| 1234 | do { | 1262 | do { |
| 1263 | unsigned int size_dynamic = 0; | ||
| 1264 | |||
| 1235 | type = read_token(&token); | 1265 | type = read_token(&token); |
| 1236 | if (type == EVENT_NEWLINE) { | 1266 | if (type == EVENT_NEWLINE) { |
| 1237 | free_token(token); | 1267 | free_token(token); |
| @@ -1390,6 +1420,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f | |||
| 1390 | field->type = new_type; | 1420 | field->type = new_type; |
| 1391 | strcat(field->type, " "); | 1421 | strcat(field->type, " "); |
| 1392 | strcat(field->type, field->name); | 1422 | strcat(field->type, field->name); |
| 1423 | size_dynamic = type_size(field->name); | ||
| 1393 | free_token(field->name); | 1424 | free_token(field->name); |
| 1394 | strcat(field->type, brackets); | 1425 | strcat(field->type, brackets); |
| 1395 | field->name = token; | 1426 | field->name = token; |
| @@ -1478,10 +1509,14 @@ static int event_read_fields(struct event_format *event, struct format_field **f | |||
| 1478 | if (field->flags & FIELD_IS_ARRAY) { | 1509 | if (field->flags & FIELD_IS_ARRAY) { |
| 1479 | if (field->arraylen) | 1510 | if (field->arraylen) |
| 1480 | field->elementsize = field->size / field->arraylen; | 1511 | field->elementsize = field->size / field->arraylen; |
| 1512 | else if (field->flags & FIELD_IS_DYNAMIC) | ||
| 1513 | field->elementsize = size_dynamic; | ||
| 1481 | else if (field->flags & FIELD_IS_STRING) | 1514 | else if (field->flags & FIELD_IS_STRING) |
| 1482 | field->elementsize = 1; | 1515 | field->elementsize = 1; |
| 1483 | else | 1516 | else if (field->flags & FIELD_IS_LONG) |
| 1484 | field->elementsize = event->pevent->long_size; | 1517 | field->elementsize = event->pevent ? |
| 1518 | event->pevent->long_size : | ||
| 1519 | sizeof(long); | ||
| 1485 | } else | 1520 | } else |
| 1486 | field->elementsize = field->size; | 1521 | field->elementsize = field->size; |
| 1487 | 1522 | ||
diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index cf0c3107e06e..5289da3344e9 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt | |||
| @@ -114,6 +114,10 @@ with it. --append may be used here. Examples: | |||
| 114 | 114 | ||
| 115 | perf stat --repeat 10 --null --sync --pre 'make -s O=defconfig-build/clean' -- make -s -j64 O=defconfig-build/ bzImage | 115 | perf stat --repeat 10 --null --sync --pre 'make -s O=defconfig-build/clean' -- make -s -j64 O=defconfig-build/ bzImage |
| 116 | 116 | ||
| 117 | -I msecs:: | ||
| 118 | --interval-print msecs:: | ||
| 119 | print count deltas every N milliseconds (minimum: 100ms) | ||
| 120 | example: perf stat -I 1000 -e cycles -a sleep 5 | ||
| 117 | 121 | ||
| 118 | EXAMPLES | 122 | EXAMPLES |
| 119 | -------- | 123 | -------- |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index a84021abb3fe..4b1044cbd84c 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -47,6 +47,8 @@ include config/utilities.mak | |||
| 47 | # backtrace post unwind. | 47 | # backtrace post unwind. |
| 48 | # | 48 | # |
| 49 | # Define NO_BACKTRACE if you do not want stack backtrace debug feature | 49 | # Define NO_BACKTRACE if you do not want stack backtrace debug feature |
| 50 | # | ||
| 51 | # Define NO_LIBNUMA if you do not want numa perf benchmark | ||
| 50 | 52 | ||
| 51 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 53 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
| 52 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 54 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
| @@ -838,6 +840,17 @@ ifndef NO_BACKTRACE | |||
| 838 | endif | 840 | endif |
| 839 | endif | 841 | endif |
| 840 | 842 | ||
| 843 | ifndef NO_LIBNUMA | ||
| 844 | FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma | ||
| 845 | ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) | ||
| 846 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); | ||
| 847 | else | ||
| 848 | BASIC_CFLAGS += -DLIBNUMA_SUPPORT | ||
| 849 | BUILTIN_OBJS += $(OUTPUT)bench/numa.o | ||
| 850 | EXTLIBS += -lnuma | ||
| 851 | endif | ||
| 852 | endif | ||
| 853 | |||
| 841 | ifdef ASCIIDOC8 | 854 | ifdef ASCIIDOC8 |
| 842 | export ASCIIDOC8 | 855 | export ASCIIDOC8 |
| 843 | endif | 856 | endif |
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 3e975cb6232e..aacef07ebf31 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c | |||
| @@ -155,6 +155,7 @@ static int perf_session_env__lookup_binutils_path(struct perf_session_env *env, | |||
| 155 | if (lookup_path(buf)) | 155 | if (lookup_path(buf)) |
