util: probe: Add quiet versions of the "PROBE" macro

PROBE macro adds a logging entry, when used in places seeing a lot of
traffic this can cause a significant slowdown.
This commit is contained in:
Peter Krempa 2017-12-20 12:58:36 +01:00
parent c1a6e2fb43
commit f06e488d54

View File

@ -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__ */