From c6f72ac972d913b54b9689187be47686fe64663b Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Wed, 11 Mar 2020 18:50:38 -0400 Subject: [PATCH] Cache debugLoggingEnabled in static bools to avoid mutex thrashing --- indra/llcommon/llcallstack.h | 3 ++- indra/newview/llvovolume.cpp | 9 ++++++--- indra/newview/pipeline.cpp | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 5acf04a49fa..b12b5619857 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -80,7 +80,8 @@ struct LLContextStatus LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); #define dumpStack(tag) \ - if (debugLoggingEnabled(tag)) \ + static const bool enable_log = debugLoggingEnabled(tag); \ + if (enable_log) \ { \ LLCallStack cs; \ LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \ diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 45d2128a1c7..a78c248c33e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1517,7 +1517,8 @@ BOOL LLVOVolume::updateLOD() if (lod_changed) { - if (debugLoggingEnabled("AnimatedObjectsLinkset")) + static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset"); + if (enable_log) { if (isAnimatedObject() && isRiggedMesh()) { @@ -4452,7 +4453,8 @@ const LLMatrix4& LLVOVolume::getWorldMatrix(LLXformMatrix* xform) const void LLVOVolume::markForUpdate(BOOL priority) { - if (debugLoggingEnabled("AnimatedObjectsLinkset")) + static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset"); + if (enable_log) { if (isAnimatedObject() && isRiggedMesh()) { @@ -6063,7 +6065,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) ) { LLVOVolume* vobj = drawablep->getVOVolume(); - if (debugLoggingEnabled("AnimatedObjectsLinkset")) + static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset"); + if (enable_log) { if (vobj->isAnimatedObject() && vobj->isRiggedMesh()) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1ac71d26592..9e816a7b3bd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3355,7 +3355,8 @@ void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags f { if (drawablep && !drawablep->isDead() && assertInitialized()) { - if (debugLoggingEnabled("AnimatedObjectsLinkset")) + static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset"); + if (enable_log) { LLVOVolume *vol_obj = drawablep->getVOVolume(); if (vol_obj && vol_obj->isAnimatedObject() && vol_obj->isRiggedMesh()) -- GitLab