diff options
author | Richard Linden <none@none> | 2013-03-25 00:18:06 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-03-25 00:18:06 -0700 |
commit | 935dce7d6b0a343cef5b13f53d6da5d0c2dc6a73 (patch) | |
tree | 1517fc3ea00f29a5c64050cb4fc756dec30caf63 /indra/llcommon/lltrace.h | |
parent | 68f9f656cd22332e46959a90347e38f79c19a66c (diff) |
SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
fixed some compile errors
made label spacing automatic on stat bars
fixed infinite values coming from stats
Diffstat (limited to 'indra/llcommon/lltrace.h')
-rw-r--r-- | indra/llcommon/lltrace.h | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 71bf1e53e4..a574be02da 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -86,20 +86,17 @@ private: AccumulatorBuffer(StaticAllocationMarker m) : mStorageSize(0), - mStorage(NULL), - mNextStorageSlot(0) - { - } + mStorage(NULL) + {} public: AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) : mStorageSize(0), - mStorage(NULL), - mNextStorageSlot(other.mNextStorageSlot) + mStorage(NULL) { resize(other.mStorageSize); - for (S32 i = 0; i < mNextStorageSlot; i++) + for (S32 i = 0; i < sNextStorageSlot; i++) { mStorage[i] = other.mStorage[i]; } @@ -126,9 +123,8 @@ public: void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other) { - llassert(mNextStorageSlot == other.mNextStorageSlot); - - for (size_t i = 0; i < mNextStorageSlot; i++) + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) { mStorage[i].addSamples(other.mStorage[i]); } @@ -136,7 +132,8 @@ public: void copyFrom(const AccumulatorBuffer<ACCUMULATOR>& other) { - for (size_t i = 0; i < mNextStorageSlot; i++) + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) { mStorage[i] = other.mStorage[i]; } @@ -144,7 +141,8 @@ public: void reset(const AccumulatorBuffer<ACCUMULATOR>* other = NULL) { - for (size_t i = 0; i < mNextStorageSlot; i++) + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) { mStorage[i].reset(other ? &other->mStorage[i] : NULL); } @@ -172,7 +170,7 @@ public: { llerrs << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << llendl; } - size_t next_slot = mNextStorageSlot++; + size_t next_slot = sNextStorageSlot++; if (next_slot >= mStorageSize) { resize(mStorageSize + (mStorageSize >> 2)); @@ -208,7 +206,7 @@ public: size_t size() const { - return mNextStorageSlot; + return sNextStorageSlot; } static self_t* getDefaultBuffer() @@ -226,11 +224,15 @@ public: } private: - ACCUMULATOR* mStorage; - size_t mStorageSize; - size_t mNextStorageSlot; + ACCUMULATOR* mStorage; + size_t mStorageSize; + static size_t sNextStorageSlot; }; +template<typename ACCUMULATOR> size_t AccumulatorBuffer<ACCUMULATOR>::sNextStorageSlot = 0; + + + //TODO: replace with decltype when C++11 is enabled template<typename T> struct MeanValueType |