[libvirt] [PATCH 1/2] util: probe: Add quiet versions of the "PROBE" macro

Peter Krempa pkrempa at redhat.com
Thu Dec 21 11:16:51 UTC 2017


PROBE macro adds a loging entry, when used in places seeing a lot of
traffic this can cause a significant slowdown.
---
 src/util/virprobe.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/virprobe.h b/src/util/virprobe.h
index 1baec98f78..88cda2104f 100644
--- a/src/util/virprobe.h
+++ b/src/util/virprobe.h
@@ -90,11 +90,19 @@
         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__ */
-- 
2.15.0




More information about the libvir-list mailing list