]> git.ipfire.org Git - thirdparty/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)
committerCole Robinson <crobinso@redhat.com>
Tue, 13 Feb 2018 19:14:16 +0000 (14:14 -0500)
PROBE macro adds a logging entry, when used in places seeing a lot of
traffic this can cause a significant slowdown.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit f06e488d5484031a76e7ed231c8fef8fa1181d2c)

src/util/virprobe.h

index 7565954af32473f2747adeb22b55f5f7ae5c8553..bd8c3296488914905112b6e38ec2900e05eb529d 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__ */