perf_counter: More aggressive frequency adjustment
Commit-ID: bd2b5b12849a3446abad0b25e920f86f5480b309 Gitweb: http://git.kernel.org/tip/bd2b5b12849a3446abad0b25e920f86f5480b309 Author: Peter Zijlstra <[email protected]> AuthorDate: Wed, 10 Jun 2009 13:40:57 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 10 Jun 2009 16:55:26 +0200
perf_counter: More aggressive frequency adjustment
Also employ the overflow handler to adjust the frequency, this results in a stable frequency in about 40~50 samples, instead of that many ticks.
This also means we can start sampling at a sample period of 1 without running head-first into the throttle.
It relies on sched_clock() to accurately measure the time difference between the overflow NMIs.
Signed-off-by Peter Zijlstra <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/x86/kernel/cpu/perf_counter.c | 5 +- include/linux/perf_counter.h | 1 + kernel/perf_counter.c | 130 ++++++++++++++++++++++++------------ 3 files changed, 92 insertions(+), 44 deletions(-)
arch/x86/kernel/cpu/perf_counter.c +3 -2
@@ -696,10 +696,11 @@ static int __hw_perf_counter_init(struct perf_counter *counter)if (!attr->exclude_kernel) hwc->config |=ARCH_PERFMON_EVENTSEL_OS ; -if (!hwc->sample_period) +if (!hwc->sample_period) { hwc->sample_period = x86_pmu.max_period; +atomic64_set (&hwc->period_left, hwc->sample_period); + } -atomic64_set (&hwc->period_left, hwc->sample_period); counter->destroy = hw_perf_counter_destroy;/*
include/linux/perf_counter.h +1 -0
@@ -371,6 +371,7 @@ struct hw_perf_counter {u64 freq_count;u64 freq_interrupts; +u64 freq_stamp;#endif };
kernel/perf_counter.c +88 -42
231 lines not on this page · raw message