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

Peter Krempa posted 2 patches 7 years, 11 months ago
[libvirt] [PATCH 1/2] util: probe: Add quiet versions of the "PROBE" macro
Posted by Peter Krempa 7 years, 11 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] util: probe: Add quiet versions of the "PROBE" macro
Posted by Eric Blake 7 years, 11 months ago
On 12/21/2017 05:16 AM, Peter Krempa wrote:
> PROBE macro adds a loging entry, when used in places seeing a lot of

s/loging/logging/

> traffic this can cause a significant slowdown.
> ---
>   src/util/virprobe.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list