From 324efeb1d30f59780fd062244781ca6dae92026e Mon Sep 17 00:00:00 2001 From: Yogesh Tillu Date: Wed, 15 Jul 2015 17:38:34 +0530 Subject: Consideration of offset data member for counter. For perf_mmap case, IOCTL PERF_EVENT_IOC_RESET to work, we need to consider perf_event_mmap_page.offset data member. This observation got concluded by comparing test code on x86 platform. Signed-off-by: Yogesh Tillu Reviewed-by: Anders Roxell --- perf_rc_mmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/perf_rc_mmap.c b/perf_rc_mmap.c index 57767be..d8e0856 100644 --- a/perf_rc_mmap.c +++ b/perf_rc_mmap.c @@ -90,18 +90,17 @@ static unsigned long mmap_read_self(void *addr) struct perf_event_mmap_page *pc = addr; unsigned int seq, idx; unsigned long count; - signed long pmc = 0; do { count = 0; seq = pc->lock; barrier(); idx = pc->index; + count = pc->offset; if (idx) - pmc = rdpmc(idx - 1); + count += rdpmc(idx - 1); barrier(); } while (pc->lock != seq); - count = pmc; return count; } -- cgit v1.2.3