+ 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->perf_event_pages[i][my_thread_index] = (void *) p;
+ pm->pm_fds[i][my_thread_index] = fd;
+ }
+
+ /*
+ * Hardware events must be all opened and enabled before aquiring
+ * pmc indices, otherwise the pmc indices might be out-dated.
+ */
+ for (i = 0; i < limit; i++)
+ {
+ p =
+ (struct perf_event_mmap_page *)
+ pm->perf_event_pages[i][my_thread_index];
+