Skip to contentSkip to conversation

perf_counter: Add PERF_EVENT_READ

tip:perfcounters/urgent tip-bot for Peter Zijlstra 1 participant 1 message Jun 25, 2009

lore
Share & tools
lore
#0 lore raw
Commit-ID:  38b200d67636a30cb8dc1508137908e7a649b5c9
Gitweb:     http://git.kernel.org/tip/38b200d67636a30cb8dc1508137908e7a649b5c9
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Tue, 23 Jun 2009 20:13:11 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 25 Jun 2009 21:39:07 +0200

perf_counter: Add PERF_EVENT_READ

Provide a read() like event which can be used to log the counter value at specific sites such as child->parent folding on exit.

In order to be useful, we log the counter parent ID, not the actual counter ID, since userspace can only relate parent IDs to perf_counter_attr constructs.

LKML-Reference: <new-submission>

---
 include/linux/perf_counter.h |   12 +++++++
 kernel/perf_counter.c        |   72 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 80 insertions(+), 4 deletions(-)
include/linux/perf_counter.h +12 -0
index bcbf1c4..6a384f0 100644
@@ -335,6 +335,18 @@ enum perf_event_type {
 	PERF_EVENT_FORK			= 7,
 
 	/*
+	 * struct {
+	 * 	struct perf_event_header	header;
+	 * 	u32				pid, tid;
+	 * 	u64				value;
+	 * 	{ u64		time_enabled; 	} && PERF_FORMAT_ENABLED
+	 * 	{ u64		time_running; 	} && PERF_FORMAT_RUNNING
+	 * 	{ u64		parent_id;	} && PERF_FORMAT_ID
+	 * };
+	 */
+	PERF_EVENT_READ			= 8,
+
+	/*
 	 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
 	 * will be PERF_SAMPLE_*
 	 *
kernel/perf_counter.c +68 -4

105 lines not on this page · raw message