From 04bdc8ba83c297945dd60489c241b88adf892ff4 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 1 Jul 2013 17:04:01 -0700
Subject: SH-4294 FIX Interesting: Statistics Texture cache hit rate is always
 0% also, removed LLTrace::init and cleanup removed derived class
 implementation of memory stat for LLMemTrackable is automatic now

---
 indra/llimage/llimage.cpp                  | 13 ++++---------
 indra/llimage/llimage.h                    |  2 --
 indra/llimage/tests/llimageworker_test.cpp |  8 --------
 3 files changed, 4 insertions(+), 19 deletions(-)

(limited to 'indra/llimage')

diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 50df2ebe55..395e6a6cc5 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -50,7 +50,6 @@ LLMutex* LLImage::sMutex = NULL;
 bool LLImage::sUseNewByteRange = false;
 S32  LLImage::sMinimalReverseByteRangePercent = 75;
 LLPrivateMemoryPool* LLImageBase::sPrivatePoolp = NULL ;
-LLTrace::MemStatHandle	LLImageBase::sMemStat("LLImage");
 
 //static
 void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
@@ -159,9 +158,8 @@ void LLImageBase::sanityCheck()
 void LLImageBase::deleteData()
 {
 	FREE_MEM(sPrivatePoolp, mData) ;
-	memDisclaimAmount(mDataSize);
+	memDisclaimAmount(mDataSize) = 0;
 	mData = NULL;
-	mDataSize = 0;
 }
 
 // virtual
@@ -225,9 +223,7 @@ U8* LLImageBase::reallocateData(S32 size)
 		FREE_MEM(sPrivatePoolp, mData) ;
 	}
 	mData = new_datap;
-	memDisclaimAmount(mDataSize);
-	mDataSize = size;
-	memClaimAmount(mDataSize);
+	memClaimAmount(memDisclaimAmount(mDataSize) = size);
 	return mData;
 }
 
@@ -1612,9 +1608,8 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8*
 void LLImageBase::setDataAndSize(U8 *data, S32 size)
 { 
 	ll_assert_aligned(data, 16);
-	memDisclaimAmount(mDataSize);
-	mData = data; mDataSize = size; 
-	memClaimAmount(mDataSize);
+	mData = data; 
+	memClaimAmount(memDisclaimAmount(mDataSize) = size); 
 }	
 
 //static
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 504b7e4795..b2bfdba3f8 100755
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -165,8 +165,6 @@ public:
 	static void destroyPrivatePool() ;
 	static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;}
 
-	static LLTrace::MemStatHandle sMemStat;
-
 private:
 	U8 *mData;
 	S32 mDataSize;
diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp
index b6f2694742..7d7e9e036e 100755
--- a/indra/llimage/tests/llimageworker_test.cpp
+++ b/indra/llimage/tests/llimageworker_test.cpp
@@ -44,9 +44,6 @@
 // * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
 // * A simulator for a class can be implemented here. Please comment and document thoroughly.
 
-LLTrace::MemStatHandle	LLImageBase::sMemStat("LLImage");
-
-
 LLImageBase::LLImageBase() 
 : mData(NULL),
 mDataSize(0),
@@ -115,17 +112,14 @@ namespace tut
 	{
 		// Instance to be tested
 		LLImageDecodeThread* mThread;
-
 		// Constructor and destructor of the test wrapper
 		imagedecodethread_test()
 		{
-			LLTrace::init();
 			mThread = NULL;
 		}
 		~imagedecodethread_test()
 		{
 			delete mThread;
-			LLTrace::cleanup();
 		}
 	};
 
@@ -143,7 +137,6 @@ namespace tut
 		imagerequest_test()
 		{
 			done = false;
-			LLTrace::init();
 
 			mRequest = new LLImageDecodeThread::ImageRequest(0, 0,
 											 LLQueuedThread::PRIORITY_NORMAL, 0, FALSE,
@@ -154,7 +147,6 @@ namespace tut
 			// We should delete the object *but*, because its destructor is protected, that cannot be
 			// done from outside an LLImageDecodeThread instance... So we leak memory here... It's fine...
 			//delete mRequest;
-			LLTrace::cleanup();
 		}
 	};
 
-- 
cgit v1.2.3