diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-06-24 15:12:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-25 15:39:08 -0400 |
commit | 649c48a9e7fafcc72bfcc99471d9dea98d789d59 (patch) | |
tree | 0e1e17e3c4f23d5238d650df87e16567f0e6bfb7 /tools | |
parent | e6e18ec79b023d5fe84226cef533cf0e3770ce93 (diff) |
perf-report: Add modes for inherited stats and no-samples
Now that we can collect per task statistics, add modes that
make use of that facility.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f4f0240d2302..798a56d890e5 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -41,6 +41,8 @@ static int force = 0; | |||
41 | static int append_file = 0; | 41 | static int append_file = 0; |
42 | static int call_graph = 0; | 42 | static int call_graph = 0; |
43 | static int verbose = 0; | 43 | static int verbose = 0; |
44 | static int inherit_stat = 0; | ||
45 | static int no_samples = 0; | ||
44 | 46 | ||
45 | static long samples; | 47 | static long samples; |
46 | static struct timeval last_read; | 48 | static struct timeval last_read; |
@@ -393,6 +395,12 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
393 | attr->sample_freq = freq; | 395 | attr->sample_freq = freq; |
394 | } | 396 | } |
395 | 397 | ||
398 | if (no_samples) | ||
399 | attr->sample_freq = 0; | ||
400 | |||
401 | if (inherit_stat) | ||
402 | attr->inherit_stat = 1; | ||
403 | |||
396 | if (call_graph) | 404 | if (call_graph) |
397 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | 405 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; |
398 | 406 | ||
@@ -571,7 +579,7 @@ static int __cmd_record(int argc, const char **argv) | |||
571 | } | 579 | } |
572 | } | 580 | } |
573 | 581 | ||
574 | while (!done) { | 582 | for (;;) { |
575 | int hits = samples; | 583 | int hits = samples; |
576 | 584 | ||
577 | for (i = 0; i < nr_cpu; i++) { | 585 | for (i = 0; i < nr_cpu; i++) { |
@@ -579,8 +587,11 @@ static int __cmd_record(int argc, const char **argv) | |||
579 | mmap_read(&mmap_array[i][counter]); | 587 | mmap_read(&mmap_array[i][counter]); |
580 | } | 588 | } |
581 | 589 | ||
582 | if (hits == samples) | 590 | if (hits == samples) { |
591 | if (done) | ||
592 | break; | ||
583 | ret = poll(event_array, nr_poll, 100); | 593 | ret = poll(event_array, nr_poll, 100); |
594 | } | ||
584 | } | 595 | } |
585 | 596 | ||
586 | /* | 597 | /* |
@@ -629,6 +640,10 @@ static const struct option options[] = { | |||
629 | "do call-graph (stack chain/backtrace) recording"), | 640 | "do call-graph (stack chain/backtrace) recording"), |
630 | OPT_BOOLEAN('v', "verbose", &verbose, | 641 | OPT_BOOLEAN('v', "verbose", &verbose, |
631 | "be more verbose (show counter open errors, etc)"), | 642 | "be more verbose (show counter open errors, etc)"), |
643 | OPT_BOOLEAN('s', "stat", &inherit_stat, | ||
644 | "per thread counts"), | ||
645 | OPT_BOOLEAN('n', "no-samples", &no_samples, | ||
646 | "don't sample"), | ||
632 | OPT_END() | 647 | OPT_END() |
633 | }; | 648 | }; |
634 | 649 | ||