From e54d4692f6bbdabd5a1c867ac9b7df7030b5de98 Mon Sep 17 00:00:00 2001 From: Beq Date: Sat, 15 Jun 2019 21:35:31 +0100 Subject: [PATCH] Add an "enabled" guard around dumpStack Without this the logging mutex is grabbed each call which can clash with logging in other threads adding to jitter. --- indra/llcommon/llcallstack.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 5acf04a49f..b9b9d54a27 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -79,9 +79,22 @@ struct LLContextStatus LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); +// Store the check to avoid the nasty mutex monster that lies within +// Note that this won't work quite as expected if called with a variable tag +// No current use cases do this though, nor are they likely. +/* #define dumpStack(tag) \ +- if (debugLoggingEnabled(tag)) \ +- { \ +- LLCallStack cs; \ +- LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \ +- } +*/ #define dumpStack(tag) \ - if (debugLoggingEnabled(tag)) \ - { \ - LLCallStack cs; \ - LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \ - } + { static auto _isTagEnabled = debugLoggingEnabled(tag); \ + if (_isTagEnabled) \ + { \ + LLCallStack cs; \ + LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \ + } \ + } +// \ No newline at end of file