You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-01 00:25:06 +02:00
Improve log performance, simplify macros, rename logWill() to logAny().
Pre-calculate the value used by logAny() to improve performance and make it more likely to be inlined. Move IF_LOG_ANY() into LOG_INTERNAL() to simplify the macros and improve performance of LOG() and LOG_PID(). If the message has no chance of being logged there's no reason to call logInternal(). Rename logWill() to logAny() because it seems more intuitive.
This commit is contained in:
@ -44,13 +44,13 @@ level is set to debug or trace.
|
||||
|
||||
#define FUNCTION_LOG_END_BASE() \
|
||||
stackTraceTestStart(); \
|
||||
LOG_WILL(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
||||
LOG(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
|
||||
}
|
||||
#else
|
||||
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \
|
||||
LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
|
||||
\
|
||||
if (logWill(FUNCTION_LOG_LEVEL())) \
|
||||
if (logAny(FUNCTION_LOG_LEVEL())) \
|
||||
{ \
|
||||
stackTraceParamLog();
|
||||
|
||||
@ -226,7 +226,7 @@ Macros to return function results (or void)
|
||||
\
|
||||
STACK_TRACE_POP(false); \
|
||||
\
|
||||
IF_LOG_WILL(FUNCTION_LOG_LEVEL()) \
|
||||
IF_LOG_ANY(FUNCTION_LOG_LEVEL()) \
|
||||
{ \
|
||||
char buffer[STACK_TRACE_PARAM_MAX]; \
|
||||
\
|
||||
@ -261,7 +261,7 @@ Macros to return function results (or void)
|
||||
{ \
|
||||
STACK_TRACE_POP(false); \
|
||||
\
|
||||
LOG_WILL(FUNCTION_LOG_LEVEL(), 0, "=> void"); \
|
||||
LOG(FUNCTION_LOG_LEVEL(), 0, "=> void"); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
|
Reference in New Issue
Block a user