summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-07-08 00:55:17 -0700
committerRichard Linden <none@none>2013-07-08 00:55:17 -0700
commitd122318bef2ff0eced7641dc24f411f792bd2935 (patch)
tree7c5bfc2c60058d6f87ad9c18c08f844424f3efc9 /indra/llcommon/llmemory.cpp
parentbc7d2b76961c0397dcd108e625db4304855f4539 (diff)
SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics console
added percentage/ratio units added auto-range and auto tick calculation to stat bar to automate display stats
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rwxr-xr-xindra/llcommon/llmemory.cpp137
1 files changed, 0 insertions, 137 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index c6b02df939..3fe7470d06 100755
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -27,9 +27,7 @@
#include "linden_common.h"
-//#if MEM_TRACK_MEM
#include "llthread.h"
-//#endif
#if defined(LL_WINDOWS)
# include <psapi.h>
@@ -422,141 +420,6 @@ U32 LLMemory::getWorkingSetSize()
#endif
//--------------------------------------------------------------------------------------------------
-#if MEM_TRACK_MEM
-#include "llframetimer.h"
-
-//static
-LLMemTracker* LLMemTracker::sInstance = NULL ;
-
-LLMemTracker::LLMemTracker()
-{
- mLastAllocatedMem = LLMemory::getWorkingSetSize() ;
- mCapacity = 128 ;
- mCurIndex = 0 ;
- mCounter = 0 ;
- mDrawnIndex = 0 ;
- mPaused = FALSE ;
-
- mMutexp = new LLMutex() ;
- mStringBuffer = new char*[128] ;
- mStringBuffer[0] = new char[mCapacity * 128] ;
- for(S32 i = 1 ; i < mCapacity ; i++)
- {
- mStringBuffer[i] = mStringBuffer[i-1] + 128 ;
- }
-}
-
-LLMemTracker::~LLMemTracker()
-{
- delete[] mStringBuffer[0] ;
- delete[] mStringBuffer;
- delete mMutexp ;
-}
-
-//static
-LLMemTracker* LLMemTracker::getInstance()
-{
- if(!sInstance)
- {
- sInstance = new LLMemTracker() ;
- }
- return sInstance ;
-}
-
-//static
-void LLMemTracker::release()
-{
- if(sInstance)
- {
- delete sInstance ;
- sInstance = NULL ;
- }
-}
-
-//static
-void LLMemTracker::track(const char* function, const int line)
-{
- static const S32 MIN_ALLOCATION = 0 ; //1KB
-
- if(mPaused)
- {
- return ;
- }
-
- U32 allocated_mem = LLMemory::getWorkingSetSize() ;
-
- LLMutexLock lock(mMutexp) ;
-
- S32 delta_mem = allocated_mem - mLastAllocatedMem ;
- mLastAllocatedMem = allocated_mem ;
-
- if(delta_mem <= 0)
- {
- return ; //occupied memory does not grow
- }
-
- if(delta_mem < MIN_ALLOCATION)
- {
- return ;
- }
-
- char* buffer = mStringBuffer[mCurIndex++] ;
- F32 time = (F32)LLFrameTimer::getElapsedSeconds() ;
- S32 hours = (S32)(time / (60*60));
- S32 mins = (S32)((time - hours*(60*60)) / 60);
- S32 secs = (S32)((time - hours*(60*60) - mins*60));
- strcpy(buffer, function) ;
- sprintf(buffer + strlen(function), " line: %d DeltaMem: %d (bytes) Time: %d:%02d:%02d", line, delta_mem, hours,mins,secs) ;
-
- if(mCounter < mCapacity)
- {
- mCounter++ ;
- }
- if(mCurIndex >= mCapacity)
- {
- mCurIndex = 0 ;
- }
-}
-
-
-//static
-void LLMemTracker::preDraw(BOOL pause)
-{
- mMutexp->lock() ;
-
- mPaused = pause ;
- mDrawnIndex = mCurIndex - 1;
- mNumOfDrawn = 0 ;
-}
-
-//static
-void LLMemTracker::postDraw()
-{
- mMutexp->unlock() ;
-}
-
-//static
-const char* LLMemTracker::getNextLine()
-{
- if(mNumOfDrawn >= mCounter)
- {
- return NULL ;
- }
- mNumOfDrawn++;
-
- if(mDrawnIndex < 0)
- {
- mDrawnIndex = mCapacity - 1 ;
- }
-
- return mStringBuffer[mDrawnIndex--] ;
-}
-
-#endif //MEM_TRACK_MEM
-//--------------------------------------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//minimum slot size and minimal slot size interval
const U32 ATOMIC_MEM_SLOT = 16 ; //bytes