diff options
author | David Ahern <dsahern@gmail.com> | 2012-02-08 11:32:52 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-02-13 19:54:11 -0500 |
commit | b52956c961be3a04182ae7b776623531601e0fb7 (patch) | |
tree | 2f7ebf4a910dc8cd9014ac9df59f7e2441a5b034 /tools/perf/builtin-record.c | |
parent | eca1c3e3f937307331fd1fd5ee5205e57f2131ca (diff) |
perf tools: Allow multiple threads or processes in record, stat, top
Allow a user to collect events for multiple threads or processes
using a comma separated list.
e.g., collect data on a VM and its vhost thread:
perf top -p 21483,21485
perf stat -p 21483,21485 -ddd
perf record -p 21483,21485
or monitoring vcpu threads
perf top -t 21488,21489
perf stat -t 21488,21489 -ddd
perf record -t 21488,21489
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1328718772-16688-1-git-send-email-dsahern@gmail.com
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d6d1c6cdcfe6..08ed24b66ffe 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -645,8 +645,6 @@ static const char * const record_usage[] = { | |||
645 | */ | 645 | */ |
646 | static struct perf_record record = { | 646 | static struct perf_record record = { |
647 | .opts = { | 647 | .opts = { |
648 | .target_pid = -1, | ||
649 | .target_tid = -1, | ||
650 | .mmap_pages = UINT_MAX, | 648 | .mmap_pages = UINT_MAX, |
651 | .user_freq = UINT_MAX, | 649 | .user_freq = UINT_MAX, |
652 | .user_interval = ULLONG_MAX, | 650 | .user_interval = ULLONG_MAX, |
@@ -670,9 +668,9 @@ const struct option record_options[] = { | |||
670 | parse_events_option), | 668 | parse_events_option), |
671 | OPT_CALLBACK(0, "filter", &record.evlist, "filter", | 669 | OPT_CALLBACK(0, "filter", &record.evlist, "filter", |
672 | "event filter", parse_filter), | 670 | "event filter", parse_filter), |
673 | OPT_INTEGER('p', "pid", &record.opts.target_pid, | 671 | OPT_STRING('p', "pid", &record.opts.target_pid, "pid", |
674 | "record events on existing process id"), | 672 | "record events on existing process id"), |
675 | OPT_INTEGER('t', "tid", &record.opts.target_tid, | 673 | OPT_STRING('t', "tid", &record.opts.target_tid, "tid", |
676 | "record events on existing thread id"), | 674 | "record events on existing thread id"), |
677 | OPT_INTEGER('r', "realtime", &record.realtime_prio, | 675 | OPT_INTEGER('r', "realtime", &record.realtime_prio, |
678 | "collect data with this RT SCHED_FIFO priority"), | 676 | "collect data with this RT SCHED_FIFO priority"), |
@@ -739,7 +737,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
739 | 737 | ||
740 | argc = parse_options(argc, argv, record_options, record_usage, | 738 | argc = parse_options(argc, argv, record_options, record_usage, |
741 | PARSE_OPT_STOP_AT_NON_OPTION); | 739 | PARSE_OPT_STOP_AT_NON_OPTION); |
742 | if (!argc && rec->opts.target_pid == -1 && rec->opts.target_tid == -1 && | 740 | if (!argc && !rec->opts.target_pid && !rec->opts.target_tid && |
743 | !rec->opts.system_wide && !rec->opts.cpu_list && !rec->uid_str) | 741 | !rec->opts.system_wide && !rec->opts.cpu_list && !rec->uid_str) |
744 | usage_with_options(record_usage, record_options); | 742 | usage_with_options(record_usage, record_options); |
745 | 743 | ||
@@ -785,7 +783,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
785 | if (rec->uid_str != NULL && rec->opts.uid == UINT_MAX - 1) | 783 | if (rec->uid_str != NULL && rec->opts.uid == UINT_MAX - 1) |
786 | goto out_free_fd; | 784 | goto out_free_fd; |
787 | 785 | ||
788 | if (rec->opts.target_pid != -1) | 786 | if (rec->opts.target_pid) |
789 | rec->opts.target_tid = rec->opts.target_pid; | 787 | rec->opts.target_tid = rec->opts.target_pid; |
790 | 788 | ||
791 | if (perf_evlist__create_maps(evsel_list, rec->opts.target_pid, | 789 | if (perf_evlist__create_maps(evsel_list, rec->opts.target_pid, |