diff options
author | Mike Galbraith <efault@gmx.de> | 2009-10-12 01:56:03 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-12 03:10:55 -0400 |
commit | 7e4ff9e3e8f88de8a8536f43294cd32b4e7d9123 (patch) | |
tree | 4033b2ab865ce039f0287059c520be8703a08d42 /tools/perf/builtin-record.c | |
parent | fe9081cc9bdabb0be953a39ad977cea14e35bce5 (diff) |
perf tools: Fix counter sample frequency breakage
Commit 42e59d7d19dc4b4 switched to a default sample frequency of
1KHz, which overrides any user supplied count, causing sched, top
and timechart to miss events due to their discrete events
being flagged PERF_SAMPLE_PERIOD.
Override default sample frequency when the user profides a
period count, and make both record and top honor that user
supplied option.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arjan van de Ven <arjan@infradead.org>
LKML-Reference: <1255326963.15107.2.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 59af03d80d07..4e3a374e7aa7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | static int fd[MAX_NR_CPUS][MAX_COUNTERS]; | 27 | static int fd[MAX_NR_CPUS][MAX_COUNTERS]; |
28 | 28 | ||
29 | static long default_interval = 100000; | 29 | static long default_interval = 0; |
30 | 30 | ||
31 | static int nr_cpus = 0; | 31 | static int nr_cpus = 0; |
32 | static unsigned int page_size; | 32 | static unsigned int page_size; |
@@ -730,6 +730,18 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
730 | attrs[0].config = PERF_COUNT_HW_CPU_CYCLES; | 730 | attrs[0].config = PERF_COUNT_HW_CPU_CYCLES; |
731 | } | 731 | } |
732 | 732 | ||
733 | /* | ||
734 | * User specified count overrides default frequency. | ||
735 | */ | ||
736 | if (default_interval) | ||
737 | freq = 0; | ||
738 | else if (freq) { | ||
739 | default_interval = freq; | ||
740 | } else { | ||
741 | fprintf(stderr, "frequency and count are zero, aborting\n"); | ||
742 | exit(EXIT_FAILURE); | ||
743 | } | ||
744 | |||
733 | for (counter = 0; counter < nr_counters; counter++) { | 745 | for (counter = 0; counter < nr_counters; counter++) { |
734 | if (attrs[counter].sample_period) | 746 | if (attrs[counter].sample_period) |
735 | continue; | 747 | continue; |