From d5a20f55e0cbb2a98b2cd1a4e7c3c21a207e8507 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 7 May 2022 21:46:49 -0400
Subject: [PATCH] Hide a few hot debug messages

---
 indra/llcommon/llprocess.cpp             | 6 ++++++
 indra/llcommon/llsingleton.cpp           | 4 ++++
 indra/llcorehttp/_httppolicy.cpp         | 6 ++++++
 indra/llimagej2coj/llimagej2coj.cpp      | 6 ++++++
 indra/llmessage/llcoproceduremanager.cpp | 4 ++++
 5 files changed, 26 insertions(+)

diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index 7d2ea809e34..e40d95f9565 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -217,6 +217,7 @@ class WritePipeImpl: public LLProcess::WritePipe
 					remainptr += written;
 					remainlen -= written;
 
+#if SHOW_DEBUG
 					char msgbuf[512];
 					LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite
 										   << " bytes to " << mDesc
@@ -224,6 +225,7 @@ class WritePipeImpl: public LLProcess::WritePipe
 										   << " code " << err << ": "
 										   << apr_strerror(err, msgbuf, sizeof(msgbuf))
 										   << LL_ENDL;
+#endif
 
 					// The parent end of this pipe is nonblocking. If we weren't able
 					// to write everything we wanted, don't keep banging on it -- that
@@ -386,7 +388,9 @@ class ReadPipeImpl: public LLProcess::ReadPipe
 					// Handle EOF specially: it's part of normal-case processing.
 					if (err == APR_EOF)
 					{
+#if SHOW_DEBUG
 						LL_DEBUGS("LLProcess") << "EOF on " << mDesc << LL_ENDL;
+#endif
 					}
 					else
 					{
@@ -406,8 +410,10 @@ class ReadPipeImpl: public LLProcess::ReadPipe
 				// received. Make sure we commit those later. (Don't commit them
 				// now, that would invalidate the buffer iterator sequence!)
 				tocommit += gotten;
+#if SHOW_DEBUG
 				LL_DEBUGS("LLProcess") << "filled " << gotten << " of " << toread
 									   << " bytes from " << mDesc << LL_ENDL;
+#endif
 
 				// The parent end of this pipe is nonblocking. If we weren't even
 				// able to fill this buffer, don't loop to try to fill the next --
diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp
index 9b89fac8185..4cabaf5e58c 100644
--- a/indra/llcommon/llsingleton.cpp
+++ b/indra/llcommon/llsingleton.cpp
@@ -270,6 +270,7 @@ void LLSingletonBase::reset_initializing(list_t::size_type size)
 
 void LLSingletonBase::MasterList::LockedInitializing::log(const char* verb, const char* name)
 {
+#if SHOW_DEBUG
         LL_DEBUGS("LLSingleton") << verb << ' ' << demangle(name) << ';';
         if (mList)
         {
@@ -281,6 +282,7 @@ void LLSingletonBase::MasterList::LockedInitializing::log(const char* verb, cons
             }
         }
         LL_ENDL;
+#endif
 }
 
 void LLSingletonBase::capture_dependency()
@@ -471,7 +473,9 @@ void LLSingletonBase::loginfos(const string_params& args)
 //static
 void LLSingletonBase::logdebugs(const string_params& args)
 {
+#if SHOW_DEBUG
     LL_DEBUGS("LLSingleton") << args << LL_ENDL;
+#endif
 }
 
 //static
diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp
index ff364bc7418..9044639735d 100644
--- a/indra/llcorehttp/_httppolicy.cpp
+++ b/indra/llcorehttp/_httppolicy.cpp
@@ -281,9 +281,11 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue()
 					if (now >= state.mThrottleEnd)
 					{
 						// Throttle expired, move to next window
+#ifdef SHOW_DEBUG
 						LL_DEBUGS(LOG_CORE) << "Throttle expired with " << state.mThrottleLeft
 											<< " requests to go and " << state.mRequestCount
 											<< " requests issued." << LL_ENDL;
+#endif
 						state.mThrottleLeft = state.mOptions.mThrottleRate;
 						state.mThrottleEnd = now + HttpTime(1000000);
 					}
@@ -310,9 +312,11 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue()
 					if (now >= state.mThrottleEnd)
 					{
 						// Throttle expired, move to next window
+#ifdef SHOW_DEBUG
 						LL_DEBUGS(LOG_CORE) << "Throttle expired with " << state.mThrottleLeft
 											<< " requests to go and " << state.mRequestCount
 											<< " requests issued." << LL_ENDL;
+#endif
 						state.mThrottleLeft = state.mOptions.mThrottleRate;
 						state.mThrottleEnd = now + HttpTime(1000000);
 					}
@@ -443,12 +447,14 @@ bool HttpPolicy::stageAfterCompletion(const HttpOpRequest::ptr_t &op)
 						   << " (" << op->mStatus.toTerseString() << ")"
 						   << LL_ENDL;
 	}
+#ifdef SHOW_DEBUG
 	else if (op->mPolicyRetries)
 	{
         LL_DEBUGS(LOG_CORE) << "HTTP request " << op->getHandle()
 							<< " succeeded on retry " << op->mPolicyRetries << "."
 							<< LL_ENDL;
 	}
+#endif
 
 	op->stageFromActive(mService);
 
diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp
index 0f1c9917e9a..64f43e13b62 100644
--- a/indra/llimagej2coj/llimagej2coj.cpp
+++ b/indra/llimagej2coj/llimagej2coj.cpp
@@ -253,7 +253,9 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
 	opj_codec_t* opj_decoder_p = opj_create_decompress(OPJ_CODEC_J2K);
 	if (!opj_decoder_p)
 	{
+#ifdef SHOW_DEBUG
 		LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to create decoder!" << LL_ENDL;
+#endif
 		base.decodeFailed();
 		return true; // done
 	}
@@ -268,7 +270,9 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
 	/* setup the decoder decoding parameters using user parameters */
 	if (!opj_setup_decoder(opj_decoder_p, &parameters))
 	{
+#ifdef SHOW_DEBUG
 		LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image!" << LL_ENDL;
+#endif
 		opj_destroy_codec(opj_decoder_p);
 		base.decodeFailed();
 		return true; // done
@@ -300,7 +304,9 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
 	// dereference the array.
 	if (!success || !image || !image->numcomps)
 	{
+#ifdef SHOW_DEBUG
 		LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image!" << LL_ENDL;
+#endif
 		if (image)
 		{
 			opj_image_destroy(image);
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index 5c25440610f..a143786c6b2 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -415,7 +415,9 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
         --mPending;
         mActiveCoprocsCount++;
 
+#ifdef SHOW_DEBUG
         LL_DEBUGS("CoProcMgr") << "Dequeued and invoking coprocedure(" << coproc->mName << ") with id=" << coproc->mId.asString() << " in pool \"" << mPoolName << "\" (" << mPending << " left)" << LL_ENDL;
+#endif
 
         try
         {
@@ -437,7 +439,9 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
             continue;
         }
 
+#ifdef SHOW_DEBUG
         LL_DEBUGS("CoProcMgr") << "Finished coprocedure(" << coproc->mName << ")" << " in pool \"" << mPoolName << "\"" << LL_ENDL;
+#endif
 
         mActiveCoprocsCount--;
     }
-- 
GitLab