aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-24 20:24:33 +0100
committerDave Barach <openvpp@barachs.net>2019-01-24 22:43:20 +0000
commit69a1d6452f8c1130ff6d6153f6d0cde843491c08 (patch)
tree033057f6d6a05ea974e42454e5b463efc4a36983 /src
parent5f45e01f5c3ce239eccd9546e2d04fa3141ca5cb (diff)
perfmon: enable pmc event before reading rdpmc index
Change-Id: I9b0a101e5d78c10257e3c5d8f5573c3eb29bfdef Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/perfmon/perfmon_periodic.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/perfmon/perfmon_periodic.c b/src/plugins/perfmon/perfmon_periodic.c
index ae20ac4c62f..ccf3e9eed81 100644
--- a/src/plugins/perfmon/perfmon_periodic.c
+++ b/src/plugins/perfmon/perfmon_periodic.c
@@ -161,6 +161,12 @@ enable_current_events (perfmon_main_t * pm)
else
p = 0;
+ if (ioctl (fd, PERF_EVENT_IOC_RESET, 0) < 0)
+ clib_unix_warning ("reset ioctl");
+
+ if (ioctl (fd, PERF_EVENT_IOC_ENABLE, 0) < 0)
+ clib_unix_warning ("enable ioctl");
+
/*
* Software event counters - and others not capable of being
* read via the "rdpmc" instruction - will be read
@@ -171,12 +177,6 @@ enable_current_events (perfmon_main_t * pm)
else
index = p->index - 1;
- if (ioctl (fd, PERF_EVENT_IOC_RESET, 0) < 0)
- clib_unix_warning ("reset ioctl");
-
- if (ioctl (fd, PERF_EVENT_IOC_ENABLE, 0) < 0)
- clib_unix_warning ("enable ioctl");
-
pm->rdpmc_indices[i][my_thread_index] = index;
pm->perf_event_pages[i][my_thread_index] = (void *) p;
pm->pm_fds[i][my_thread_index] = fd;