]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: probe: Add quiet versions of the "PROBE" macro
authorPeter Krempa <pkrempa@redhat.com>
Wed, 20 Dec 2017 11:58:36 +0000 (12:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Jan 2018 14:21:06 +0000 (15:21 +0100)
PROBE macro adds a logging entry, when used in places seeing a lot of
traffic this can cause a significant slowdown.

src/util/virprobe.h

index 1baec98f786f4d2bfa8e32a2122f1ee1ae5ad403..88cda2104f08be285f7ae678bca056830de026ea 100644 (file)
         PROBE_EXPAND(LIBVIRT_ ## NAME, \
                      VIR_ADD_CASTS(__VA_ARGS__)); \
     }
+
+#  define PROBE_QUIET(NAME, FMT, ...) \
+    if (LIBVIRT_ ## NAME ## _ENABLED()) { \
+        PROBE_EXPAND(LIBVIRT_ ## NAME, \
+                     VIR_ADD_CASTS(__VA_ARGS__)); \
+    }
 # else
 #  define PROBE(NAME, FMT, ...) \
     VIR_INFO_INT(&virLogSelf, \
                  __FILE__, __LINE__, __func__, \
                  #NAME ": " FMT, __VA_ARGS__);
+
+#  define PROBE_QUIET(NAME, FMT, ...)
 # endif
 
 #endif /* __VIR_PROBE_H__ */