diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-31 14:52:24 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-31 14:52:24 -0500 |
| commit | 9d6e323c687c7b94c703c9b0900a74e5d262d462 (patch) | |
| tree | 82b6dfff0fa732cfabde42001482aad144bb3945 | |
| parent | b21c07040304b8716e38a4a0e4ab60f386357e61 (diff) | |
| parent | 4efb5290ae187514bd31af8c2d7755e175245e19 (diff) | |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf kmem: Fix statistics typo
kprobes: Fix distinct type warning
perf: Rename perf_event_hw_event in design document
perf tools: Add missing header files to LIB_H Makefile variable
perf record: We should fork only if a program was specified to run
perf diff: Fix usage array, it must end with a NULL entry
| -rw-r--r-- | kernel/kprobes.c | 2 | ||||
| -rw-r--r-- | tools/perf/Makefile | 8 | ||||
| -rw-r--r-- | tools/perf/builtin-buildid-list.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-diff.c | 3 | ||||
| -rw-r--r-- | tools/perf/builtin-kmem.c | 4 | ||||
| -rw-r--r-- | tools/perf/builtin-record.c | 14 | ||||
| -rw-r--r-- | tools/perf/builtin-report.c | 3 | ||||
| -rw-r--r-- | tools/perf/builtin-trace.c | 4 | ||||
| -rw-r--r-- | tools/perf/design.txt | 8 |
9 files changed, 29 insertions, 19 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index e5342a344c43..b7df302a0204 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
| @@ -1035,7 +1035,7 @@ int __kprobes register_kretprobe(struct kretprobe *rp) | |||
| 1035 | /* Pre-allocate memory for max kretprobe instances */ | 1035 | /* Pre-allocate memory for max kretprobe instances */ |
| 1036 | if (rp->maxactive <= 0) { | 1036 | if (rp->maxactive <= 0) { |
| 1037 | #ifdef CONFIG_PREEMPT | 1037 | #ifdef CONFIG_PREEMPT |
| 1038 | rp->maxactive = max(10, 2 * num_possible_cpus()); | 1038 | rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus()); |
| 1039 | #else | 1039 | #else |
| 1040 | rp->maxactive = num_possible_cpus(); | 1040 | rp->maxactive = num_possible_cpus(); |
| 1041 | #endif | 1041 | #endif |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 4390d225686d..652a470b5f74 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -343,13 +343,18 @@ LIB_H += util/include/linux/string.h | |||
| 343 | LIB_H += util/include/linux/types.h | 343 | LIB_H += util/include/linux/types.h |
| 344 | LIB_H += util/include/asm/asm-offsets.h | 344 | LIB_H += util/include/asm/asm-offsets.h |
| 345 | LIB_H += util/include/asm/bitops.h | 345 | LIB_H += util/include/asm/bitops.h |
| 346 | LIB_H += util/include/asm/bug.h | ||
| 346 | LIB_H += util/include/asm/byteorder.h | 347 | LIB_H += util/include/asm/byteorder.h |
| 347 | LIB_H += util/include/asm/swab.h | 348 | LIB_H += util/include/asm/swab.h |
| 348 | LIB_H += util/include/asm/system.h | 349 | LIB_H += util/include/asm/system.h |
| 349 | LIB_H += util/include/asm/uaccess.h | 350 | LIB_H += util/include/asm/uaccess.h |
| 350 | LIB_H += perf.h | 351 | LIB_H += perf.h |
| 352 | LIB_H += util/cache.h | ||
| 353 | LIB_H += util/callchain.h | ||
| 354 | LIB_H += util/debug.h | ||
| 351 | LIB_H += util/debugfs.h | 355 | LIB_H += util/debugfs.h |
| 352 | LIB_H += util/event.h | 356 | LIB_H += util/event.h |
| 357 | LIB_H += util/exec_cmd.h | ||
| 353 | LIB_H += util/types.h | 358 | LIB_H += util/types.h |
| 354 | LIB_H += util/levenshtein.h | 359 | LIB_H += util/levenshtein.h |
| 355 | LIB_H += util/parse-options.h | 360 | LIB_H += util/parse-options.h |
| @@ -362,6 +367,7 @@ LIB_H += util/session.h | |||
| 362 | LIB_H += util/strbuf.h | 367 | LIB_H += util/strbuf.h |
| 363 | LIB_H += util/string.h | 368 | LIB_H += util/string.h |
| 364 | LIB_H += util/strlist.h | 369 | LIB_H += util/strlist.h |
| 370 | LIB_H += util/svghelper.h | ||
| 365 | LIB_H += util/run-command.h | 371 | LIB_H += util/run-command.h |
| 366 | LIB_H += util/sigchain.h | 372 | LIB_H += util/sigchain.h |
| 367 | LIB_H += util/symbol.h | 373 | LIB_H += util/symbol.h |
| @@ -370,6 +376,8 @@ LIB_H += util/values.h | |||
| 370 | LIB_H += util/sort.h | 376 | LIB_H += util/sort.h |
| 371 | LIB_H += util/hist.h | 377 | LIB_H += util/hist.h |
| 372 | LIB_H += util/thread.h | 378 | LIB_H += util/thread.h |
| 379 | LIB_H += util/trace-event.h | ||
| 380 | LIB_H += util/trace-event-perl.h | ||
| 373 | LIB_H += util/probe-finder.h | 381 | LIB_H += util/probe-finder.h |
| 374 | LIB_H += util/probe-event.h | 382 | LIB_H += util/probe-event.h |
| 375 | 383 | ||
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index e693e6777af5..1e99ac806913 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | static char const *input_name = "perf.data"; | 17 | static char const *input_name = "perf.data"; |
| 18 | static int force; | 18 | static int force; |
| 19 | 19 | ||
| 20 | static const char *const buildid_list_usage[] = { | 20 | static const char * const buildid_list_usage[] = { |
| 21 | "perf buildid-list [<options>]", | 21 | "perf buildid-list [<options>]", |
| 22 | NULL | 22 | NULL |
| 23 | }; | 23 | }; |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4d33b55d5584..bd71b8ceafb7 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
| @@ -189,8 +189,9 @@ out_delete: | |||
| 189 | return ret; | 189 | return ret; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static const char *const diff_usage[] = { | 192 | static const char * const diff_usage[] = { |
| 193 | "perf diff [<options>] [old_file] [new_file]", | 193 | "perf diff [<options>] [old_file] [new_file]", |
| 194 | NULL, | ||
| 194 | }; | 195 | }; |
| 195 | 196 | ||
| 196 | static const struct option options[] = { | 197 | static const struct option options[] = { |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index fc21ad79dd83..7ceb7416c316 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
| @@ -137,7 +137,7 @@ static void insert_alloc_stat(unsigned long call_site, unsigned long ptr, | |||
| 137 | if (data && data->ptr == ptr) { | 137 | if (data && data->ptr == ptr) { |
| 138 | data->hit++; | 138 | data->hit++; |
| 139 | data->bytes_req += bytes_req; | 139 | data->bytes_req += bytes_req; |
| 140 | data->bytes_alloc += bytes_req; | 140 | data->bytes_alloc += bytes_alloc; |
| 141 | } else { | 141 | } else { |
| 142 | data = malloc(sizeof(*data)); | 142 | data = malloc(sizeof(*data)); |
| 143 | if (!data) | 143 | if (!data) |
| @@ -177,7 +177,7 @@ static void insert_caller_stat(unsigned long call_site, | |||
| 177 | if (data && data->call_site == call_site) { | 177 | if (data && data->call_site == call_site) { |
| 178 | data->hit++; | 178 | data->hit++; |
| 179 | data->bytes_req += bytes_req; | 179 | data->bytes_req += bytes_req; |
| 180 | data->bytes_alloc += bytes_req; | 180 | data->bytes_alloc += bytes_alloc; |
| 181 | } else { | 181 | } else { |
| 182 | data = malloc(sizeof(*data)); | 182 | data = malloc(sizeof(*data)); |
| 183 | if (!data) | 183 | if (!data) |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 63136d0534d4..265425322734 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -402,7 +402,7 @@ static void atexit_header(void) | |||
| 402 | perf_header__write(&session->header, output, true); | 402 | perf_header__write(&session->header, output, true); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | static int __cmd_record(int argc __used, const char **argv) | 405 | static int __cmd_record(int argc, const char **argv) |
| 406 | { | 406 | { |
| 407 | int i, counter; | 407 | int i, counter; |
| 408 | struct stat st; | 408 | struct stat st; |
| @@ -411,6 +411,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
| 411 | int err; | 411 | int err; |
| 412 | unsigned long waking = 0; | 412 | unsigned long waking = 0; |
| 413 | int child_ready_pipe[2], go_pipe[2]; | 413 | int child_ready_pipe[2], go_pipe[2]; |
| 414 | const bool forks = target_pid == -1 && argc > 0; | ||
| 414 | char buf; | 415 | char buf; |
| 415 | 416 | ||
| 416 | page_size = sysconf(_SC_PAGE_SIZE); | 417 | page_size = sysconf(_SC_PAGE_SIZE); |
| @@ -422,7 +423,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
| 422 | signal(SIGCHLD, sig_handler); | 423 | signal(SIGCHLD, sig_handler); |
| 423 | signal(SIGINT, sig_handler); | 424 | signal(SIGINT, sig_handler); |
| 424 | 425 | ||
| 425 | if (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0) { | 426 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { |
| 426 | perror("failed to create pipes"); | 427 | perror("failed to create pipes"); |
| 427 | exit(-1); | 428 | exit(-1); |
| 428 | } | 429 | } |
| @@ -483,7 +484,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
| 483 | 484 | ||
| 484 | atexit(atexit_header); | 485 | atexit(atexit_header); |
| 485 | 486 | ||
| 486 | if (target_pid == -1) { | 487 | if (forks) { |
| 487 | pid = fork(); | 488 | pid = fork(); |
| 488 | if (pid < 0) { | 489 | if (pid < 0) { |
| 489 | perror("failed to fork"); | 490 | perror("failed to fork"); |
| @@ -550,7 +551,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
| 550 | return err; | 551 | return err; |
| 551 | } | 552 | } |
| 552 | 553 | ||
| 553 | if (!system_wide) | 554 | if (!system_wide && profile_cpu == -1) |
| 554 | event__synthesize_thread(pid, process_synthesized_event, | 555 | event__synthesize_thread(pid, process_synthesized_event, |
| 555 | session); | 556 | session); |
| 556 | else | 557 | else |
| @@ -569,7 +570,8 @@ static int __cmd_record(int argc __used, const char **argv) | |||
| 569 | /* | 570 | /* |
| 570 | * Let the child rip | 571 | * Let the child rip |
| 571 | */ | 572 | */ |
| 572 | close(go_pipe[1]); | 573 | if (forks) |
| 574 | close(go_pipe[1]); | ||
| 573 | 575 | ||
| 574 | for (;;) { | 576 | for (;;) { |
| 575 | int hits = samples; | 577 | int hits = samples; |
| @@ -667,7 +669,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
| 667 | 669 | ||
| 668 | argc = parse_options(argc, argv, options, record_usage, | 670 | argc = parse_options(argc, argv, options, record_usage, |
| 669 | PARSE_OPT_STOP_AT_NON_OPTION); | 671 | PARSE_OPT_STOP_AT_NON_OPTION); |
| 670 | if (!argc && target_pid == -1 && (!system_wide || profile_cpu == -1)) | 672 | if (!argc && target_pid == -1 && !system_wide && profile_cpu == -1) |
| 671 | usage_with_options(record_usage, options); | 673 | usage_with_options(record_usage, options); |
| 672 | 674 | ||
| 673 | symbol__init(); | 675 | symbol__init(); |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 5c2ab5357ec6..db10c0e8ecae 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -294,8 +294,7 @@ setup: | |||
| 294 | return 0; | 294 | return 0; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | //static const char * const report_usage[] = { | 297 | static const char * const report_usage[] = { |
| 298 | const char * const report_usage[] = { | ||
| 299 | "perf report [<options>] <command>", | 298 | "perf report [<options>] <command>", |
| 300 | NULL | 299 | NULL |
| 301 | }; | 300 | }; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index e2285e28720f..574a215e800b 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -512,7 +512,7 @@ static char *get_script_path(const char *script_root, const char *suffix) | |||
| 512 | return path; | 512 | return path; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | static const char * const annotate_usage[] = { | 515 | static const char * const trace_usage[] = { |
| 516 | "perf trace [<options>] <command>", | 516 | "perf trace [<options>] <command>", |
| 517 | NULL | 517 | NULL |
| 518 | }; | 518 | }; |
| @@ -581,7 +581,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
| 581 | 581 | ||
| 582 | setup_scripting(); | 582 | setup_scripting(); |
| 583 | 583 | ||
| 584 | argc = parse_options(argc, argv, options, annotate_usage, | 584 | argc = parse_options(argc, argv, options, trace_usage, |
| 585 | PARSE_OPT_STOP_AT_NON_OPTION); | 585 | PARSE_OPT_STOP_AT_NON_OPTION); |
| 586 | 586 | ||
| 587 | if (symbol__init() < 0) | 587 | if (symbol__init() < 0) |
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. |
