summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.h
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-01-28 21:23:35 -0700
committerXiaohong Bao <bao@lindenlab.com>2011-01-28 21:23:35 -0700
commit125e216603e949ac97e4d8b649390f7c41a743c0 (patch)
tree4a7bfd367fd436738b13bfa6946137b300568a02 /indra/llcommon/llmemory.h
parentb4b3f78c455a614d7738c29cdc6383e857d6028d (diff)
parent948afb8ef436f661dd84e3c343e22934f92570ec (diff)
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r--indra/llcommon/llmemory.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 9bf4248bb7..11406f59b0 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -26,7 +26,7 @@
#ifndef LLMEMORY_H
#define LLMEMORY_H
-
+#include "llmemtype.h"
extern S32 gTotalDAlloc;
extern S32 gTotalDAUse;
@@ -44,10 +44,55 @@ public:
// Return the resident set size of the current process, in bytes.
// Return value is zero if not known.
static U64 getCurrentRSS();
+ static U32 getWorkingSetSize();
private:
static char* reserveMem;
};
+//----------------------------------------------------------------------------
+#if MEM_TRACK_MEM
+class LLMutex ;
+class LL_COMMON_API LLMemTracker
+{
+private:
+ LLMemTracker() ;
+ ~LLMemTracker() ;
+
+public:
+ static void release() ;
+ static LLMemTracker* getInstance() ;
+
+ void track(const char* function, const int line) ;
+ void preDraw(BOOL pause) ;
+ void postDraw() ;
+ const char* getNextLine() ;
+
+private:
+ static LLMemTracker* sInstance ;
+
+ char** mStringBuffer ;
+ S32 mCapacity ;
+ U32 mLastAllocatedMem ;
+ S32 mCurIndex ;
+ S32 mCounter;
+ S32 mDrawnIndex;
+ S32 mNumOfDrawn;
+ BOOL mPaused;
+ LLMutex* mMutexp ;
+};
+
+#define MEM_TRACK_RELEASE LLMemTracker::release() ;
+#define MEM_TRACK LLMemTracker::getInstance()->track(__FUNCTION__, __LINE__) ;
+
+#else // MEM_TRACK_MEM
+
+#define MEM_TRACK_RELEASE
+#define MEM_TRACK
+
+#endif // MEM_TRACK_MEM
+
+//----------------------------------------------------------------------------
+
// LLRefCount moved to llrefcount.h
// LLPointer moved to llpointer.h