diff options
Diffstat (limited to 'indra/llcommon')
| -rwxr-xr-x | indra/llcommon/llmemory.cpp | 137 | ||||
| -rwxr-xr-x | indra/llcommon/llmemory.h | 45 | ||||
| -rw-r--r-- | indra/llcommon/lltrace.h | 3 | ||||
| -rw-r--r-- | indra/llcommon/llunit.h | 5 | 
4 files changed, 7 insertions, 183 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 diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 95500753e4..a24d97576f 100755 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -184,51 +184,6 @@ private:  	static BOOL sEnableMemoryFailurePrevention;  }; -//---------------------------------------------------------------------------- -#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 - -//---------------------------------------------------------------------------- - -  //  //class LLPrivateMemoryPool defines a private memory pool for an application to use, so the application does not  //need to access the heap directly fro each memory allocation. Throught this, the allocation speed is faster,  diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 2c45923aac..2c84b1596a 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -61,6 +61,7 @@ public:  	virtual const char* getUnitLabel();  	const std::string& getName() const { return mName; } +	const std::string& getDescription() const { return mDescription; }  protected:  	const std::string	mName; @@ -169,7 +170,7 @@ public:  	typedef TraceType<CountAccumulator> trace_t;  	CountStatHandle(const char* name, const char* description = NULL)  -	:	trace_t(name) +	:	trace_t(name, description)  	{}  	/*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); } diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index c9bbed5574..79465715cf 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -571,6 +571,11 @@ LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, * 1000);  LL_DECLARE_BASE_UNIT(Radians, "rad");  LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 0.01745329251994); +LL_DECLARE_BASE_UNIT(Percent, "%"); +LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100); + +LL_DECLARE_BASE_UNIT(Triangles, "tris"); +LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, * 1000);  } // namespace LLUnits | 
