From 8bddaeec6647e735415f9bd72a4e1313e11fe720 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 22 Jun 2013 12:00:18 -0700 Subject: fixed scene load monitor resetting to eagerly due to spurious camer amotion pulled swap() out of ui time block cleaned up internal lltrace dependencies, factored out common accumulator definitions --- indra/llcommon/lltraceaccumulators.h | 648 +++++++++++++++++++++++++++++++++++ 1 file changed, 648 insertions(+) create mode 100644 indra/llcommon/lltraceaccumulators.h (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h new file mode 100644 index 0000000000..7994dcc217 --- /dev/null +++ b/indra/llcommon/lltraceaccumulators.h @@ -0,0 +1,648 @@ +/** + * @file lltraceaccumulators.h + * @brief Storage for accumulating statistics + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACEACCUMULATORS_H +#define LL_LLTRACEACCUMULATORS_H + + +#include "stdtypes.h" +#include "llpreprocessor.h" +#include "llunit.h" +#include "lltimer.h" +#include "llrefcount.h" + +namespace LLTrace +{ + + template + class AccumulatorBuffer : public LLRefCount + { + typedef AccumulatorBuffer self_t; + static const U32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 64; + private: + struct StaticAllocationMarker { }; + + AccumulatorBuffer(StaticAllocationMarker m) + : mStorageSize(0), + mStorage(NULL) + {} + + public: + + AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) + : mStorageSize(0), + mStorage(NULL) + { + resize(other.mStorageSize); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + + ~AccumulatorBuffer() + { + if (isPrimary()) + { + LLThreadLocalSingletonPointer::setInstance(NULL); + } + delete[] mStorage; + } + + LL_FORCE_INLINE ACCUMULATOR& operator[](size_t index) + { + return mStorage[index]; + } + + LL_FORCE_INLINE const ACCUMULATOR& operator[](size_t index) const + { + return mStorage[index]; + } + + void addSamples(const AccumulatorBuffer& other, bool append = true) + { + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].addSamples(other.mStorage[i], append); + } + } + + void copyFrom(const AccumulatorBuffer& other) + { + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + + void reset(const AccumulatorBuffer* other = NULL) + { + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].reset(other ? &other->mStorage[i] : NULL); + } + } + + void flush(LLUnitImplicit time_stamp) + { + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].flush(time_stamp); + } + } + + void makePrimary() + { + LLThreadLocalSingletonPointer::setInstance(mStorage); + } + + bool isPrimary() const + { + return LLThreadLocalSingletonPointer::getInstance() == mStorage; + } + + LL_FORCE_INLINE static ACCUMULATOR* getPrimaryStorage() + { + ACCUMULATOR* accumulator = LLThreadLocalSingletonPointer::getInstance(); + return accumulator ? accumulator : getDefaultBuffer()->mStorage; + } + + // NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned + size_t reserveSlot() + { +#ifndef LL_RELEASE_FOR_DOWNLOAD + if (LLTrace::isInitialized()) + { + llerrs << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << llendl; + } +#endif + size_t next_slot = sNextStorageSlot++; + if (next_slot >= mStorageSize) + { + resize(mStorageSize + (mStorageSize >> 2)); + } + llassert(mStorage && next_slot < mStorageSize); + return next_slot; + } + + void resize(size_t new_size) + { + if (new_size <= mStorageSize) return; + + ACCUMULATOR* old_storage = mStorage; + mStorage = new ACCUMULATOR[new_size]; + if (old_storage) + { + for (S32 i = 0; i < mStorageSize; i++) + { + mStorage[i] = old_storage[i]; + } + } + mStorageSize = new_size; + delete[] old_storage; + + self_t* default_buffer = getDefaultBuffer(); + if (this != default_buffer + && new_size > default_buffer->size()) + { + //NB: this is not thread safe, but we assume that all resizing occurs during static initialization + default_buffer->resize(new_size); + } + } + + size_t size() const + { + return getNumIndices(); + } + + static size_t getNumIndices() + { + return sNextStorageSlot; + } + + static self_t* getDefaultBuffer() + { + static bool sInitialized = false; + if (!sInitialized) + { + // this buffer is allowed to leak so that trace calls from global destructors have somewhere to put their data + // so as not to trigger an access violation + sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker()); + sInitialized = true; + sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); + } + return sDefaultBuffer; + } + + private: + ACCUMULATOR* mStorage; + size_t mStorageSize; + static size_t sNextStorageSlot; + static self_t* sDefaultBuffer; + }; + + template size_t AccumulatorBuffer::sNextStorageSlot = 0; + template AccumulatorBuffer* AccumulatorBuffer::sDefaultBuffer = NULL; + + + class EventAccumulator + { + public: + typedef F64 value_t; + typedef F64 mean_t; + + EventAccumulator() + : mSum(0), + mMin((std::numeric_limits::max)()), + mMax((std::numeric_limits::min)()), + mMean(0), + mVarianceSum(0), + mNumSamples(0), + mLastValue(0) + {} + + void record(F64 value) + { + mNumSamples++; + mSum += value; + // NOTE: both conditions will hold on first pass through + if (value < mMin) + { + mMin = value; + } + if (value > mMax) + { + mMax = value; + } + F64 old_mean = mMean; + mMean += (value - old_mean) / (F64)mNumSamples; + mVarianceSum += (value - old_mean) * (value - mMean); + mLastValue = value; + } + + void addSamples(const EventAccumulator& other, bool append) + { + if (other.mNumSamples) + { + mSum += other.mSum; + + // NOTE: both conditions will hold first time through + if (other.mMin < mMin) { mMin = other.mMin; } + if (other.mMax > mMax) { mMax = other.mMax; } + + // combine variance (and hence standard deviation) of 2 different sized sample groups using + // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm + F64 n_1 = (F64)mNumSamples, + n_2 = (F64)other.mNumSamples; + F64 m_1 = mMean, + m_2 = other.mMean; + F64 v_1 = mVarianceSum / mNumSamples, + v_2 = other.mVarianceSum / other.mNumSamples; + if (n_1 == 0) + { + mVarianceSum = other.mVarianceSum; + } + else if (n_2 == 0) + { + // don't touch variance + // mVarianceSum = mVarianceSum; + } + else + { + mVarianceSum = (F64)mNumSamples + * ((((n_1 - 1.f) * v_1) + + ((n_2 - 1.f) * v_2) + + (((n_1 * n_2) / (n_1 + n_2)) + * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) + / (n_1 + n_2 - 1.f)); + } + + F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); + mNumSamples += other.mNumSamples; + mMean = mMean * weight + other.mMean * (1.f - weight); + if (append) mLastValue = other.mLastValue; + } + } + + void reset(const EventAccumulator* other) + { + mNumSamples = 0; + mSum = 0; + mMin = std::numeric_limits::max(); + mMax = std::numeric_limits::min(); + mMean = 0; + mVarianceSum = 0; + mLastValue = other ? other->mLastValue : 0; + } + + void flush(LLUnitImplicit) {} + + F64 getSum() const { return mSum; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } + U32 getSampleCount() const { return mNumSamples; } + + private: + F64 mSum, + mMin, + mMax, + mLastValue; + + F64 mMean, + mVarianceSum; + + U32 mNumSamples; + }; + + + class SampleAccumulator + { + public: + typedef F64 value_t; + typedef F64 mean_t; + + SampleAccumulator() + : mSum(0), + mMin((std::numeric_limits::max)()), + mMax((std::numeric_limits::min)()), + mMean(0), + mVarianceSum(0), + mLastSampleTimeStamp(LLTimer::getTotalSeconds()), + mTotalSamplingTime(0), + mNumSamples(0), + mLastValue(0), + mHasValue(false) + {} + + void sample(F64 value) + { + LLUnitImplicit time_stamp = LLTimer::getTotalSeconds(); + LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; + mLastSampleTimeStamp = time_stamp; + + if (mHasValue) + { + mTotalSamplingTime += delta_time; + mSum += mLastValue * delta_time; + + // NOTE: both conditions will hold first time through + if (value < mMin) { mMin = value; } + if (value > mMax) { mMax = value; } + + F64 old_mean = mMean; + mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); + mVarianceSum += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); + } + + mLastValue = value; + mNumSamples++; + mHasValue = true; + } + + void addSamples(const SampleAccumulator& other, bool append) + { + if (other.mTotalSamplingTime) + { + mSum += other.mSum; + + // NOTE: both conditions will hold first time through + if (other.mMin < mMin) { mMin = other.mMin; } + if (other.mMax > mMax) { mMax = other.mMax; } + + // combine variance (and hence standard deviation) of 2 different sized sample groups using + // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm + F64 n_1 = mTotalSamplingTime, + n_2 = other.mTotalSamplingTime; + F64 m_1 = mMean, + m_2 = other.mMean; + F64 v_1 = mVarianceSum / mTotalSamplingTime, + v_2 = other.mVarianceSum / other.mTotalSamplingTime; + if (n_1 == 0) + { + mVarianceSum = other.mVarianceSum; + } + else if (n_2 == 0) + { + // variance is unchanged + // mVarianceSum = mVarianceSum; + } + else + { + mVarianceSum = mTotalSamplingTime + * ((((n_1 - 1.f) * v_1) + + ((n_2 - 1.f) * v_2) + + (((n_1 * n_2) / (n_1 + n_2)) + * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) + / (n_1 + n_2 - 1.f)); + } + + llassert(other.mTotalSamplingTime > 0); + F64 weight = mTotalSamplingTime / (mTotalSamplingTime + other.mTotalSamplingTime); + mNumSamples += other.mNumSamples; + mTotalSamplingTime += other.mTotalSamplingTime; + mMean = (mMean * weight) + (other.mMean * (1.0 - weight)); + if (append) + { + mLastValue = other.mLastValue; + mLastSampleTimeStamp = other.mLastSampleTimeStamp; + mHasValue |= other.mHasValue; + } + } + } + + void reset(const SampleAccumulator* other) + { + mNumSamples = 0; + mSum = 0; + mMin = std::numeric_limits::max(); + mMax = std::numeric_limits::min(); + mMean = other ? other->mLastValue : 0; + mVarianceSum = 0; + mLastSampleTimeStamp = LLTimer::getTotalSeconds(); + mTotalSamplingTime = 0; + mLastValue = other ? other->mLastValue : 0; + mHasValue = other ? other->mHasValue : false; + } + + void flush(LLUnitImplicit time_stamp) + { + LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; + + if (mHasValue) + { + mSum += mLastValue * delta_time; + mTotalSamplingTime += delta_time; + } + mLastSampleTimeStamp = time_stamp; + } + + F64 getSum() const { return mSum; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mTotalSamplingTime); } + U32 getSampleCount() const { return mNumSamples; } + + private: + F64 mSum, + mMin, + mMax, + mLastValue; + + bool mHasValue; + + F64 mMean, + mVarianceSum; + + LLUnitImplicit mLastSampleTimeStamp, + mTotalSamplingTime; + + U32 mNumSamples; + }; + + class CountAccumulator + { + public: + typedef F64 value_t; + typedef F64 mean_t; + + CountAccumulator() + : mSum(0), + mNumSamples(0) + {} + + void add(F64 value) + { + mNumSamples++; + mSum += value; + } + + void addSamples(const CountAccumulator& other, bool /*append*/) + { + mSum += other.mSum; + mNumSamples += other.mNumSamples; + } + + void reset(const CountAccumulator* other) + { + mNumSamples = 0; + mSum = 0; + } + + void flush(LLUnitImplicit) {} + + F64 getSum() const { return mSum; } + + U32 getSampleCount() const { return mNumSamples; } + + private: + F64 mSum; + + U32 mNumSamples; + }; + + class TimeBlockAccumulator + { + public: + typedef LLUnit value_t; + typedef LLUnit mean_t; + typedef TimeBlockAccumulator self_t; + + // fake classes that allows us to view different facets of underlying statistic + struct CallCountFacet + { + typedef U32 value_t; + typedef F32 mean_t; + }; + + struct SelfTimeFacet + { + typedef LLUnit value_t; + typedef LLUnit mean_t; + }; + + TimeBlockAccumulator(); + void addSamples(const self_t& other, bool /*append*/); + void reset(const self_t* other); + void flush(LLUnitImplicit) {} + + // + // members + // + U64 mStartTotalTimeCounter, + mTotalTimeCounter, + mSelfTimeCounter; + U32 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 + bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame + + }; + + class TimeBlock; + class TimeBlockTreeNode + { + public: + TimeBlockTreeNode(); + + void setParent(TimeBlock* parent); + TimeBlock* getParent() { return mParent; } + + TimeBlock* mBlock; + TimeBlock* mParent; + std::vector mChildren; + bool mCollapsed; + bool mNeedsSorting; + }; + + struct MemStatAccumulator + { + typedef MemStatAccumulator self_t; + + // fake classes that allows us to view different facets of underlying statistic + struct AllocationCountFacet + { + typedef U32 value_t; + typedef F32 mean_t; + }; + + struct DeallocationCountFacet + { + typedef U32 value_t; + typedef F32 mean_t; + }; + + struct ChildMemFacet + { + typedef LLUnit value_t; + typedef LLUnit mean_t; + }; + + MemStatAccumulator() + : mAllocatedCount(0), + mDeallocatedCount(0) + {} + + void addSamples(const MemStatAccumulator& other, bool append) + { + mSize.addSamples(other.mSize, append); + mChildSize.addSamples(other.mChildSize, append); + mAllocatedCount += other.mAllocatedCount; + mDeallocatedCount += other.mDeallocatedCount; + } + + void reset(const MemStatAccumulator* other) + { + mSize.reset(other ? &other->mSize : NULL); + mChildSize.reset(other ? &other->mChildSize : NULL); + mAllocatedCount = 0; + mDeallocatedCount = 0; + } + + void flush(LLUnitImplicit time_stamp) + { + mSize.flush(time_stamp); + mChildSize.flush(time_stamp); + } + + SampleAccumulator mSize, + mChildSize; + int mAllocatedCount, + mDeallocatedCount; + }; + + struct AccumulatorBufferGroup : public LLRefCount + { + AccumulatorBufferGroup(); + + void handOffTo(AccumulatorBufferGroup& other); + void makePrimary(); + bool isPrimary() const; + + void append(const AccumulatorBufferGroup& other); + void merge(const AccumulatorBufferGroup& other); + void reset(AccumulatorBufferGroup* other = NULL); + void flush(); + + AccumulatorBuffer mCounts; + AccumulatorBuffer mSamples; + AccumulatorBuffer mEvents; + AccumulatorBuffer mStackTimers; + AccumulatorBuffer mMemStats; + }; +} + +#endif // LL_LLTRACEACCUMULATORS_H + -- cgit v1.2.3 From 808d3eff198d65e5a870abb670786935fc8356bd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 27 Jun 2013 00:07:21 -0700 Subject: SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics console fixed some lltrace logic errors more consistent syncing of timestamps of sample values in recording stack selection of primary buffers was completely incorrect assignment of recordings got wrong play state due to implicit operator = defined in base class fixed asset stats only working up to the first send --- indra/llcommon/lltraceaccumulators.h | 37 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 7994dcc217..825cc9e3a8 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -109,12 +109,12 @@ namespace LLTrace } } - void flush(LLUnitImplicit time_stamp) + void sync(LLUnitImplicit time_stamp) { llassert(mStorageSize >= sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) { - mStorage[i].flush(time_stamp); + mStorage[i].sync(time_stamp); } } @@ -128,6 +128,11 @@ namespace LLTrace return LLThreadLocalSingletonPointer::getInstance() == mStorage; } + static void clearPrimary() + { + LLThreadLocalSingletonPointer::setInstance(NULL); + } + LL_FORCE_INLINE static ACCUMULATOR* getPrimaryStorage() { ACCUMULATOR* accumulator = LLThreadLocalSingletonPointer::getInstance(); @@ -302,7 +307,7 @@ namespace LLTrace mLastValue = other ? other->mLastValue : 0; } - void flush(LLUnitImplicit) {} + void sync(LLUnitImplicit) {} F64 getSum() const { return mSum; } F64 getMin() const { return mMin; } @@ -434,7 +439,7 @@ namespace LLTrace mHasValue = other ? other->mHasValue : false; } - void flush(LLUnitImplicit time_stamp) + void sync(LLUnitImplicit time_stamp) { LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; @@ -500,7 +505,7 @@ namespace LLTrace mSum = 0; } - void flush(LLUnitImplicit) {} + void sync(LLUnitImplicit) {} F64 getSum() const { return mSum; } @@ -535,7 +540,7 @@ namespace LLTrace TimeBlockAccumulator(); void addSamples(const self_t& other, bool /*append*/); void reset(const self_t* other); - void flush(LLUnitImplicit) {} + void sync(LLUnitImplicit) {} // // members @@ -566,6 +571,13 @@ namespace LLTrace bool mCollapsed; bool mNeedsSorting; }; + + struct BlockTimerStackRecord + { + class BlockTimer* mActiveTimer; + class TimeBlock* mTimeBlock; + U64 mChildTime; + }; struct MemStatAccumulator { @@ -611,16 +623,16 @@ namespace LLTrace mDeallocatedCount = 0; } - void flush(LLUnitImplicit time_stamp) + void sync(LLUnitImplicit time_stamp) { - mSize.flush(time_stamp); - mChildSize.flush(time_stamp); + mSize.sync(time_stamp); + mChildSize.sync(time_stamp); } SampleAccumulator mSize, - mChildSize; + mChildSize; int mAllocatedCount, - mDeallocatedCount; + mDeallocatedCount; }; struct AccumulatorBufferGroup : public LLRefCount @@ -630,11 +642,12 @@ namespace LLTrace void handOffTo(AccumulatorBufferGroup& other); void makePrimary(); bool isPrimary() const; + static void clearPrimary(); void append(const AccumulatorBufferGroup& other); void merge(const AccumulatorBufferGroup& other); void reset(AccumulatorBufferGroup* other = NULL); - void flush(); + void sync(); AccumulatorBuffer mCounts; AccumulatorBuffer mSamples; -- cgit v1.2.3 From 04bdc8ba83c297945dd60489c241b88adf892ff4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Jul 2013 17:04:01 -0700 Subject: SH-4294 FIX Interesting: Statistics Texture cache hit rate is always 0% also, removed LLTrace::init and cleanup removed derived class implementation of memory stat for LLMemTrackable is automatic now --- indra/llcommon/lltraceaccumulators.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 825cc9e3a8..fac6347ff9 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -33,6 +33,7 @@ #include "llunit.h" #include "lltimer.h" #include "llrefcount.h" +#include "llthreadlocalstorage.h" namespace LLTrace { @@ -142,12 +143,6 @@ namespace LLTrace // NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned size_t reserveSlot() { -#ifndef LL_RELEASE_FOR_DOWNLOAD - if (LLTrace::isInitialized()) - { - llerrs << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << llendl; - } -#endif size_t next_slot = sNextStorageSlot++; if (next_slot >= mStorageSize) { -- cgit v1.2.3 From 11e14cd3b0f58225a96b9b7a9839a7f030fe4045 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Jul 2013 11:05:57 -0700 Subject: SH-4299Interesting: High fps shown temporarily off scale in statistics console various fixes to lltrace start() on started recording no longer resets fixed various instances of unit forgetfullness in lltrace recording split now has gapless timing scene monitor now guarantees min sample time renamed a bunch of stats added names to debug thread view on windows --- indra/llcommon/lltraceaccumulators.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index fac6347ff9..a2f9f4c090 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -37,7 +37,6 @@ namespace LLTrace { - template class AccumulatorBuffer : public LLRefCount { -- cgit v1.2.3 From e40065f82c797eab41006a448c838f4f1089a2e8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Jul 2013 15:03:05 -0700 Subject: BUILDFIX: #include and dependency cleanup --- indra/llcommon/lltraceaccumulators.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index a2f9f4c090..efc8b43f6a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -34,6 +34,7 @@ #include "lltimer.h" #include "llrefcount.h" #include "llthreadlocalstorage.h" +#include namespace LLTrace { -- cgit v1.2.3 From 50c472c24216ad0c3890cb8bb9cf638e75642f0c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Jul 2013 18:47:16 -0700 Subject: renamed mVarianceSum to mSumOfSquares to be more clear fixed normalization assertions to work with megaprims added is_zero() utility function fixed unit declarations to be more clear fixed texture cache hit rate always being 0 --- indra/llcommon/lltraceaccumulators.h | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index efc8b43f6a..b1aa078f9a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -223,7 +223,7 @@ namespace LLTrace mMin((std::numeric_limits::max)()), mMax((std::numeric_limits::min)()), mMean(0), - mVarianceSum(0), + mSumOfSquares(0), mNumSamples(0), mLastValue(0) {} @@ -243,7 +243,7 @@ namespace LLTrace } F64 old_mean = mMean; mMean += (value - old_mean) / (F64)mNumSamples; - mVarianceSum += (value - old_mean) * (value - mMean); + mSumOfSquares += (value - old_mean) * (value - mMean); mLastValue = value; } @@ -263,20 +263,20 @@ namespace LLTrace n_2 = (F64)other.mNumSamples; F64 m_1 = mMean, m_2 = other.mMean; - F64 v_1 = mVarianceSum / mNumSamples, - v_2 = other.mVarianceSum / other.mNumSamples; + F64 v_1 = mSumOfSquares / mNumSamples, + v_2 = other.mSumOfSquares / other.mNumSamples; if (n_1 == 0) { - mVarianceSum = other.mVarianceSum; + mSumOfSquares = other.mSumOfSquares; } else if (n_2 == 0) { // don't touch variance - // mVarianceSum = mVarianceSum; + // mSumOfSquares = mSumOfSquares; } else { - mVarianceSum = (F64)mNumSamples + mSumOfSquares = (F64)mNumSamples * ((((n_1 - 1.f) * v_1) + ((n_2 - 1.f) * v_2) + (((n_1 * n_2) / (n_1 + n_2)) @@ -298,7 +298,7 @@ namespace LLTrace mMin = std::numeric_limits::max(); mMax = std::numeric_limits::min(); mMean = 0; - mVarianceSum = 0; + mSumOfSquares = 0; mLastValue = other ? other->mLastValue : 0; } @@ -309,7 +309,7 @@ namespace LLTrace F64 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } - F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } + F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } U32 getSampleCount() const { return mNumSamples; } private: @@ -319,7 +319,7 @@ namespace LLTrace mLastValue; F64 mMean, - mVarianceSum; + mSumOfSquares; U32 mNumSamples; }; @@ -336,7 +336,7 @@ namespace LLTrace mMin((std::numeric_limits::max)()), mMax((std::numeric_limits::min)()), mMean(0), - mVarianceSum(0), + mSumOfSquares(0), mLastSampleTimeStamp(LLTimer::getTotalSeconds()), mTotalSamplingTime(0), mNumSamples(0), @@ -361,7 +361,7 @@ namespace LLTrace F64 old_mean = mMean; mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); - mVarianceSum += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); + mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); } mLastValue = value; @@ -385,20 +385,20 @@ namespace LLTrace n_2 = other.mTotalSamplingTime; F64 m_1 = mMean, m_2 = other.mMean; - F64 v_1 = mVarianceSum / mTotalSamplingTime, - v_2 = other.mVarianceSum / other.mTotalSamplingTime; + F64 v_1 = mSumOfSquares / mTotalSamplingTime, + v_2 = other.mSumOfSquares / other.mTotalSamplingTime; if (n_1 == 0) { - mVarianceSum = other.mVarianceSum; + mSumOfSquares = other.mSumOfSquares; } else if (n_2 == 0) { // variance is unchanged - // mVarianceSum = mVarianceSum; + // mSumOfSquares = mSumOfSquares; } else { - mVarianceSum = mTotalSamplingTime + mSumOfSquares = mTotalSamplingTime * ((((n_1 - 1.f) * v_1) + ((n_2 - 1.f) * v_2) + (((n_1 * n_2) / (n_1 + n_2)) @@ -427,7 +427,7 @@ namespace LLTrace mMin = std::numeric_limits::max(); mMax = std::numeric_limits::min(); mMean = other ? other->mLastValue : 0; - mVarianceSum = 0; + mSumOfSquares = 0; mLastSampleTimeStamp = LLTimer::getTotalSeconds(); mTotalSamplingTime = 0; mLastValue = other ? other->mLastValue : 0; @@ -451,7 +451,7 @@ namespace LLTrace F64 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } - F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mTotalSamplingTime); } + F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } U32 getSampleCount() const { return mNumSamples; } private: @@ -463,7 +463,7 @@ namespace LLTrace bool mHasValue; F64 mMean, - mVarianceSum; + mSumOfSquares; LLUnitImplicit mLastSampleTimeStamp, mTotalSamplingTime; -- cgit v1.2.3 From 1e8f9fd80d0ac4e0eab656ed8e8e32f91ab8b533 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 24 Jul 2013 19:36:43 -0700 Subject: SH-4376 FIX: Interesting: in Statistics, replace the text "0" with "n/a" when there are no samples during the time period. added hasValue to SampleAccumulator so we don't print a value when we don't have a single sample yet added some disabled log output for scene load timing --- indra/llcommon/lltraceaccumulators.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index b1aa078f9a..9ea787188c 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -453,6 +453,7 @@ namespace LLTrace F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } U32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return mHasValue; } private: F64 mSum, -- cgit v1.2.3 From 8d3daa141e9ea14f533559843d77ab5c0f715421 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 16:14:19 -0700 Subject: SH-4374 FIX Interesting: Statistics Object cache hit rate is always 100% moved object cache sampling code so that it actually gets executed default values for stats are NaN instead of 0 in many cases --- indra/llcommon/lltraceaccumulators.h | 291 ++++++++++++----------------------- 1 file changed, 97 insertions(+), 194 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 9ea787188c..5871dc4bea 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -38,6 +38,14 @@ namespace LLTrace { + const F64 NaN = std::numeric_limits::quiet_NaN(); + + enum EBufferAppendType + { + SEQUENTIAL, + NON_SEQUENTIAL + }; + template class AccumulatorBuffer : public LLRefCount { @@ -83,12 +91,12 @@ namespace LLTrace return mStorage[index]; } - void addSamples(const AccumulatorBuffer& other, bool append = true) + void addSamples(const AccumulatorBuffer& other, EBufferAppendType append_type) { llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize > sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) { - mStorage[i].addSamples(other.mStorage[i], append); + mStorage[i].addSamples(other.mStorage[i], append_type); } } @@ -211,7 +219,6 @@ namespace LLTrace template size_t AccumulatorBuffer::sNextStorageSlot = 0; template AccumulatorBuffer* AccumulatorBuffer::sDefaultBuffer = NULL; - class EventAccumulator { public: @@ -219,98 +226,51 @@ namespace LLTrace typedef F64 mean_t; EventAccumulator() - : mSum(0), - mMin((std::numeric_limits::max)()), - mMax((std::numeric_limits::min)()), - mMean(0), + : mSum(NaN), + mMin(NaN), + mMax(NaN), + mMean(NaN), mSumOfSquares(0), mNumSamples(0), - mLastValue(0) + mLastValue(NaN) {} void record(F64 value) { - mNumSamples++; - mSum += value; - // NOTE: both conditions will hold on first pass through - if (value < mMin) + if (mNumSamples == 0) { + mSum = value; + mMean = value; mMin = value; - } - if (value > mMax) - { mMax = value; } - F64 old_mean = mMean; - mMean += (value - old_mean) / (F64)mNumSamples; - mSumOfSquares += (value - old_mean) * (value - mMean); - mLastValue = value; - } - - void addSamples(const EventAccumulator& other, bool append) - { - if (other.mNumSamples) + else { - mSum += other.mSum; - - // NOTE: both conditions will hold first time through - if (other.mMin < mMin) { mMin = other.mMin; } - if (other.mMax > mMax) { mMax = other.mMax; } - - // combine variance (and hence standard deviation) of 2 different sized sample groups using - // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm - F64 n_1 = (F64)mNumSamples, - n_2 = (F64)other.mNumSamples; - F64 m_1 = mMean, - m_2 = other.mMean; - F64 v_1 = mSumOfSquares / mNumSamples, - v_2 = other.mSumOfSquares / other.mNumSamples; - if (n_1 == 0) - { - mSumOfSquares = other.mSumOfSquares; - } - else if (n_2 == 0) - { - // don't touch variance - // mSumOfSquares = mSumOfSquares; - } - else - { - mSumOfSquares = (F64)mNumSamples - * ((((n_1 - 1.f) * v_1) - + ((n_2 - 1.f) * v_2) - + (((n_1 * n_2) / (n_1 + n_2)) - * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) - / (n_1 + n_2 - 1.f)); - } + mSum += value; + F64 old_mean = mMean; + mMean += (value - old_mean) / (F64)mNumSamples; + mSumOfSquares += (value - old_mean) * (value - mMean); - F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); - mNumSamples += other.mNumSamples; - mMean = mMean * weight + other.mMean * (1.f - weight); - if (append) mLastValue = other.mLastValue; + if (value < mMin) { mMin = value; } + else if (value > mMax) { mMax = value; } } - } - void reset(const EventAccumulator* other) - { - mNumSamples = 0; - mSum = 0; - mMin = std::numeric_limits::max(); - mMax = std::numeric_limits::min(); - mMean = 0; - mSumOfSquares = 0; - mLastValue = other ? other->mLastValue : 0; + mNumSamples++; + mLastValue = value; } + void addSamples(const EventAccumulator& other, EBufferAppendType append_type); + void reset(const EventAccumulator* other); void sync(LLUnitImplicit) {} - F64 getSum() const { return mSum; } - F64 getMin() const { return mMin; } - F64 getMax() const { return mMax; } - F64 getLastValue() const { return mLastValue; } - F64 getMean() const { return mMean; } + F64 getSum() const { return mSum; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } - U32 getSampleCount() const { return mNumSamples; } + U32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return mNumSamples > 0; } private: F64 mSum, @@ -333,143 +293,85 @@ namespace LLTrace SampleAccumulator() : mSum(0), - mMin((std::numeric_limits::max)()), - mMax((std::numeric_limits::min)()), - mMean(0), + mMin(NaN), + mMax(NaN), + mMean(NaN), mSumOfSquares(0), - mLastSampleTimeStamp(LLTimer::getTotalSeconds()), + mLastSampleTimeStamp(0), mTotalSamplingTime(0), mNumSamples(0), - mLastValue(0), + mLastValue(NaN), mHasValue(false) {} void sample(F64 value) { LLUnitImplicit time_stamp = LLTimer::getTotalSeconds(); - LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; - mLastSampleTimeStamp = time_stamp; - if (mHasValue) + // store effect of last value + sync(time_stamp); + + if (!mHasValue) { - mTotalSamplingTime += delta_time; - mSum += mLastValue * delta_time; + mHasValue = true; - // NOTE: both conditions will hold first time through + mMin = value; + mMax = value; + mMean = value; + mLastSampleTimeStamp = time_stamp; + } + else + { if (value < mMin) { mMin = value; } - if (value > mMax) { mMax = value; } - - F64 old_mean = mMean; - mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); - mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); + else if (value > mMax) { mMax = value; } } mLastValue = value; mNumSamples++; - mHasValue = true; } - void addSamples(const SampleAccumulator& other, bool append) - { - if (other.mTotalSamplingTime) - { - mSum += other.mSum; - - // NOTE: both conditions will hold first time through - if (other.mMin < mMin) { mMin = other.mMin; } - if (other.mMax > mMax) { mMax = other.mMax; } - - // combine variance (and hence standard deviation) of 2 different sized sample groups using - // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm - F64 n_1 = mTotalSamplingTime, - n_2 = other.mTotalSamplingTime; - F64 m_1 = mMean, - m_2 = other.mMean; - F64 v_1 = mSumOfSquares / mTotalSamplingTime, - v_2 = other.mSumOfSquares / other.mTotalSamplingTime; - if (n_1 == 0) - { - mSumOfSquares = other.mSumOfSquares; - } - else if (n_2 == 0) - { - // variance is unchanged - // mSumOfSquares = mSumOfSquares; - } - else - { - mSumOfSquares = mTotalSamplingTime - * ((((n_1 - 1.f) * v_1) - + ((n_2 - 1.f) * v_2) - + (((n_1 * n_2) / (n_1 + n_2)) - * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) - / (n_1 + n_2 - 1.f)); - } - - llassert(other.mTotalSamplingTime > 0); - F64 weight = mTotalSamplingTime / (mTotalSamplingTime + other.mTotalSamplingTime); - mNumSamples += other.mNumSamples; - mTotalSamplingTime += other.mTotalSamplingTime; - mMean = (mMean * weight) + (other.mMean * (1.0 - weight)); - if (append) - { - mLastValue = other.mLastValue; - mLastSampleTimeStamp = other.mLastSampleTimeStamp; - mHasValue |= other.mHasValue; - } - } - } - - void reset(const SampleAccumulator* other) - { - mNumSamples = 0; - mSum = 0; - mMin = std::numeric_limits::max(); - mMax = std::numeric_limits::min(); - mMean = other ? other->mLastValue : 0; - mSumOfSquares = 0; - mLastSampleTimeStamp = LLTimer::getTotalSeconds(); - mTotalSamplingTime = 0; - mLastValue = other ? other->mLastValue : 0; - mHasValue = other ? other->mHasValue : false; - } + void addSamples(const SampleAccumulator& other, EBufferAppendType append_type); + void reset(const SampleAccumulator* other); void sync(LLUnitImplicit time_stamp) { - LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; - if (mHasValue) { + LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; mSum += mLastValue * delta_time; mTotalSamplingTime += delta_time; + F64 old_mean = mMean; + mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); + mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); } mLastSampleTimeStamp = time_stamp; } - F64 getSum() const { return mSum; } - F64 getMin() const { return mMin; } - F64 getMax() const { return mMax; } - F64 getLastValue() const { return mLastValue; } - F64 getMean() const { return mMean; } + F64 getSum() const { return mSum; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } - U32 getSampleCount() const { return mNumSamples; } - bool hasValue() const { return mHasValue; } + U32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return mHasValue; } private: - F64 mSum, - mMin, - mMax, - mLastValue; + F64 mSum, + mMin, + mMax, + mLastValue; - bool mHasValue; + bool mHasValue; // distinct from mNumSamples, since we might have inherited an old sample - F64 mMean, - mSumOfSquares; + F64 mMean, + mSumOfSquares; - LLUnitImplicit mLastSampleTimeStamp, - mTotalSamplingTime; + LLUnitImplicit + mLastSampleTimeStamp, + mTotalSamplingTime; - U32 mNumSamples; + U32 mNumSamples; }; class CountAccumulator @@ -489,7 +391,7 @@ namespace LLTrace mSum += value; } - void addSamples(const CountAccumulator& other, bool /*append*/) + void addSamples(const CountAccumulator& other, bool /*follows_in_sequence*/) { mSum += other.mSum; mNumSamples += other.mNumSamples; @@ -534,25 +436,26 @@ namespace LLTrace }; TimeBlockAccumulator(); - void addSamples(const self_t& other, bool /*append*/); + void addSamples(const self_t& other, EBufferAppendType append_type); void reset(const self_t* other); void sync(LLUnitImplicit) {} // // members // - U64 mStartTotalTimeCounter, - mTotalTimeCounter, - mSelfTimeCounter; - U32 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 - bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame + U64 mStartTotalTimeCounter, + mTotalTimeCounter, + mSelfTimeCounter; + U32 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 + bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame }; class TimeBlock; + class TimeBlockTreeNode { public: @@ -603,10 +506,10 @@ namespace LLTrace mDeallocatedCount(0) {} - void addSamples(const MemStatAccumulator& other, bool append) + void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { - mSize.addSamples(other.mSize, append); - mChildSize.addSamples(other.mChildSize, append); + mSize.addSamples(other.mSize, append_type); + mChildSize.addSamples(other.mChildSize, append_type); mAllocatedCount += other.mAllocatedCount; mDeallocatedCount += other.mDeallocatedCount; } @@ -645,11 +548,11 @@ namespace LLTrace void reset(AccumulatorBufferGroup* other = NULL); void sync(); - AccumulatorBuffer mCounts; - AccumulatorBuffer mSamples; - AccumulatorBuffer mEvents; - AccumulatorBuffer mStackTimers; - AccumulatorBuffer mMemStats; + AccumulatorBuffer mCounts; + AccumulatorBuffer mSamples; + AccumulatorBuffer mEvents; + AccumulatorBuffer mStackTimers; + AccumulatorBuffer mMemStats; }; } -- cgit v1.2.3 From cc31b4ae7934010762b8aaaa7e190c74a1cd7820 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 12 Aug 2013 20:05:16 -0700 Subject: SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue bounces once per second SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary made llerrs/infos/etc properly variadic wrt tags LL_INFOS("A", "B", "C") works, for example fixed unit tests remove llsimplestat --- indra/llcommon/lltraceaccumulators.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 5871dc4bea..ef73bd3091 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -223,7 +223,6 @@ namespace LLTrace { public: typedef F64 value_t; - typedef F64 mean_t; EventAccumulator() : mSum(NaN), @@ -269,6 +268,7 @@ namespace LLTrace F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } + F64 getSumOfSquares() const { return mSumOfSquares; } U32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mNumSamples > 0; } @@ -289,7 +289,6 @@ namespace LLTrace { public: typedef F64 value_t; - typedef F64 mean_t; SampleAccumulator() : mSum(0), @@ -353,6 +352,8 @@ namespace LLTrace F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } + F64 getSumOfSquares() const { return mSumOfSquares; } + LLUnitImplicit getSamplingTime() { return mTotalSamplingTime; } U32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mHasValue; } @@ -378,7 +379,6 @@ namespace LLTrace { public: typedef F64 value_t; - typedef F64 mean_t; CountAccumulator() : mSum(0), @@ -419,20 +419,17 @@ namespace LLTrace { public: typedef LLUnit value_t; - typedef LLUnit mean_t; typedef TimeBlockAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic struct CallCountFacet { typedef U32 value_t; - typedef F32 mean_t; }; struct SelfTimeFacet { typedef LLUnit value_t; - typedef LLUnit mean_t; }; TimeBlockAccumulator(); @@ -486,19 +483,16 @@ namespace LLTrace struct AllocationCountFacet { typedef U32 value_t; - typedef F32 mean_t; }; struct DeallocationCountFacet { typedef U32 value_t; - typedef F32 mean_t; }; struct ChildMemFacet { typedef LLUnit value_t; - typedef LLUnit mean_t; }; MemStatAccumulator() -- cgit v1.2.3 From 26581404e426b00cd0a07c38b5cb858d5d5faa28 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Aug 2013 11:51:49 -0700 Subject: BUILDFIX: added header for numeric_limits support on gcc added convenience types for units F32Seconds, etc. --- indra/llcommon/lltraceaccumulators.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index ef73bd3091..4d79964526 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -418,7 +418,7 @@ namespace LLTrace class TimeBlockAccumulator { public: - typedef LLUnit value_t; + typedef LLUnits::F64Seconds value_t; typedef TimeBlockAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic @@ -429,7 +429,7 @@ namespace LLTrace struct SelfTimeFacet { - typedef LLUnit value_t; + typedef LLUnits::F64Seconds value_t; }; TimeBlockAccumulator(); -- cgit v1.2.3 From 9f7bfa1c3710856cd2b0a0a8a429d6c45b0fcd09 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Aug 2013 00:02:23 -0700 Subject: moved unit types out of LLUnits namespace, since they are prefixed --- indra/llcommon/lltraceaccumulators.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 4d79964526..73da6bd2d8 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -418,7 +418,7 @@ namespace LLTrace class TimeBlockAccumulator { public: - typedef LLUnits::F64Seconds value_t; + typedef F64Seconds value_t; typedef TimeBlockAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic @@ -429,7 +429,7 @@ namespace LLTrace struct SelfTimeFacet { - typedef LLUnits::F64Seconds value_t; + typedef F64Seconds value_t; }; TimeBlockAccumulator(); @@ -492,7 +492,7 @@ namespace LLTrace struct ChildMemFacet { - typedef LLUnit value_t; + typedef F64Bytes value_t; }; MemStatAccumulator() -- cgit v1.2.3 From 612892b45a3413b16e40c49d3bfde77a4ca927fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 18 Aug 2013 22:30:27 -0700 Subject: SH-4433 WIP: Interesting: Statistics > Ping Sim is always 0 ms continued conversion to units system made units perform type promotion correctly and preserve type in arithmetic e.g. can now do LLVector3 in units added typedefs for remaining common unit types, including implicits --- indra/llcommon/lltraceaccumulators.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 73da6bd2d8..f9d223066d 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -118,7 +118,7 @@ namespace LLTrace } } - void sync(LLUnitImplicit time_stamp) + void sync(F64SecondsImplicit time_stamp) { llassert(mStorageSize >= sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) @@ -260,7 +260,7 @@ namespace LLTrace void addSamples(const EventAccumulator& other, EBufferAppendType append_type); void reset(const EventAccumulator* other); - void sync(LLUnitImplicit) {} + void sync(F64SecondsImplicit) {} F64 getSum() const { return mSum; } F64 getMin() const { return mMin; } @@ -305,7 +305,7 @@ namespace LLTrace void sample(F64 value) { - LLUnitImplicit time_stamp = LLTimer::getTotalSeconds(); + F64SecondsImplicit time_stamp = LLTimer::getTotalSeconds(); // store effect of last value sync(time_stamp); @@ -332,11 +332,11 @@ namespace LLTrace void addSamples(const SampleAccumulator& other, EBufferAppendType append_type); void reset(const SampleAccumulator* other); - void sync(LLUnitImplicit time_stamp) + void sync(F64SecondsImplicit time_stamp) { if (mHasValue) { - LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; + F64SecondsImplicit delta_time = time_stamp - mLastSampleTimeStamp; mSum += mLastValue * delta_time; mTotalSamplingTime += delta_time; F64 old_mean = mMean; @@ -353,7 +353,7 @@ namespace LLTrace F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } F64 getSumOfSquares() const { return mSumOfSquares; } - LLUnitImplicit getSamplingTime() { return mTotalSamplingTime; } + F64SecondsImplicit getSamplingTime() { return mTotalSamplingTime; } U32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mHasValue; } @@ -368,7 +368,7 @@ namespace LLTrace F64 mMean, mSumOfSquares; - LLUnitImplicit + F64SecondsImplicit mLastSampleTimeStamp, mTotalSamplingTime; @@ -403,7 +403,7 @@ namespace LLTrace mSum = 0; } - void sync(LLUnitImplicit) {} + void sync(F64SecondsImplicit) {} F64 getSum() const { return mSum; } @@ -435,7 +435,7 @@ namespace LLTrace TimeBlockAccumulator(); void addSamples(const self_t& other, EBufferAppendType append_type); void reset(const self_t* other); - void sync(LLUnitImplicit) {} + void sync(F64SecondsImplicit) {} // // members @@ -516,7 +516,7 @@ namespace LLTrace mDeallocatedCount = 0; } - void sync(LLUnitImplicit time_stamp) + void sync(F64SecondsImplicit time_stamp) { mSize.sync(time_stamp); mChildSize.sync(time_stamp); -- cgit v1.2.3 From 2c6bc5afa59a88136fd6de4ebf0cb99ea7cdef3f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Aug 2013 14:06:57 -0700 Subject: SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 ms made getPrimaryAccumulator return a reference since it was an always non-null pointer changed unit conversion to perform lazy division in order to avoid truncation of timer values --- indra/llcommon/lltraceaccumulators.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index f9d223066d..d4ff4b8d71 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -1,3 +1,4 @@ + /** * @file lltraceaccumulators.h * @brief Storage for accumulating statistics @@ -317,6 +318,7 @@ namespace LLTrace mMin = value; mMax = value; mMean = value; + llassert(mMean < 0 || mMean >= 0); mLastSampleTimeStamp = time_stamp; } else @@ -341,6 +343,7 @@ namespace LLTrace mTotalSamplingTime += delta_time; F64 old_mean = mMean; mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); + llassert(mMean < 0 || mMean >= 0); mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); } mLastSampleTimeStamp = time_stamp; -- cgit v1.2.3 From 049317fc6442e8b2c2d93309a9d759aa063d2010 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Aug 2013 23:51:46 -0700 Subject: SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 ms added unit tests for lltrace --- indra/llcommon/lltraceaccumulators.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index d4ff4b8d71..bf195f72b1 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -342,6 +342,7 @@ namespace LLTrace mSum += mLastValue * delta_time; mTotalSamplingTime += delta_time; F64 old_mean = mMean; + llassert(mMean < 0 || mMean >= 0); mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); llassert(mMean < 0 || mMean >= 0); mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); -- cgit v1.2.3 From a7aed07a5b620977fb74e4070e432eef01d11d3c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Aug 2013 13:41:19 -0700 Subject: broke out llunit.h into llunittype.h and llunits.h for unit declarations changed unit declarations macros to make a lot more sense --- indra/llcommon/lltraceaccumulators.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index bf195f72b1..e0f60800e3 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -31,7 +31,7 @@ #include "stdtypes.h" #include "llpreprocessor.h" -#include "llunit.h" +#include "llunits.h" #include "lltimer.h" #include "llrefcount.h" #include "llthreadlocalstorage.h" -- cgit v1.2.3 From f0a642898dad11f6519bad735857a58e1d83422e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 29 Aug 2013 15:25:48 -0700 Subject: SH-4377 FIX: Interesting: Windows viewer crashes when SceneLoadingMonitorEnabled is enabled --- indra/llcommon/lltraceaccumulators.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index e0f60800e3..02af480b8a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -318,7 +318,6 @@ namespace LLTrace mMin = value; mMax = value; mMean = value; - llassert(mMean < 0 || mMean >= 0); mLastSampleTimeStamp = time_stamp; } else @@ -336,15 +335,13 @@ namespace LLTrace void sync(F64SecondsImplicit time_stamp) { - if (mHasValue) + if (mHasValue && time_stamp != mLastSampleTimeStamp) { F64SecondsImplicit delta_time = time_stamp - mLastSampleTimeStamp; mSum += mLastValue * delta_time; mTotalSamplingTime += delta_time; F64 old_mean = mMean; - llassert(mMean < 0 || mMean >= 0); mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); - llassert(mMean < 0 || mMean >= 0); mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); } mLastSampleTimeStamp = time_stamp; -- cgit v1.2.3 From 3fd68662f267a3fd96d101834b3a9563bde3f61e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 7 Sep 2013 21:16:39 -0700 Subject: added memory usage and occlusion events to traces renamed "current" to "primary" when referring to accumulators --- indra/llcommon/lltraceaccumulators.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 02af480b8a..e31058ab4b 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -75,7 +75,7 @@ namespace LLTrace ~AccumulatorBuffer() { - if (isPrimary()) + if (isCurrent()) { LLThreadLocalSingletonPointer::setInstance(NULL); } @@ -128,22 +128,22 @@ namespace LLTrace } } - void makePrimary() + void makeCurrent() { LLThreadLocalSingletonPointer::setInstance(mStorage); } - bool isPrimary() const + bool isCurrent() const { return LLThreadLocalSingletonPointer::getInstance() == mStorage; } - static void clearPrimary() + static void resetCurrent() { LLThreadLocalSingletonPointer::setInstance(NULL); } - LL_FORCE_INLINE static ACCUMULATOR* getPrimaryStorage() + LL_FORCE_INLINE static ACCUMULATOR* getCurrentStorage() { ACCUMULATOR* accumulator = LLThreadLocalSingletonPointer::getInstance(); return accumulator ? accumulator : getDefaultBuffer()->mStorage; @@ -534,9 +534,9 @@ namespace LLTrace AccumulatorBufferGroup(); void handOffTo(AccumulatorBufferGroup& other); - void makePrimary(); - bool isPrimary() const; - static void clearPrimary(); + void makeCurrent(); + bool isCurrent() const; + static void resetCurrent(); void append(const AccumulatorBufferGroup& other); void merge(const AccumulatorBufferGroup& other); -- cgit v1.2.3 From 72f979135b3497d16c2635babf057900ddbc42fe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 18 Sep 2013 14:20:30 -0700 Subject: merge --- indra/llcommon/lltraceaccumulators.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index e31058ab4b..c5a0693fef 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -138,17 +138,11 @@ namespace LLTrace return LLThreadLocalSingletonPointer::getInstance() == mStorage; } - static void resetCurrent() + static void clearCurrent() { LLThreadLocalSingletonPointer::setInstance(NULL); } - LL_FORCE_INLINE static ACCUMULATOR* getCurrentStorage() - { - ACCUMULATOR* accumulator = LLThreadLocalSingletonPointer::getInstance(); - return accumulator ? accumulator : getDefaultBuffer()->mStorage; - } - // NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned size_t reserveSlot() { @@ -491,7 +485,7 @@ namespace LLTrace typedef U32 value_t; }; - struct ChildMemFacet + struct ShadowMemFacet { typedef F64Bytes value_t; }; @@ -504,7 +498,7 @@ namespace LLTrace void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { mSize.addSamples(other.mSize, append_type); - mChildSize.addSamples(other.mChildSize, append_type); + mShadowSize.addSamples(other.mShadowSize, append_type); mAllocatedCount += other.mAllocatedCount; mDeallocatedCount += other.mDeallocatedCount; } @@ -512,7 +506,7 @@ namespace LLTrace void reset(const MemStatAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); - mChildSize.reset(other ? &other->mChildSize : NULL); + mShadowSize.reset(other ? &other->mShadowSize : NULL); mAllocatedCount = 0; mDeallocatedCount = 0; } @@ -520,11 +514,11 @@ namespace LLTrace void sync(F64SecondsImplicit time_stamp) { mSize.sync(time_stamp); - mChildSize.sync(time_stamp); + mShadowSize.sync(time_stamp); } SampleAccumulator mSize, - mChildSize; + mShadowSize; int mAllocatedCount, mDeallocatedCount; }; @@ -536,7 +530,7 @@ namespace LLTrace void handOffTo(AccumulatorBufferGroup& other); void makeCurrent(); bool isCurrent() const; - static void resetCurrent(); + static void clearCurrent(); void append(const AccumulatorBufferGroup& other); void merge(const AccumulatorBufferGroup& other); -- cgit v1.2.3 From e25b5a359faaf4bb51186235567fcb1fea15e440 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Sep 2013 16:07:32 -0700 Subject: refactored lltrace mem tracking to store allocation and deallocation sizes at the same time and work better with threads --- indra/llcommon/lltraceaccumulators.h | 58 +++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 17 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index c5a0693fef..37a35f4e23 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -475,40 +475,62 @@ namespace LLTrace typedef MemStatAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic - struct AllocationCountFacet + struct AllocationFacet { - typedef U32 value_t; + typedef F64Bytes value_t; }; - struct DeallocationCountFacet + struct DeallocationFacet { - typedef U32 value_t; + typedef F64Bytes value_t; }; - struct ShadowMemFacet + struct ShadowAllocationFacet { typedef F64Bytes value_t; }; - MemStatAccumulator() - : mAllocatedCount(0), - mDeallocatedCount(0) - {} + struct ShadowDeallocationFacet + { + typedef F64Bytes value_t; + }; + + struct ShadowMemFacet + { + typedef F64Bytes value_t; + }; void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { - mSize.addSamples(other.mSize, append_type); - mShadowSize.addSamples(other.mShadowSize, append_type); - mAllocatedCount += other.mAllocatedCount; - mDeallocatedCount += other.mDeallocatedCount; + mAllocated.addSamples(other.mAllocated, append_type); + mDeallocated.addSamples(other.mDeallocated, append_type); + if (append_type == SEQUENTIAL) + { + mSize.addSamples(other.mSize, SEQUENTIAL); + mShadowSize.addSamples(other.mShadowSize, SEQUENTIAL); + } + else + { + F64 allocation_delta(other.mAllocated.getSum() - other.mDeallocated.getSum()); + mSize.sample(mSize.hasValue() + ? mSize.getLastValue() + allocation_delta + : allocation_delta); + + F64 shadow_allocation_delta(other.mShadowAllocated.getSum() - other.mShadowDeallocated.getSum()); + mShadowSize.sample(mShadowSize.hasValue() + ? mShadowSize.getLastValue() + shadow_allocation_delta + : shadow_allocation_delta); + } } void reset(const MemStatAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); mShadowSize.reset(other ? &other->mShadowSize : NULL); - mAllocatedCount = 0; - mDeallocatedCount = 0; + mAllocated.reset(other ? &other->mAllocated : NULL); + mDeallocated.reset(other ? &other->mDeallocated : NULL); + mShadowAllocated.reset(other ? &other->mShadowAllocated : NULL); + mShadowDeallocated.reset(other ? &other->mShadowDeallocated : NULL); } void sync(F64SecondsImplicit time_stamp) @@ -519,8 +541,10 @@ namespace LLTrace SampleAccumulator mSize, mShadowSize; - int mAllocatedCount, - mDeallocatedCount; + CountAccumulator mAllocated, + mDeallocated, + mShadowAllocated, + mShadowDeallocated; }; struct AccumulatorBufferGroup : public LLRefCount -- cgit v1.2.3 From 053d97db1b283ca2548dc1f64756ddfc5166158f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Sep 2013 19:12:35 -0700 Subject: better memory usage for LLTrace (tighter packing of recording arrays) removed complicated and unnecessary fast timer gapless handoff logic (it should be gapless anyway) improved MemTrackable API, better separation of shadow and footprint added memory usage stats to floater_stats.xml --- indra/llcommon/lltraceaccumulators.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 37a35f4e23..4fe84455a6 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -35,6 +35,7 @@ #include "lltimer.h" #include "llrefcount.h" #include "llthreadlocalstorage.h" +#include "llmemory.h" #include namespace LLTrace @@ -51,7 +52,7 @@ namespace LLTrace class AccumulatorBuffer : public LLRefCount { typedef AccumulatorBuffer self_t; - static const U32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 64; + static const U32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; private: struct StaticAllocationMarker { }; @@ -149,7 +150,9 @@ namespace LLTrace size_t next_slot = sNextStorageSlot++; if (next_slot >= mStorageSize) { - resize(mStorageSize + (mStorageSize >> 2)); + // don't perform doubling, as this should only happen during startup + // want to keep a tight bounds as we will have a lot of these buffers + resize(mStorageSize + ACCUMULATOR_BUFFER_SIZE_INCREMENT); } llassert(mStorage && next_slot < mStorageSize); return next_slot; @@ -199,7 +202,7 @@ namespace LLTrace // so as not to trigger an access violation sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker()); sInitialized = true; - sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); + sDefaultBuffer->resize(ACCUMULATOR_BUFFER_SIZE_INCREMENT); } return sDefaultBuffer; } @@ -427,6 +430,17 @@ namespace LLTrace typedef F64Seconds value_t; }; + // arrays are allocated with 32 byte alignment + void *operator new [](size_t size) + { + return ll_aligned_malloc(32, size); + } + + void operator delete[](void* ptr, size_t size) + { + ll_aligned_free(32, ptr); + } + TimeBlockAccumulator(); void addSamples(const self_t& other, EBufferAppendType append_type); void reset(const self_t* other); @@ -435,8 +449,7 @@ namespace LLTrace // // members // - U64 mStartTotalTimeCounter, - mTotalTimeCounter, + U64 mTotalTimeCounter, mSelfTimeCounter; U32 mCalls; class TimeBlock* mParent; // last acknowledged parent of this time block -- cgit v1.2.3 From e0a443f5a6b76fd1ab5ffaa8e7a1941d47c80f4f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Sep 2013 11:18:39 -0700 Subject: BUILDFIX: fix for mac builds also, fixed alignment of tick labels on stat bars --- indra/llcommon/lltraceaccumulators.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 4fe84455a6..2dcfdf48ad 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -52,7 +52,7 @@ namespace LLTrace class AccumulatorBuffer : public LLRefCount { typedef AccumulatorBuffer self_t; - static const U32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; + static const S32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; private: struct StaticAllocationMarker { }; @@ -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 @@ -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 -- cgit v1.2.3 From 0e29315ec701583455a109e85221f62ee68225ca Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Sep 2013 15:51:40 -0700 Subject: BUILDFIX: fix for bad assert causing unit tests to fail --- indra/llcommon/lltraceaccumulators.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 4fe84455a6..07870c5340 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -95,7 +95,7 @@ namespace LLTrace void addSamples(const AccumulatorBuffer& 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& 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]; -- cgit v1.2.3 From af6b6db264aaa02e9e6a01d88233d129cf960fdf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Sep 2013 21:24:27 -0700 Subject: fixed lltrace memory tracking image memory utilization now always non-negative --- indra/llcommon/lltraceaccumulators.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 2dcfdf48ad..01f4ef506f 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -223,7 +223,7 @@ namespace LLTrace typedef F64 value_t; EventAccumulator() - : mSum(NaN), + : mSum(0), mMin(NaN), mMax(NaN), mMean(NaN), @@ -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; @@ -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 -- cgit v1.2.3 From 12f0f8cb72f789e21b01b45063dcc5f1f5292087 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 13:46:43 -0700 Subject: changed over to manual naming of MemTrackable stats changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats --- indra/llcommon/lltraceaccumulators.h | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 5cba3e5360..ecc569f5d6 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -498,32 +498,14 @@ namespace LLTrace typedef F64Bytes value_t; }; - struct ShadowAllocationFacet - { - typedef F64Bytes value_t; - }; - - struct ShadowDeallocationFacet - { - typedef F64Bytes value_t; - }; - - struct ShadowMemFacet - { - typedef F64Bytes value_t; - }; - void addSamples(const MemStatAccumulator& other, EBufferAppendType 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); - mShadowSize.addSamples(other.mShadowSize, SEQUENTIAL); } else { @@ -531,36 +513,24 @@ namespace LLTrace mSize.sample(mSize.hasValue() ? mSize.getLastValue() + allocation_delta : allocation_delta); - - F64 shadow_allocation_delta(other.mShadowAllocations.getSum() - other.mShadowDeallocations.getSum()); - mShadowSize.sample(mShadowSize.hasValue() - ? mShadowSize.getLastValue() + shadow_allocation_delta - : shadow_allocation_delta); } } void reset(const MemStatAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); - mShadowSize.reset(other ? &other->mShadowSize : 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) { mSize.sync(time_stamp); - mShadowSize.sync(time_stamp); } - SampleAccumulator mSize, - mShadowSize; - EventAccumulator mFootprintAllocations, - mShadowAllocations; - CountAccumulator mFootprintDeallocations, - mShadowDeallocations; + SampleAccumulator mSize; + EventAccumulator mFootprintAllocations; + CountAccumulator mFootprintDeallocations; }; struct AccumulatorBufferGroup : public LLRefCount -- cgit v1.2.3 From 754e8752a9b9a2e75d425a10cb8a0a6f85ad4bf5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 3 Oct 2013 14:30:34 -0700 Subject: added initial memory usage tracking for lltrace --- indra/llcommon/lltraceaccumulators.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index ecc569f5d6..d03c6ce5c0 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -188,6 +188,11 @@ namespace LLTrace return getNumIndices(); } + size_t capacity() const + { + return mStorageSize; + } + static size_t getNumIndices() { return sNextStorageSlot; @@ -536,6 +541,7 @@ namespace LLTrace struct AccumulatorBufferGroup : public LLRefCount { AccumulatorBufferGroup(); + ~AccumulatorBufferGroup(); void handOffTo(AccumulatorBufferGroup& other); void makeCurrent(); -- cgit v1.2.3 From f8a85003ddd4bee1ae00fc329c1c1d66d6100cbd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 3 Oct 2013 19:04:51 -0700 Subject: more memory optimizations of lltrace --- indra/llcommon/lltraceaccumulators.h | 38 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index d03c6ce5c0..27c0910665 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -266,8 +266,8 @@ namespace LLTrace void sync(F64SecondsImplicit) {} F64 getSum() const { return mSum; } - F64 getMin() const { return mMin; } - F64 getMax() const { return mMax; } + F32 getMin() const { return mMin; } + F32 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } @@ -277,13 +277,14 @@ namespace LLTrace private: F64 mSum, - mMin, - mMax, mLastValue; F64 mMean, mSumOfSquares; + F32 mMin, + mMax; + S32 mNumSamples; }; @@ -350,8 +351,8 @@ namespace LLTrace } F64 getSum() const { return mSum; } - F64 getMin() const { return mMin; } - F64 getMax() const { return mMax; } + F32 getMin() const { return mMin; } + F32 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } @@ -362,12 +363,8 @@ namespace LLTrace private: F64 mSum, - mMin, - mMax, mLastValue; - bool mHasValue; // distinct from mNumSamples, since we might have inherited an old sample - F64 mMean, mSumOfSquares; @@ -375,7 +372,13 @@ namespace LLTrace mLastSampleTimeStamp, mTotalSamplingTime; + F32 mMin, + mMax; + S32 mNumSamples; + // distinct from mNumSamples, since we might have inherited a last value from + // a previous sampling period + bool mHasValue; }; class CountAccumulator @@ -505,8 +508,8 @@ namespace LLTrace void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { - mFootprintAllocations.addSamples(other.mFootprintAllocations, append_type); - mFootprintDeallocations.addSamples(other.mFootprintDeallocations, append_type); + mAllocations.addSamples(other.mAllocations, append_type); + mDeallocations.addSamples(other.mDeallocations, append_type); if (append_type == SEQUENTIAL) { @@ -514,7 +517,7 @@ namespace LLTrace } else { - F64 allocation_delta(other.mFootprintAllocations.getSum() - other.mFootprintDeallocations.getSum()); + F64 allocation_delta(other.mAllocations.getSum() - other.mDeallocations.getSum()); mSize.sample(mSize.hasValue() ? mSize.getLastValue() + allocation_delta : allocation_delta); @@ -524,8 +527,8 @@ namespace LLTrace void reset(const MemStatAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); - mFootprintAllocations.reset(other ? &other->mFootprintAllocations : NULL); - mFootprintDeallocations.reset(other ? &other->mFootprintDeallocations : NULL); + mAllocations.reset(other ? &other->mAllocations : NULL); + mDeallocations.reset(other ? &other->mDeallocations : NULL); } void sync(F64SecondsImplicit time_stamp) @@ -534,13 +537,14 @@ namespace LLTrace } SampleAccumulator mSize; - EventAccumulator mFootprintAllocations; - CountAccumulator mFootprintDeallocations; + EventAccumulator mAllocations; + CountAccumulator mDeallocations; }; struct AccumulatorBufferGroup : public LLRefCount { AccumulatorBufferGroup(); + AccumulatorBufferGroup(const AccumulatorBufferGroup&); ~AccumulatorBufferGroup(); void handOffTo(AccumulatorBufferGroup& other); -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/llcommon/lltraceaccumulators.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 27c0910665..85873d469a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -52,7 +52,7 @@ namespace LLTrace class AccumulatorBuffer : public LLRefCount { typedef AccumulatorBuffer self_t; - static const S32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16; + static const S32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 32; private: struct StaticAllocationMarker { }; @@ -67,7 +67,7 @@ namespace LLTrace : mStorageSize(0), mStorage(NULL) { - resize(other.mStorageSize); + resize(sNextStorageSlot); for (S32 i = 0; i < sNextStorageSlot; i++) { mStorage[i] = other.mStorage[i]; @@ -152,7 +152,7 @@ namespace LLTrace { // don't perform doubling, as this should only happen during startup // want to keep a tight bounds as we will have a lot of these buffers - resize(mStorageSize + ACCUMULATOR_BUFFER_SIZE_INCREMENT); + resize(mStorageSize + mStorageSize / 2); } llassert(mStorage && next_slot < mStorageSize); return next_slot; @@ -207,7 +207,7 @@ namespace LLTrace // so as not to trigger an access violation sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker()); sInitialized = true; - sDefaultBuffer->resize(ACCUMULATOR_BUFFER_SIZE_INCREMENT); + sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); } return sDefaultBuffer; } @@ -491,9 +491,9 @@ namespace LLTrace U64 mChildTime; }; - struct MemStatAccumulator + struct MemAccumulator { - typedef MemStatAccumulator self_t; + typedef MemAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic struct AllocationFacet @@ -506,7 +506,7 @@ namespace LLTrace typedef F64Bytes value_t; }; - void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) + void addSamples(const MemAccumulator& other, EBufferAppendType append_type) { mAllocations.addSamples(other.mAllocations, append_type); mDeallocations.addSamples(other.mDeallocations, append_type); @@ -524,7 +524,7 @@ namespace LLTrace } } - void reset(const MemStatAccumulator* other) + void reset(const MemAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); mAllocations.reset(other ? &other->mAllocations : NULL); @@ -561,7 +561,7 @@ namespace LLTrace AccumulatorBuffer mSamples; AccumulatorBuffer mEvents; AccumulatorBuffer mStackTimers; - AccumulatorBuffer mMemStats; + AccumulatorBuffer mMemStats; }; } -- cgit v1.2.3 From 1acceb3633c0f0c4fdf29b17d77d67c8a9b71986 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 14 Oct 2013 10:18:41 -0700 Subject: changed ll_aligned_(malloc|free) to take alignment size as a template argument --- indra/llcommon/lltraceaccumulators.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 85873d469a..77370629d3 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -441,12 +441,12 @@ namespace LLTrace // arrays are allocated with 32 byte alignment void *operator new [](size_t size) { - return ll_aligned_malloc(32, size); + return ll_aligned_malloc<32>(size); } void operator delete[](void* ptr, size_t size) { - ll_aligned_free(32, ptr); + ll_aligned_free<32>(ptr); } TimeBlockAccumulator(); -- cgit v1.2.3 From 697d2e720ba75e142a4d56ae8794bab8d7698dad Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Oct 2013 20:24:42 -0700 Subject: renamed TimeBlock to BlockTimerStatHandle --- indra/llcommon/lltraceaccumulators.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 77370629d3..c30cc9a107 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -460,26 +460,26 @@ namespace LLTrace U64 mTotalTimeCounter, mSelfTimeCounter; S32 mCalls; - class TimeBlock* mParent; // last acknowledged parent of this time block - class TimeBlock* mLastCaller; // used to bootstrap tree construction + class BlockTimerStatHandle* mParent; // last acknowledged parent of this time block + class BlockTimerStatHandle* mLastCaller; // used to bootstrap tree construction U16 mActiveCount; // number of timers with this ID active on stack bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame }; - class TimeBlock; + class BlockTimerStatHandle; class TimeBlockTreeNode { public: TimeBlockTreeNode(); - void setParent(TimeBlock* parent); - TimeBlock* getParent() { return mParent; } + void setParent(BlockTimerStatHandle* parent); + BlockTimerStatHandle* getParent() { return mParent; } - TimeBlock* mBlock; - TimeBlock* mParent; - std::vector mChildren; + BlockTimerStatHandle* mBlock; + BlockTimerStatHandle* mParent; + std::vector mChildren; bool mCollapsed; bool mNeedsSorting; }; @@ -487,7 +487,7 @@ namespace LLTrace struct BlockTimerStackRecord { class BlockTimer* mActiveTimer; - class TimeBlock* mTimeBlock; + class BlockTimerStatHandle* mTimeBlock; U64 mChildTime; }; -- cgit v1.2.3 From 18aedf0241ba893e12140c0a3855f328d2b4eded Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 17 Oct 2013 19:18:53 -0700 Subject: fix for assert at runtime (reading stats from recording while it was active) fix for bad values returns from getPeriodMin and getPeriodMax on count stats when no counts recorded fix for gcc compile time error (typename ftw) --- indra/llcommon/lltraceaccumulators.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index c30cc9a107..2971907849 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -226,6 +226,7 @@ namespace LLTrace { public: typedef F64 value_t; + static F64 getDefaultValue() { return NaN; } EventAccumulator() : mSum(0), @@ -293,6 +294,7 @@ namespace LLTrace { public: typedef F64 value_t; + static F64 getDefaultValue() { return NaN; } SampleAccumulator() : mSum(0), @@ -385,6 +387,7 @@ namespace LLTrace { public: typedef F64 value_t; + static F64 getDefaultValue() { return 0; } CountAccumulator() : mSum(0), @@ -415,6 +418,8 @@ namespace LLTrace S32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return true; } + private: F64 mSum; @@ -425,6 +430,8 @@ namespace LLTrace { public: typedef F64Seconds value_t; + static F64Seconds getDefaultValue() { return F64Seconds(0); } + typedef TimeBlockAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic @@ -453,6 +460,7 @@ namespace LLTrace void addSamples(const self_t& other, EBufferAppendType append_type); void reset(const self_t* other); void sync(F64SecondsImplicit) {} + bool hasValue() const { return true; } // // members @@ -493,17 +501,22 @@ namespace LLTrace struct MemAccumulator { + typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } + typedef MemAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic struct AllocationFacet { typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } }; struct DeallocationFacet { typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } }; void addSamples(const MemAccumulator& other, EBufferAppendType append_type) @@ -536,6 +549,8 @@ namespace LLTrace mSize.sync(time_stamp); } + bool hasValue() const { return mSize.hasValue(); } + SampleAccumulator mSize; EventAccumulator mAllocations; CountAccumulator mDeallocations; -- cgit v1.2.3 From 1dfba44b3dc14564c99333dedb7a380a160aee44 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 21 Oct 2013 14:22:21 -0700 Subject: fixed things so that trace recordings can be read from even while active --- indra/llcommon/lltraceaccumulators.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 2971907849..dfa037d7c0 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -276,6 +276,9 @@ namespace LLTrace S32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mNumSamples > 0; } + // helper utility to calculate combined sumofsquares total + static F64 mergeSumsOfSquares(const EventAccumulator& a, const EventAccumulator& b); + private: F64 mSum, mLastValue; @@ -359,10 +362,13 @@ namespace LLTrace F64 getMean() const { return mMean; } F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } F64 getSumOfSquares() const { return mSumOfSquares; } - F64SecondsImplicit getSamplingTime() { return mTotalSamplingTime; } + F64SecondsImplicit getSamplingTime() const { return mTotalSamplingTime; } S32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mHasValue; } + // helper utility to calculate combined sumofsquares total + static F64 mergeSumsOfSquares(const SampleAccumulator& a, const SampleAccumulator& b); + private: F64 mSum, mLastValue; -- cgit v1.2.3 From 391ac367d6922f30bf3a186bc15e1fc38366eecf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 19 Nov 2013 17:40:44 -0800 Subject: SH-4634 FIX Interesting: Viewer crashes when receiving teleport offer renamed fast timers to have unique names, changes instance tracker to never allow duplicates --- indra/llcommon/lltraceaccumulators.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/lltraceaccumulators.h') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index dfa037d7c0..42fad8a793 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -471,13 +471,13 @@ namespace LLTrace // // members // - U64 mTotalTimeCounter, - mSelfTimeCounter; - S32 mCalls; + U64 mTotalTimeCounter, + mSelfTimeCounter; + S32 mCalls; class BlockTimerStatHandle* mParent; // last acknowledged parent of this time block class BlockTimerStatHandle* mLastCaller; // used to bootstrap tree construction - U16 mActiveCount; // number of timers with this ID active on stack - bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame + U16 mActiveCount; // number of timers with this ID active on stack + bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame }; -- cgit v1.2.3