Skip to contentSkip to conversation

perf: Reimplement frequency driven sampling

tip:perf/core tip-bot for Peter Zijlstra 1 participant 1 message Jan 27, 2010 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  abd50713944c8ea9e0af5b7bffa0aacae21cc91a
Gitweb:     http://git.kernel.org/tip/abd50713944c8ea9e0af5b7bffa0aacae21cc91a
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Tue, 26 Jan 2010 18:50:16 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 27 Jan 2010 08:39:33 +0100

perf: Reimplement frequency driven sampling

There was a bug in the old period code that caused intel_pmu_enable_all() or native_write_msr_safe() to show up quite high in the profiles.

In staring at that code it made my head hurt, so I rewrote it in a hopefully simpler fashion. Its now fully symetric between tick and overflow driven adjustments and uses less data to boot.

The only complication is that it basically wants to do a u128 division. The code approximates that in a rather simple truncate until it fits fashion, taking care to balance the terms while truncating.

This version does not generate that sampling artefact.

LKML-Reference: <new-submission>

---
 include/linux/perf_event.h |    5 +-
 kernel/perf_event.c        |  132 ++++++++++++++++++++++++++++++-------------
 2 files changed, 94 insertions(+), 43 deletions(-)
include/linux/perf_event.h +2 -3
index c6f812e..72b2615 100644
@@ -498,9 +498,8 @@ struct hw_perf_event {
 	atomic64_t			period_left;
 	u64				interrupts;
 
-	u64				freq_count;
-	u64				freq_interrupts;
-	u64				freq_stamp;
+	u64				freq_time_stamp;
+	u64				freq_count_stamp;
 #endif
 };
 
kernel/perf_event.c +92 -40

175 lines not on this page · raw message