diff options
Diffstat (limited to 'indra/llcommon/lltraceaccumulators.h')
-rw-r--r-- | indra/llcommon/lltraceaccumulators.h | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 4fe84455a6..5cba3e5360 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -52,7 +52,7 @@ namespace LLTrace class AccumulatorBuffer : public LLRefCount { typedef AccumulatorBuffer<ACCUMULATOR> self_t; - static const U32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; + static const S32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; private: struct StaticAllocationMarker { }; @@ -95,7 +95,7 @@ namespace LLTrace void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other, EBufferAppendType append_type) { - llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) { mStorage[i].addSamples(other.mStorage[i], append_type); @@ -104,7 +104,7 @@ namespace LLTrace void copyFrom(const AccumulatorBuffer<ACCUMULATOR>& other) { - llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) { mStorage[i] = other.mStorage[i]; @@ -223,7 +223,7 @@ namespace LLTrace typedef F64 value_t; EventAccumulator() - : mSum(NaN), + : mSum(0), mMin(NaN), mMax(NaN), mMean(NaN), @@ -267,7 +267,7 @@ namespace LLTrace F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } F64 getSumOfSquares() const { return mSumOfSquares; } - U32 getSampleCount() const { return mNumSamples; } + S32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mNumSamples > 0; } private: @@ -279,7 +279,7 @@ namespace LLTrace F64 mMean, mSumOfSquares; - U32 mNumSamples; + S32 mNumSamples; }; @@ -352,7 +352,7 @@ namespace LLTrace F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } F64 getSumOfSquares() const { return mSumOfSquares; } F64SecondsImplicit getSamplingTime() { return mTotalSamplingTime; } - U32 getSampleCount() const { return mNumSamples; } + S32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mHasValue; } private: @@ -370,7 +370,7 @@ namespace LLTrace mLastSampleTimeStamp, mTotalSamplingTime; - U32 mNumSamples; + S32 mNumSamples; }; class CountAccumulator @@ -389,7 +389,7 @@ namespace LLTrace mSum += value; } - void addSamples(const CountAccumulator& other, bool /*follows_in_sequence*/) + void addSamples(const CountAccumulator& other, EBufferAppendType /*type*/) { mSum += other.mSum; mNumSamples += other.mNumSamples; @@ -405,12 +405,12 @@ namespace LLTrace F64 getSum() const { return mSum; } - U32 getSampleCount() const { return mNumSamples; } + S32 getSampleCount() const { return mNumSamples; } private: F64 mSum; - U32 mNumSamples; + S32 mNumSamples; }; class TimeBlockAccumulator @@ -422,7 +422,7 @@ namespace LLTrace // fake classes that allows us to view different facets of underlying statistic struct CallCountFacet { - typedef U32 value_t; + typedef S32 value_t; }; struct SelfTimeFacet @@ -451,7 +451,7 @@ namespace LLTrace // U64 mTotalTimeCounter, mSelfTimeCounter; - U32 mCalls; + S32 mCalls; class TimeBlock* mParent; // last acknowledged parent of this time block class TimeBlock* mLastCaller; // used to bootstrap tree construction U16 mActiveCount; // number of timers with this ID active on stack @@ -515,8 +515,11 @@ namespace LLTrace void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { - mAllocated.addSamples(other.mAllocated, append_type); - mDeallocated.addSamples(other.mDeallocated, append_type); + mFootprintAllocations.addSamples(other.mFootprintAllocations, append_type); + mFootprintDeallocations.addSamples(other.mFootprintDeallocations, append_type); + mShadowAllocations.addSamples(other.mShadowAllocations, append_type); + mShadowDeallocations.addSamples(other.mShadowDeallocations, append_type); + if (append_type == SEQUENTIAL) { mSize.addSamples(other.mSize, SEQUENTIAL); @@ -524,12 +527,12 @@ namespace LLTrace } else { - F64 allocation_delta(other.mAllocated.getSum() - other.mDeallocated.getSum()); + F64 allocation_delta(other.mFootprintAllocations.getSum() - other.mFootprintDeallocations.getSum()); mSize.sample(mSize.hasValue() ? mSize.getLastValue() + allocation_delta : allocation_delta); - F64 shadow_allocation_delta(other.mShadowAllocated.getSum() - other.mShadowDeallocated.getSum()); + F64 shadow_allocation_delta(other.mShadowAllocations.getSum() - other.mShadowDeallocations.getSum()); mShadowSize.sample(mShadowSize.hasValue() ? mShadowSize.getLastValue() + shadow_allocation_delta : shadow_allocation_delta); @@ -540,10 +543,10 @@ namespace LLTrace { mSize.reset(other ? &other->mSize : NULL); mShadowSize.reset(other ? &other->mShadowSize : NULL); - mAllocated.reset(other ? &other->mAllocated : NULL); - mDeallocated.reset(other ? &other->mDeallocated : NULL); - mShadowAllocated.reset(other ? &other->mShadowAllocated : NULL); - mShadowDeallocated.reset(other ? &other->mShadowDeallocated : NULL); + mFootprintAllocations.reset(other ? &other->mFootprintAllocations : NULL); + mFootprintDeallocations.reset(other ? &other->mFootprintDeallocations : NULL); + mShadowAllocations.reset(other ? &other->mShadowAllocations : NULL); + mShadowDeallocations.reset(other ? &other->mShadowDeallocations : NULL); } void sync(F64SecondsImplicit time_stamp) @@ -554,10 +557,10 @@ namespace LLTrace SampleAccumulator mSize, mShadowSize; - CountAccumulator mAllocated, - mDeallocated, - mShadowAllocated, - mShadowDeallocated; + EventAccumulator mFootprintAllocations, + mShadowAllocations; + CountAccumulator mFootprintDeallocations, + mShadowDeallocations; }; struct AccumulatorBufferGroup : public LLRefCount |