aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-10 15:03:06 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-10 16:55:26 +0200
commit4502d77c1d8f15f20c04b92cb96c12d4e465de29 (patch)
treea08bc1c29e3ed1fd04c354e30019f243e82a4d32 /tools/perf/builtin-record.c
parentbd2b5b12849a3446abad0b25e920f86f5480b309 (diff)
perf_counter tools: Small frequency related fixes
Create the counter in a disabled state and only enable it after we mmap() the buffer, this allows us to see the first few samples (and observe the frequency ramp). Furthermore, print the period in the verbose report. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index deaee42d5eb..a5698add2fc 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -347,6 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
attr->mmap = track;
attr->comm = track;
attr->inherit = (cpu < 0) && inherit;
+ attr->disabled = 1;
track = 0; /* only the first counter needs these */
@@ -402,6 +403,8 @@ try_again:
error("failed to mmap with %d (%s)\n", errno, strerror(errno));
exit(-1);
}
+
+ ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_ENABLE);
}
static void open_counters(int cpu, pid_t pid)