[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1fe2a061e566c83668312ad64800768046f3ac07.1283123521.git.matt@console-pimps.org>
Date: Mon, 30 Aug 2010 13:13:44 +0100
From: Matt Fleming <matt@...sole-pimps.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Zhang Rui <rui.zhang@...el.com>, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
Robert Richter <robert.richter@....com>,
Lin Ming <ming.m.lin@...el.com>,
Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Don Zickus <dzickus@...hat.com>,
Cyrill Gorcunov <gorcunov@...il.com>,
Len Brown <lenb@...nel.org>,
Matthew Garrett <mjg59@...f.ucam.org>
Subject: [RFC][PATCH 2/5] perf: Turn the group counter values into delta values
Change the semantics of the PERF_FORMAT_GROUP records and make them
delta values, i.e. the difference in value between consecutive reads of
the hardware counters. These delta values will be used in a subsequent
patch to calculate weighted values (by multiplying the deltas with the
time difference between reads of the counters). Calculating these deltas
is easiest to do in the kernel (as opposed to the userland tools)
because we can reset the counter whenever we read from it.
Note that even though this patch changes the semantics of
PERF_FORMAT_GROUP records there were no users of them anyway (the tools
didn't even understand them).
Signed-off-by: Matt Fleming <matt@...sole-pimps.org>
---
kernel/perf_event.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 16b0476..2cda375 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3450,7 +3450,14 @@ static void perf_output_read_group(struct perf_output_handle *handle,
if (leader != event)
leader->pmu->read(leader);
+ /*
+ * Reset the counter value so that ->count contains a delta from
+ * the previous value.
+ */
values[n++] = perf_event_count(leader);
+ local64_set(&leader->count, 0);
+ atomic64_set(&leader->child_count, 0);
+
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(leader);
@@ -3463,6 +3470,9 @@ static void perf_output_read_group(struct perf_output_handle *handle,
sub->pmu->read(sub);
values[n++] = perf_event_count(sub);
+ local64_set(&sub->count, 0);
+ atomic64_set(&sub->child_count, 0);
+
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists