perf-counter: remove initial VLOG_INFO message when performance counter is not available
authorAndy Zhou <azhou@nicira.com>
Thu, 16 Apr 2015 22:19:56 +0000 (15:19 -0700)
committerAndy Zhou <azhou@nicira.com>
Thu, 16 Apr 2015 22:27:23 +0000 (15:27 -0700)
Unit tests "corrupted database log" and "database log with bad
transaction" will fail without this patch.

Reported-by: Ansis Atteka <aatteka@nicira.com>¬
Signed-off-by: Andy Zhou <azhou@nicira.com>
lib/perf-counter.c
lib/perf-counter.h

index a6c4965..0e89999 100644 (file)
@@ -17,7 +17,7 @@
 /* This implementation only applies to the Linux platform.  */
 
 #include <config.h>
-#if defined(__linux__) && defined(HAVE_PERF_EVENT_H)
+#if defined(__linux__) && defined(HAVE_LINUX_PERF_EVENT_H)
 
 #include <stddef.h>
 #include <sys/types.h>
@@ -76,9 +76,7 @@ perf_event_setup(void)
     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);
     }
index 9cdec5b..23365de 100644 (file)
@@ -94,7 +94,7 @@
  * will work just fine.
  */
 
-#if defined(__linux__) && defined(HAVE_PERF_EVENT_H)
+#if defined(__linux__) && defined(HAVE_LINUX_PERF_EVENT_H)
 struct perf_counter {
     const char *name;
     bool once;