[PATCH 05/10] perf: Unroll perf_event_read_value() in perf_read_group()
Sukadev Bhattiprolu
sukadev at linux.vnet.ibm.com
Mon Jul 27 15:40:33 AEST 2015
Unroll the calls to perf_event_read_value() in perf_read_group()
so we can later optimize out parts we don't need for group events.
Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
---
kernel/events/core.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a6bd09d..0ce3012 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3794,7 +3794,14 @@ static int perf_read_group(struct perf_event *event,
lockdep_assert_held(&ctx->mutex);
- count = perf_event_read_value(leader, &enabled, &running);
+ enabled = running = 0;
+
+ mutex_lock(&leader->child_mutex);
+
+ perf_event_read(leader);
+ count = perf_event_aggregate(leader, &enabled, &running);
+
+ mutex_unlock(&leader->child_mutex);
values[n++] = 1 + leader->nr_siblings;
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
@@ -3815,7 +3822,13 @@ static int perf_read_group(struct perf_event *event,
list_for_each_entry(sub, &leader->sibling_list, group_entry) {
n = 0;
- values[n++] = perf_event_read_value(sub, &enabled, &running);
+ mutex_lock(&leader->child_mutex);
+
+ perf_event_read(sub);
+ values[n++] = perf_event_aggregate(sub, &enabled, &running);
+
+ mutex_unlock(&leader->child_mutex);
+
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub);
--
1.7.9.5
More information about the Linuxppc-dev
mailing list