summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogesh Tillu <yogesh.tillu@linaro.org>2015-07-20 14:23:03 +0530
committerYogesh Tillu <yogesh.tillu@linaro.org>2015-07-21 13:13:39 +0530
commita8b75a4ec9ebfd1b2bb141aca08ff2adaef5b578 (patch)
treebdc08401fc4c944b48a8f5c5a0818e1902bc74c4
parent324efeb1d30f59780fd062244781ca6dae92026e (diff)
Cleaup : Initialization of perf event attributes
Signed-off-by: Yogesh Tillu <yogesh.tillu@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
-rw-r--r--perf_rc_mmap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/perf_rc_mmap.c b/perf_rc_mmap.c
index d8e0856..4f55765 100644
--- a/perf_rc_mmap.c
+++ b/perf_rc_mmap.c
@@ -54,9 +54,14 @@ static int counter_init(unsigned int counter,long unsigned int sample)
printf("Error: SIGIO signal handler %s\n",strerror(errno));
}
attr.sample_period = sample;
+ memset(&attr,0,sizeof(struct perf_event_attr));
+ attr.size = sizeof(struct perf_event_attr);
attr.sample_type = PERF_SAMPLE_IP;
attr.wakeup_events = 1;
attr.config = counter;
+ attr.mmap = 1;
+ attr.watermark = 0;
+ attr.disabled = 1;
fddev = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
if (fddev == -1) {
fprintf(stderr,