*/
/* This implementation only applies to the Linux platform. */
-#ifdef __linux__
+
+#include <config.h>
+#if defined(__linux__) && defined(HAVE_LINUX_PERF_EVENT_H)
#include <stddef.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <linux/perf_event.h>
#include <asm/unistd.h>
-#include <config.h>
#include "dynamic-string.h"
-#include "openvswitch/vlog.h"
#include "perf-counter.h"
#include "shash.h"
#include "util.h"
-VLOG_DEFINE_THIS_MODULE(perf_counter);
-
-static struct shash perf_counters;
+static struct shash perf_counters = SHASH_INITIALIZER(&perf_counters);
static int fd__ = 0;
uint64_t
pe.exclude_hv = 1;
fd__ = perf_event_open(&pe, 0, -1, -1, 0);
- if (fd__ == -1) {
- VLOG_INFO("Peformance counter is not available on this platform.");
- } else {
+ if (fd__ > 0) {
ioctl(fd__, PERF_EVENT_IOC_RESET, 0);
ioctl(fd__, PERF_EVENT_IOC_ENABLE, 0);
}