From 9ae76d12157641033431381959ef4f798a119b8d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 May 2013 17:00:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed copy construction behavior of Recordings to not zero out data split measurement into event and sample, with sample representing a continuous function --- indra/llcommon/llthread.cpp | 2 +- indra/llcommon/llthreadlocalstorage.h | 4 + indra/llcommon/lltrace.cpp | 14 +- indra/llcommon/lltrace.h | 234 +++++++++++++++++++++++++---- indra/llcommon/lltracerecording.cpp | 188 ++++++++++++++++++------ indra/llcommon/lltracerecording.h | 244 ++++++++++++++++++++++++++----- indra/llcommon/lltracethreadrecorder.cpp | 78 +++++----- indra/llcommon/lltracethreadrecorder.h | 13 +- indra/llui/llstatbar.cpp | 118 ++++++++++----- indra/llui/llstatbar.h | 10 +- indra/llui/llstatgraph.h | 10 +- indra/newview/llappviewer.cpp | 2 +- indra/newview/llfloaterjoystick.cpp | 14 +- indra/newview/llscenemonitor.cpp | 57 +++++++- indra/newview/llstartup.cpp | 2 +- indra/newview/llstatusbar.cpp | 2 +- indra/newview/lltexturefetch.cpp | 10 +- indra/newview/lltexturefetch.h | 4 +- indra/newview/llviewerassetstats.cpp | 9 +- indra/newview/llviewerassetstats.h | 2 +- indra/newview/llviewerassetstorage.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llviewerobjectlist.cpp | 2 +- indra/newview/llviewerobjectlist.h | 2 +- indra/newview/llviewerstats.cpp | 125 ++++++++-------- indra/newview/llviewerstats.h | 103 ++++++------- indra/newview/llviewerwindow.cpp | 19 +-- indra/newview/llviewerwindow.h | 4 +- indra/newview/llvoavatarself.cpp | 2 +- indra/newview/pipeline.cpp | 28 +--- indra/newview/pipeline.h | 11 +- 31 files changed, 919 insertions(+), 398 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 6374b5398b..118568d5ef 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -93,7 +93,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap { LLThread *threadp = (LLThread *)datap; - LLTrace::ThreadRecorder* thread_recorder = new LLTrace::SlaveThreadRecorder(); + LLTrace::ThreadRecorder* thread_recorder = new LLTrace::SlaveThreadRecorder(LLTrace::getUIThreadRecorder()); #if !LL_DARWIN sThreadID = threadp->mID; diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index 4873b2740d..471784749b 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -131,6 +131,10 @@ public: if (!sInitialized) return false; return get() == other; } + + bool isNull() const { return !sInitialized || get() == NULL; } + + bool notNull() const { return sInitialized && get() != NULL; } }; template diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 463048008f..c831a1548d 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -35,13 +35,13 @@ static S32 sInitializationCount = 0; namespace LLTrace { -static MasterThreadRecorder* gMasterThreadRecorder = NULL; +static MasterThreadRecorder* gUIThreadRecorder = NULL; void init() { if (sInitializationCount++ == 0) { - gMasterThreadRecorder = new MasterThreadRecorder(); + gUIThreadRecorder = new MasterThreadRecorder(); } } @@ -54,15 +54,15 @@ void cleanup() { if (--sInitializationCount == 0) { - delete gMasterThreadRecorder; - gMasterThreadRecorder = NULL; + delete gUIThreadRecorder; + gUIThreadRecorder = NULL; } } -MasterThreadRecorder& getMasterThreadRecorder() +MasterThreadRecorder& getUIThreadRecorder() { - llassert(gMasterThreadRecorder != NULL); - return *gMasterThreadRecorder; + llassert(gUIThreadRecorder != NULL); + return *gUIThreadRecorder; } LLThreadLocalPointer& get_thread_recorder_ptr() diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index d1edaf969b..f94576de45 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -73,7 +73,7 @@ bool isInitialized(); const LLThreadLocalPointer& get_thread_recorder(); void set_thread_recorder(class ThreadRecorder*); -class MasterThreadRecorder& getMasterThreadRecorder(); +class MasterThreadRecorder& getUIThreadRecorder(); // one per thread per type template @@ -148,6 +148,15 @@ public: } } + void flush() + { + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].flush(); + } + } + void makePrimary() { LLThreadLocalSingletonPointer::setInstance(mStorage); @@ -260,14 +269,14 @@ protected: }; template -class MeasurementAccumulator +class EventAccumulator { public: typedef T value_t; typedef F64 mean_t; - typedef MeasurementAccumulator self_t; + typedef EventAccumulator self_t; - MeasurementAccumulator() + EventAccumulator() : mSum(0), mMin((std::numeric_limits::max)()), mMax((std::numeric_limits::min)()), @@ -277,7 +286,7 @@ public: mLastValue(0) {} - void sample(T value) + void record(T value) { mNumSamples++; mSum += value; @@ -301,17 +310,10 @@ public: if (other.mNumSamples) { mSum += other.mSum; - if (other.mMin < mMin) - { - mMin = other.mMin; - } - if (other.mMax > mMax) - { - mMax = other.mMax; - } - F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); - mNumSamples += other.mNumSamples; - mMean = mMean * weight + other.mMean * (1.f - weight); + + // 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 @@ -333,12 +335,16 @@ public: 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)); + * ((((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); mLastValue = other.mLastValue; } } @@ -347,13 +353,15 @@ public: { mNumSamples = 0; mSum = 0; - mMin = 0; - mMax = 0; + mMin = std::numeric_limits::max(); + mMax = std::numeric_limits::min(); mMean = 0; mVarianceSum = 0; mLastValue = other ? other->mLastValue : 0; } + void flush() {} + T getSum() const { return (T)mSum; } T getMin() const { return (T)mMin; } T getMax() const { return (T)mMax; } @@ -375,6 +383,150 @@ private: }; +template +class SampleAccumulator +{ +public: + typedef T value_t; + typedef F64 mean_t; + typedef SampleAccumulator self_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(T value) + { + LLUnitImplicit time_stamp = LLTimer::getTotalSeconds(); + LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; + mLastSampleTimeStamp = time_stamp; + + if (mHasValue) + { + mTotalSamplingTime += delta_time; + mSum += (F64)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) * ((F64)mLastValue - old_mean); + mVarianceSum += delta_time * ((F64)mLastValue - old_mean) * ((F64)mLastValue - mMean); + } + + mLastValue = value; + mNumSamples++; + mHasValue = true; + } + + void addSamples(const self_t& other) + { + 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)); + mLastValue = other.mLastValue; + mLastSampleTimeStamp = other.mLastSampleTimeStamp; + mHasValue |= other.mHasValue; + } + } + + void reset(const self_t* 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 = LLTimer::getTotalSeconds(); + LLUnitImplicit delta_time = time_stamp - mLastSampleTimeStamp; + + mSum += (F64)mLastValue * delta_time; + + mTotalSamplingTime += delta_time; + mLastSampleTimeStamp = time_stamp; + } + + T getSum() const { return (T)mSum; } + T getMin() const { return (T)mMin; } + T getMax() const { return (T)mMax; } + T getLastValue() const { return (T)mLastValue; } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mTotalSamplingTime); } + U32 getSampleCount() const { return mNumSamples; } + +private: + T mSum, + mMin, + mMax, + mLastValue; + + bool mHasValue; + + F64 mMean, + mVarianceSum; + + LLUnitImplicit mLastSampleTimeStamp, + mTotalSamplingTime; + + U32 mNumSamples; +}; + template class CountAccumulator { @@ -406,6 +558,8 @@ public: mSum = 0; } + void flush() {} + T getSum() const { return (T)mSum; } U32 getSampleCount() const { return mNumSamples; } @@ -439,6 +593,7 @@ public: TimeBlockAccumulator(); void addSamples(const self_t& other); void reset(const self_t* other); + void flush() {} // // members @@ -493,25 +648,44 @@ public: template -class MeasurementStatHandle -: public TraceType::type_t> > +class EventStatHandle +: public TraceType::type_t> > { public: typedef typename LLUnits::HighestPrecisionType::type_t storage_t; - typedef TraceType::type_t> > trace_t; + typedef TraceType::type_t> > trace_t; - MeasurementStatHandle(const char* name, const char* description = NULL) + EventStatHandle(const char* name, const char* description = NULL) : trace_t(name, description) {} }; template -void sample(MeasurementStatHandle& measurement, VALUE_T value) +void record(EventStatHandle& measurement, VALUE_T value) { T converted_value(value); - measurement.getPrimaryAccumulator()->sample(LLUnits::rawValue(converted_value)); + measurement.getPrimaryAccumulator()->record(LLUnits::rawValue(converted_value)); } +template +class SampleStatHandle +: public TraceType::type_t> > +{ +public: + typedef typename LLUnits::HighestPrecisionType::type_t storage_t; + typedef TraceType::type_t> > trace_t; + + SampleStatHandle(const char* name, const char* description = NULL) + : trace_t(name, description) + {} +}; + +template +void sample(SampleStatHandle& measurement, VALUE_T value) +{ + T converted_value(value); + measurement.getPrimaryAccumulator()->sample(LLUnits::rawValue(converted_value)); +} template class CountStatHandle @@ -560,6 +734,8 @@ struct MemStatAccumulator mDeallocatedCount = 0; } + void flush() {} + size_t mSize, mChildSize; int mAllocatedCount, diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index cced6546ba..5b0b74524f 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -45,9 +45,11 @@ RecordingBuffers::RecordingBuffers() void RecordingBuffers::handOffTo(RecordingBuffers& other) { other.mCountsFloat.reset(&mCountsFloat); - other.mMeasurementsFloat.reset(&mMeasurementsFloat); other.mCounts.reset(&mCounts); - other.mMeasurements.reset(&mMeasurements); + other.mSamplesFloat.reset(&mSamplesFloat); + other.mSamples.reset(&mSamples); + other.mEventsFloat.reset(&mEventsFloat); + other.mEvents.reset(&mEvents); other.mStackTimers.reset(&mStackTimers); other.mMemStats.reset(&mMemStats); } @@ -55,9 +57,11 @@ void RecordingBuffers::handOffTo(RecordingBuffers& other) void RecordingBuffers::makePrimary() { mCountsFloat.makePrimary(); - mMeasurementsFloat.makePrimary(); mCounts.makePrimary(); - mMeasurements.makePrimary(); + mSamplesFloat.makePrimary(); + mSamples.makePrimary(); + mEventsFloat.makePrimary(); + mEvents.makePrimary(); mStackTimers.makePrimary(); mMemStats.makePrimary(); @@ -82,9 +86,11 @@ bool RecordingBuffers::isPrimary() const void RecordingBuffers::append( const RecordingBuffers& other ) { mCountsFloat.addSamples(other.mCountsFloat); - mMeasurementsFloat.addSamples(other.mMeasurementsFloat); mCounts.addSamples(other.mCounts); - mMeasurements.addSamples(other.mMeasurements); + mSamplesFloat.addSamples(other.mSamplesFloat); + mSamples.addSamples(other.mSamples); + mEventsFloat.addSamples(other.mEventsFloat); + mEvents.addSamples(other.mEvents); mMemStats.addSamples(other.mMemStats); mStackTimers.addSamples(other.mStackTimers); } @@ -92,22 +98,32 @@ void RecordingBuffers::append( const RecordingBuffers& other ) void RecordingBuffers::merge( const RecordingBuffers& other) { mCountsFloat.addSamples(other.mCountsFloat); - mMeasurementsFloat.addSamples(other.mMeasurementsFloat); mCounts.addSamples(other.mCounts); - mMeasurements.addSamples(other.mMeasurements); + mSamplesFloat.addSamples(other.mSamplesFloat); + mSamples.addSamples(other.mSamples); + mEventsFloat.addSamples(other.mEventsFloat); + mEvents.addSamples(other.mEvents); mMemStats.addSamples(other.mMemStats); } void RecordingBuffers::reset(RecordingBuffers* other) { mCountsFloat.reset(other ? &other->mCountsFloat : NULL); - mMeasurementsFloat.reset(other ? &other->mMeasurementsFloat : NULL); mCounts.reset(other ? &other->mCounts : NULL); - mMeasurements.reset(other ? &other->mMeasurements : NULL); + mSamplesFloat.reset(other ? &other->mSamplesFloat : NULL); + mSamples.reset(other ? &other->mSamples : NULL); + mEventsFloat.reset(other ? &other->mEventsFloat : NULL); + mEvents.reset(other ? &other->mEvents : NULL); mStackTimers.reset(other ? &other->mStackTimers : NULL); mMemStats.reset(other ? &other->mMemStats : NULL); } +void RecordingBuffers::flush() +{ + mSamplesFloat.flush(); + mSamples.flush(); +} + /////////////////////////////////////////////////////////////////////// // Recording /////////////////////////////////////////////////////////////////////// @@ -120,6 +136,9 @@ Recording::Recording() Recording::Recording( const Recording& other ) { + // this will allow us to seamlessly start without affecting any data we've acquired from other + setPlayState(PAUSED); + Recording& mutable_other = const_cast(other); EPlayState other_play_state = other.getPlayState(); mutable_other.pause(); @@ -137,15 +156,18 @@ Recording::Recording( const Recording& other ) Recording::~Recording() { - stop(); - llassert(isStopped()); + if (isStarted() && LLTrace::get_thread_recorder().notNull()) + { + LLTrace::get_thread_recorder()->deactivate(this); + } } void Recording::update() { if (isStarted()) { - LLTrace::get_thread_recorder()->update(this); + mBuffers.write()->flush(); + LLTrace::get_thread_recorder()->bringUpToDate(this); mSamplingTimer.reset(); } } @@ -167,6 +189,7 @@ void Recording::handleStart() void Recording::handleStop() { mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); + mBuffers.write()->flush(); LLTrace::TimeBlock::processTimes(); LLTrace::get_thread_recorder()->deactivate(this); } @@ -178,13 +201,23 @@ void Recording::handleSplitTo(Recording& other) void Recording::appendRecording( const Recording& other ) { - mBuffers.write()->append(*other.mBuffers); - mElapsedSeconds += other.mElapsedSeconds; + EPlayState play_state = getPlayState(); + { + pause(); + mBuffers.write()->append(*other.mBuffers); + mElapsedSeconds += other.mElapsedSeconds; + } + setPlayState(play_state); } void Recording::mergeRecording( const Recording& other) { - mBuffers.write()->merge(*other.mBuffers); + EPlayState play_state = getPlayState(); + { + pause(); + mBuffers.write()->merge(*other.mBuffers); + } + setPlayState(play_state); } LLUnit Recording::getSum(const TraceType& stat) const @@ -248,14 +281,14 @@ S64 Recording::getSum( const TraceType >& stat ) const return mBuffers->mCounts[stat.getIndex()].getSum(); } -F64 Recording::getSum( const TraceType >& stat ) const +F64 Recording::getSum( const TraceType >& stat ) const { - return (F64)mBuffers->mMeasurementsFloat[stat.getIndex()].getSum(); + return (F64)mBuffers->mEventsFloat[stat.getIndex()].getSum(); } -S64 Recording::getSum( const TraceType >& stat ) const +S64 Recording::getSum( const TraceType >& stat ) const { - return (S64)mBuffers->mMeasurements[stat.getIndex()].getSum(); + return (S64)mBuffers->mEvents[stat.getIndex()].getSum(); } @@ -283,67 +316,127 @@ U32 Recording::getSampleCount( const TraceType >& stat ) c U32 Recording::getSampleCount( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getSampleCount(); + return mBuffers->mCounts[stat.getIndex()].getSampleCount(); +} + +F64 Recording::getMin( const TraceType >& stat ) const +{ + return mBuffers->mSamplesFloat[stat.getIndex()].getMin(); +} + +S64 Recording::getMin( const TraceType >& stat ) const +{ + return mBuffers->mSamples[stat.getIndex()].getMin(); +} + +F64 Recording::getMax( const TraceType >& stat ) const +{ + return mBuffers->mSamplesFloat[stat.getIndex()].getMax(); +} + +S64 Recording::getMax( const TraceType >& stat ) const +{ + return mBuffers->mSamples[stat.getIndex()].getMax(); +} + +F64 Recording::getMean( const TraceType >& stat ) const +{ + return mBuffers->mSamplesFloat[stat.getIndex()].getMean(); +} + +F64 Recording::getMean( const TraceType >& stat ) const +{ + return mBuffers->mSamples[stat.getIndex()].getMean(); } -F64 Recording::getMin( const TraceType >& stat ) const +F64 Recording::getStandardDeviation( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getMin(); + return mBuffers->mSamplesFloat[stat.getIndex()].getStandardDeviation(); } -S64 Recording::getMin( const TraceType >& stat ) const +F64 Recording::getStandardDeviation( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getMin(); + return mBuffers->mSamples[stat.getIndex()].getStandardDeviation(); } -F64 Recording::getMax( const TraceType >& stat ) const +F64 Recording::getLastValue( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getMax(); + return mBuffers->mSamplesFloat[stat.getIndex()].getLastValue(); } -S64 Recording::getMax( const TraceType >& stat ) const +S64 Recording::getLastValue( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getMax(); + return mBuffers->mSamples[stat.getIndex()].getLastValue(); } -F64 Recording::getMean( const TraceType >& stat ) const +U32 Recording::getSampleCount( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getMean(); + return mBuffers->mSamplesFloat[stat.getIndex()].getSampleCount(); } -F64 Recording::getMean( const TraceType >& stat ) const +U32 Recording::getSampleCount( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getMean(); + return mBuffers->mSamples[stat.getIndex()].getSampleCount(); } -F64 Recording::getStandardDeviation( const TraceType >& stat ) const +F64 Recording::getMin( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getStandardDeviation(); + return mBuffers->mEventsFloat[stat.getIndex()].getMin(); } -F64 Recording::getStandardDeviation( const TraceType >& stat ) const +S64 Recording::getMin( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getStandardDeviation(); + return mBuffers->mEvents[stat.getIndex()].getMin(); } -F64 Recording::getLastValue( const TraceType >& stat ) const +F64 Recording::getMax( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getLastValue(); + return mBuffers->mEventsFloat[stat.getIndex()].getMax(); } -S64 Recording::getLastValue( const TraceType >& stat ) const +S64 Recording::getMax( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getLastValue(); + return mBuffers->mEvents[stat.getIndex()].getMax(); } -U32 Recording::getSampleCount( const TraceType >& stat ) const +F64 Recording::getMean( const TraceType >& stat ) const { - return mBuffers->mMeasurementsFloat[stat.getIndex()].getSampleCount(); + return mBuffers->mEventsFloat[stat.getIndex()].getMean(); } -U32 Recording::getSampleCount( const TraceType >& stat ) const +F64 Recording::getMean( const TraceType >& stat ) const { - return mBuffers->mMeasurements[stat.getIndex()].getSampleCount(); + return mBuffers->mEvents[stat.getIndex()].getMean(); +} + +F64 Recording::getStandardDeviation( const TraceType >& stat ) const +{ + return mBuffers->mEventsFloat[stat.getIndex()].getStandardDeviation(); +} + +F64 Recording::getStandardDeviation( const TraceType >& stat ) const +{ + return mBuffers->mEvents[stat.getIndex()].getStandardDeviation(); +} + +F64 Recording::getLastValue( const TraceType >& stat ) const +{ + return mBuffers->mEventsFloat[stat.getIndex()].getLastValue(); +} + +S64 Recording::getLastValue( const TraceType >& stat ) const +{ + return mBuffers->mEvents[stat.getIndex()].getLastValue(); +} + +U32 Recording::getSampleCount( const TraceType >& stat ) const +{ + return mBuffers->mEventsFloat[stat.getIndex()].getSampleCount(); +} + +U32 Recording::getSampleCount( const TraceType >& stat ) const +{ + return mBuffers->mEvents[stat.getIndex()].getSampleCount(); } /////////////////////////////////////////////////////////////////////// @@ -377,7 +470,7 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) if (other.mRecordingPeriods.empty()) return; EPlayState play_state = getPlayState(); - stop(); + pause(); EPlayState other_play_state = other.getPlayState(); other.pause(); @@ -466,8 +559,7 @@ LLTrace::Recording PeriodicRecording::snapshotCurRecording() const Recording& PeriodicRecording::getLastRecording() { - U32 num_periods = mRecordingPeriods.size(); - return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods]; + return getPrevRecording(1); } const Recording& PeriodicRecording::getLastRecording() const diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b339e72e5c..19a4fae737 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -117,11 +117,14 @@ namespace LLTrace void append(const RecordingBuffers& other); void merge(const RecordingBuffers& other); void reset(RecordingBuffers* other = NULL); + void flush(); AccumulatorBuffer > mCountsFloat; - AccumulatorBuffer > mMeasurementsFloat; AccumulatorBuffer > mCounts; - AccumulatorBuffer > mMeasurements; + AccumulatorBuffer > mSamplesFloat; + AccumulatorBuffer > mSamples; + AccumulatorBuffer > mEventsFloat; + AccumulatorBuffer > mEvents; AccumulatorBuffer mStackTimers; AccumulatorBuffer mMemStats; }; @@ -181,57 +184,101 @@ namespace LLTrace U32 getSampleCount(const TraceType >& stat) const; - // MeasurementStatHandle accessors - F64 getSum(const TraceType >& stat) const; - S64 getSum(const TraceType >& stat) const; + // SampleStatHandle accessors + F64 getMin(const TraceType >& stat) const; + S64 getMin(const TraceType >& stat) const; template - T getSum(const MeasurementStatHandle& stat) const + T getMin(const SampleStatHandle& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast::type_t> >&> (stat)); } - F64 getMin(const TraceType >& stat) const; - S64 getMin(const TraceType >& stat) const; + F64 getMax(const TraceType >& stat) const; + S64 getMax(const TraceType >& stat) const; template - T getMin(const MeasurementStatHandle& stat) const + T getMax(const SampleStatHandle& stat) const { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast::type_t> >&> (stat)); } - F64 getMax(const TraceType >& stat) const; - S64 getMax(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; template - T getMax(const MeasurementStatHandle& stat) const + T getMean(SampleStatHandle& stat) const { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } - F64 getMean(const TraceType >& stat) const; - F64 getMean(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; template - T getMean(MeasurementStatHandle& stat) const + T getStandardDeviation(const SampleStatHandle& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat) const; - F64 getStandardDeviation(const TraceType >& stat) const; + F64 getLastValue(const TraceType >& stat) const; + S64 getLastValue(const TraceType >& stat) const; template - T getStandardDeviation(const MeasurementStatHandle& stat) const + T getLastValue(const SampleStatHandle& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } - F64 getLastValue(const TraceType >& stat) const; - S64 getLastValue(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + + // EventStatHandle accessors + F64 getSum(const TraceType >& stat) const; + S64 getSum(const TraceType >& stat) const; + template + T getSum(const EventStatHandle& stat) const + { + return (T)getSum(static_cast::type_t> >&> (stat)); + } + + F64 getMin(const TraceType >& stat) const; + S64 getMin(const TraceType >& stat) const; + template + T getMin(const EventStatHandle& stat) const + { + return (T)getMin(static_cast::type_t> >&> (stat)); + } + + F64 getMax(const TraceType >& stat) const; + S64 getMax(const TraceType >& stat) const; + template + T getMax(const EventStatHandle& stat) const + { + return (T)getMax(static_cast::type_t> >&> (stat)); + } + + F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; + template + T getMean(EventStatHandle& stat) const + { + return (T)getMean(static_cast::type_t> >&> (stat)); + } + + F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; + template + T getStandardDeviation(const EventStatHandle& stat) const + { + return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); + } + + F64 getLastValue(const TraceType >& stat) const; + S64 getLastValue(const TraceType >& stat) const; template - T getLastValue(const MeasurementStatHandle& stat) const + T getLastValue(const EventStatHandle& stat) const { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } - U32 getSampleCount(const TraceType >& stat) const; - U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } @@ -272,13 +319,14 @@ namespace LLTrace const Recording& getPrevRecording(U32 offset) const; Recording snapshotCurRecording() const; + // catch all for stats that have a defined sum template typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t min_val = (std::numeric_limits::max)(); + typename T::value_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -287,13 +335,43 @@ namespace LLTrace return min_val; } + template + typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T min_val = std::numeric_limits::max(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); + } + return min_val; + } + + template + typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T min_val = std::numeric_limits::max(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); + } + return min_val; + } + template F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - F64 min_val = (std::numeric_limits::max)(); + F64 min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -302,13 +380,14 @@ namespace LLTrace return min_val; } + // catch all for stats that have a defined sum template typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t max_val = (std::numeric_limits::min)(); + typename T::value_t max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -317,13 +396,43 @@ namespace LLTrace return max_val; } + template + typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T max_val = std::numeric_limits::min(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); + } + return max_val; + } + + template + typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T max_val = std::numeric_limits::min(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); + } + return max_val; + } + template F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - F64 max_val = (std::numeric_limits::min)(); + F64 max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -332,13 +441,14 @@ namespace LLTrace return max_val; } + // catch all for stats that have a defined sum template - typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::mean_t mean = typename T::mean_t(); + typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -349,7 +459,65 @@ namespace LLTrace mean += mRecordingPeriods[index].getSum(stat); } } - mean /= num_periods; + mean = mean / num_periods; + return mean; + } + + template + typename SampleAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + LLUnit total_duration = 0.f; + + typename SampleAccumulator::mean_t mean = 0; + if (num_periods <= 0) { return mean; } + + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) + { + LLUnit recording_duration = mRecordingPeriods[index].getDuration(); + mean += mRecordingPeriods[index].getMean(stat) * recording_duration.value(); + total_duration += recording_duration; + } + } + + if (total_duration.value()) + { + mean = mean / total_duration; + } + return mean; + } + + template + typename EventAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename EventAccumulator::mean_t mean = 0; + if (num_periods <= 0) { return mean; } + + S32 total_sample_count = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) + { + S32 period_sample_count = mRecordingPeriods[index].getSampleCount(stat); + mean += mRecordingPeriods[index].getMean(stat) * period_sample_count; + total_sample_count += period_sample_count; + } + } + + if (total_sample_count) + { + mean = mean / total_sample_count; + } return mean; } @@ -359,7 +527,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::mean_t mean = typename T::mean_t(); + typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -370,7 +538,7 @@ namespace LLTrace mean += mRecordingPeriods[index].getPerSec(stat); } } - mean /= num_periods; + mean = mean / num_periods; return mean; } diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 2001b9cd7f..75c7cb2ff1 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -74,10 +74,12 @@ ThreadRecorder::~ThreadRecorder() { delete mRootTimer; - while(mActiveRecordings.size()) + if (!mActiveRecordings.empty()) { - mActiveRecordings.front()->mTargetRecording->stop(); + std::for_each(mActiveRecordings.begin(), mActiveRecordings.end(), DeletePointer()); + mActiveRecordings.clear(); } + set_thread_recorder(NULL); delete[] mTimeBlockTreeNodes; } @@ -97,34 +99,40 @@ void ThreadRecorder::activate( Recording* recording ) ActiveRecording* active_recording = new ActiveRecording(recording); if (!mActiveRecordings.empty()) { - mActiveRecordings.front()->mPartialRecording.handOffTo(active_recording->mPartialRecording); + mActiveRecordings.back()->mPartialRecording.handOffTo(active_recording->mPartialRecording); } - mActiveRecordings.push_front(active_recording); + mActiveRecordings.push_back(active_recording); - mActiveRecordings.front()->mPartialRecording.makePrimary(); + mActiveRecordings.back()->mPartialRecording.makePrimary(); } -ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::update( Recording* recording ) +ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringUpToDate( Recording* recording ) { - active_recording_list_t::iterator it, end_it; - for (it = mActiveRecordings.begin(), end_it = mActiveRecordings.end(); + if (mActiveRecordings.empty()) return mActiveRecordings.rend(); + + mActiveRecordings.back()->mPartialRecording.flush(); + + active_recording_list_t::reverse_iterator it, end_it; + for (it = mActiveRecordings.rbegin(), end_it = mActiveRecordings.rend(); it != end_it; ++it) { - active_recording_list_t::iterator next_it = it; + ActiveRecording* cur_recording = *it; + + active_recording_list_t::reverse_iterator next_it = it; ++next_it; // if we have another recording further down in the stack... - if (next_it != mActiveRecordings.end()) + if (next_it != mActiveRecordings.rend()) { // ...push our gathered data down to it - (*next_it)->mPartialRecording.append((*it)->mPartialRecording); + (*next_it)->mPartialRecording.append(cur_recording->mPartialRecording); } // copy accumulated measurements into result buffer and clear accumulator (mPartialRecording) - (*it)->moveBaselineToTarget(); + cur_recording->movePartialToTarget(); - if ((*it)->mTargetRecording == recording) + if (cur_recording->mTargetRecording == recording) { // found the recording, so return it break; @@ -139,28 +147,30 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::update( Record return it; } -AccumulatorBuffer > gCountsFloat; -AccumulatorBuffer > gMeasurementsFloat; -AccumulatorBuffer > gCounts; -AccumulatorBuffer > gMeasurements; -AccumulatorBuffer gStackTimers; -AccumulatorBuffer gMemStats; +AccumulatorBuffer > gCountsFloat; +AccumulatorBuffer > gMeasurementsFloat; +AccumulatorBuffer > gCounts; +AccumulatorBuffer > gMeasurements; +AccumulatorBuffer gStackTimers; +AccumulatorBuffer gMemStats; void ThreadRecorder::deactivate( Recording* recording ) { - active_recording_list_t::iterator it = update(recording); - if (it != mActiveRecordings.end()) + active_recording_list_t::reverse_iterator it = bringUpToDate(recording); + if (it != mActiveRecordings.rend()) { // and if we've found the recording we wanted to update - active_recording_list_t::iterator next_it = it; + active_recording_list_t::reverse_iterator next_it = it; ++next_it; - if (next_it != mActiveRecordings.end()) + if (next_it != mActiveRecordings.rend()) { - (*next_it)->mTargetRecording->mBuffers.write()->makePrimary(); + (*next_it)->mPartialRecording.makePrimary(); } - delete *it; - mActiveRecordings.erase(it); + active_recording_list_t::iterator recording_to_remove = (++it).base(); + llassert((*recording_to_remove)->mTargetRecording == recording); + delete *recording_to_remove; + mActiveRecordings.erase(recording_to_remove); } } @@ -169,10 +179,11 @@ ThreadRecorder::ActiveRecording::ActiveRecording( Recording* target ) { } -void ThreadRecorder::ActiveRecording::moveBaselineToTarget() +void ThreadRecorder::ActiveRecording::movePartialToTarget() { mTargetRecording->mBuffers.write()->append(mPartialRecording); - mPartialRecording.reset(); + // reset based on self to keep history + mPartialRecording.reset(&mPartialRecording); } @@ -180,21 +191,22 @@ void ThreadRecorder::ActiveRecording::moveBaselineToTarget() // SlaveThreadRecorder /////////////////////////////////////////////////////////////////////// -SlaveThreadRecorder::SlaveThreadRecorder() +SlaveThreadRecorder::SlaveThreadRecorder(MasterThreadRecorder& master) +: mMasterRecorder(master) { - getMasterThreadRecorder().addSlaveThread(this); + mMasterRecorder.addSlaveThread(this); } SlaveThreadRecorder::~SlaveThreadRecorder() { - getMasterThreadRecorder().removeSlaveThread(this); + mMasterRecorder.removeSlaveThread(this); } void SlaveThreadRecorder::pushToMaster() { mThreadRecording.stop(); { - LLMutexLock(getMasterThreadRecorder().getSlaveListMutex()); + LLMutexLock(mMasterRecorder.getSlaveListMutex()); mSharedData.appendFrom(mThreadRecording); } mThreadRecording.start(); @@ -243,7 +255,7 @@ void MasterThreadRecorder::pullFromSlaveThreads() LLMutexLock lock(&mSlaveListMutex); - RecordingBuffers& target_recording_buffers = mActiveRecordings.front()->mPartialRecording; + RecordingBuffers& target_recording_buffers = mActiveRecordings.back()->mPartialRecording; for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end(); it != end_it; ++it) diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index c44bcbd12d..17a2d4a9a9 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -39,15 +39,15 @@ namespace LLTrace { protected: struct ActiveRecording; - typedef std::list active_recording_list_t; + typedef std::vector active_recording_list_t; public: ThreadRecorder(); virtual ~ThreadRecorder(); void activate(Recording* recording); - active_recording_list_t::iterator update(Recording* recording); void deactivate(Recording* recording); + active_recording_list_t::reverse_iterator bringUpToDate(Recording* recording); virtual void pushToMaster() = 0; @@ -58,10 +58,10 @@ namespace LLTrace { ActiveRecording(Recording* target); - Recording* mTargetRecording; + Recording* mTargetRecording; RecordingBuffers mPartialRecording; - void moveBaselineToTarget(); + void movePartialToTarget(); }; Recording mThreadRecording; @@ -98,7 +98,7 @@ namespace LLTrace class LL_COMMON_API SlaveThreadRecorder : public ThreadRecorder { public: - SlaveThreadRecorder(); + SlaveThreadRecorder(MasterThreadRecorder& master); ~SlaveThreadRecorder(); // call this periodically to gather stats data for master thread to consume @@ -117,7 +117,8 @@ namespace LLTrace private: LLMutex mRecordingMutex; }; - SharedData mSharedData; + SharedData mSharedData; + MasterThreadRecorder& mMasterRecorder; }; } diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 972b436bdc..22ca90df7a 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -47,10 +47,6 @@ LLStatBar::LLStatBar(const Params& p) mMinBar(p.bar_min), mMaxBar(p.bar_max), mCurMaxBar(p.bar_max), - mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)), - mCountIntp(LLTrace::CountStatHandle::getInstance(p.stat)), - mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)), - mMeasurementIntp(LLTrace::MeasurementStatHandle::getInstance(p.stat)), mTickSpacing(p.tick_spacing), mPrecision(p.precision), mUpdatesPerSec(p.update_rate), @@ -63,7 +59,9 @@ LLStatBar::LLStatBar(const Params& p) mDisplayMean(p.show_mean), mOrientation(p.orientation), mScaleRange(p.scale_range) -{} +{ + setStat(p.stat); +} BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) { @@ -143,23 +141,41 @@ void LLStatBar::draw() mean = frame_recording.getPeriodMean(*mCountIntp, mNumFrames); } } - else if (mMeasurementFloatp) + else if (mEventFloatp) { - LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); - current = last_frame_recording.getLastValue(*mMeasurementFloatp); - min = frame_recording.getPeriodMin(*mMeasurementFloatp, mNumFrames); - max = frame_recording.getPeriodMax(*mMeasurementFloatp, mNumFrames); - mean = frame_recording.getPeriodMean(*mMeasurementFloatp, mNumFrames); + current = last_frame_recording.getMean(*mEventFloatp); + min = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames); + max = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames); + mean = frame_recording.getPeriodMean(*mEventFloatp, mNumFrames); } - else if (mMeasurementIntp) + else if (mEventIntp) { - LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); + + current = last_frame_recording.getLastValue(*mEventIntp); + min = frame_recording.getPeriodMin(*mEventIntp, mNumFrames); + max = frame_recording.getPeriodMax(*mEventIntp, mNumFrames); + mean = frame_recording.getPeriodMean(*mEventIntp, mNumFrames); + } + else if (mSampleFloatp) + { + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); + + current = last_frame_recording.getLastValue(*mSampleFloatp); + min = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames); + max = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames); + mean = frame_recording.getPeriodMean(*mSampleFloatp, mNumFrames); + } + else if (mSampleIntp) + { + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); - current = last_frame_recording.getLastValue(*mMeasurementIntp); - min = frame_recording.getPeriodMin(*mMeasurementIntp, mNumFrames); - max = frame_recording.getPeriodMax(*mMeasurementIntp, mNumFrames); - mean = frame_recording.getPeriodMean(*mMeasurementIntp, mNumFrames); + current = last_frame_recording.getLastValue(*mSampleIntp); + min = frame_recording.getPeriodMin(*mSampleIntp, mNumFrames); + max = frame_recording.getPeriodMax(*mSampleIntp, mNumFrames); + mean = frame_recording.getPeriodMean(*mSampleIntp, mNumFrames); } current *= mUnitScale; @@ -247,7 +263,7 @@ void LLStatBar::draw() } value_format = llformat( "%%.%df", mPrecision); - if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp)) + if (mDisplayBar && (mCountFloatp || mCountIntp || mEventFloatp || mEventIntp || mSampleFloatp || mSampleIntp)) { std::string tick_label; @@ -334,7 +350,7 @@ void LLStatBar::draw() ? (bar_right - bar_left) : (bar_top - bar_bottom); - if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp)) + if (mDisplayHistory && (mCountFloatp || mCountIntp || mEventFloatp || mEventIntp || mSampleFloatp || mSampleIntp)) { const S32 num_values = frame_recording.getNumPeriods() - 1; F32 begin = 0; @@ -362,19 +378,33 @@ void LLStatBar::draw() end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1; num_samples = recording.getSampleCount(*mCountIntp); } - else if (mMeasurementFloatp) + else if (mEventFloatp) { //rate isn't defined for measurement stats, so use mean - begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale); - end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; - num_samples = recording.getSampleCount(*mMeasurementFloatp); + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); } - else if (mMeasurementIntp) + else if (mEventIntp) { //rate isn't defined for measurement stats, so use mean - begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale); - end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1; - num_samples = recording.getSampleCount(*mMeasurementIntp); + begin = ((recording.getMean(*mEventIntp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventIntp); + } + else if (mSampleFloatp) + { + //rate isn't defined for sample stats, so use mean + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); + } + else if (mSampleIntp) + { + //rate isn't defined for sample stats, so use mean + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); } } else @@ -391,17 +421,29 @@ void LLStatBar::draw() end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1; num_samples = recording.getSampleCount(*mCountIntp); } - else if (mMeasurementFloatp) + else if (mEventFloatp) + { + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); + } + else if (mEventIntp) + { + begin = ((recording.getMean(*mEventIntp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventIntp); + } + else if (mSampleFloatp) { - begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale); - end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; - num_samples = recording.getSampleCount(*mMeasurementFloatp); + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); } - else if (mMeasurementIntp) + else if (mSampleIntp) { - begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale); - end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1; - num_samples = recording.getSampleCount(*mMeasurementIntp); + begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mEventFloatp); } } @@ -461,8 +503,10 @@ void LLStatBar::setStat(const std::string& stat_name) { mCountFloatp = LLTrace::CountStatHandle<>::getInstance(stat_name); mCountIntp = LLTrace::CountStatHandle::getInstance(stat_name); - mMeasurementFloatp = LLTrace::MeasurementStatHandle<>::getInstance(stat_name); - mMeasurementIntp = LLTrace::MeasurementStatHandle::getInstance(stat_name); + mEventFloatp = LLTrace::EventStatHandle<>::getInstance(stat_name); + mEventIntp = LLTrace::EventStatHandle::getInstance(stat_name); + mSampleFloatp = LLTrace::SampleStatHandle<>::getInstance(stat_name); + mSampleIntp = LLTrace::SampleStatHandle::getInstance(stat_name); } diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index db667aa07d..a0ed9699aa 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -111,10 +111,12 @@ private: bool mScaleRange; EOrientation mOrientation; - LLTrace::TraceType >* mCountFloatp; - LLTrace::TraceType >* mCountIntp; - LLTrace::TraceType >* mMeasurementFloatp; - LLTrace::TraceType >* mMeasurementIntp; + LLTrace::TraceType >* mCountFloatp; + LLTrace::TraceType >* mCountIntp; + LLTrace::TraceType >* mEventFloatp; + LLTrace::TraceType >* mEventIntp; + LLTrace::TraceType >* mSampleFloatp; + LLTrace::TraceType >* mSampleIntp; LLFrameTimer mUpdateTimer; LLUIString mLabel; diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index c9e33ed902..08681b3704 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -57,10 +57,12 @@ public: struct StatParams : public LLInitParam::ChoiceBlock { - Alternative >* > count_stat_float; - Alternative >* > count_stat_int; - Alternative >* > measurement_stat_float; - Alternative >* > measurement_stat_int; + Alternative >* > count_stat_float; + Alternative >* > count_stat_int; + Alternative >* > event_stat_float; + Alternative >* > event_stat_int; + Alternative >* > sample_stat_float; + Alternative >* > sample_stat_int; }; struct Params : public LLInitParam::Block diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a3fe2b656..edf874d744 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1244,7 +1244,7 @@ bool LLAppViewer::mainLoop() LLTrace::get_frame_recording().nextPeriod(); LLTrace::TimeBlock::logStats(); - LLTrace::getMasterThreadRecorder().pullFromSlaveThreads(); + LLTrace::getUIThreadRecorder().pullFromSlaveThreads(); //clear call stack records llclearcallstacks; diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index dbdf3e5e9f..b71ab4c53b 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -42,13 +42,13 @@ #include "llviewerjoystick.h" #include "llcheckboxctrl.h" -static LLTrace::MeasurementStatHandle<> sJoystickAxis1("Joystick axis 1"), - sJoystickAxis2("Joystick axis 2"), - sJoystickAxis3("Joystick axis 3"), - sJoystickAxis4("Joystick axis 4"), - sJoystickAxis5("Joystick axis 5"), - sJoystickAxis6("Joystick axis 6"); -static LLTrace::MeasurementStatHandle<>* sJoystickAxes[6] = +static LLTrace::SampleStatHandle<> sJoystickAxis1("Joystick axis 1"), + sJoystickAxis2("Joystick axis 2"), + sJoystickAxis3("Joystick axis 3"), + sJoystickAxis4("Joystick axis 4"), + sJoystickAxis5("Joystick axis 5"), + sJoystickAxis6("Joystick axis 6"); +static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = { &sJoystickAxis1, &sJoystickAxis2, diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 94c2e40bb1..15f2f6d762 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -462,7 +462,7 @@ void LLSceneMonitor::calcDiffAggregate() } } -static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); +static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); @@ -481,16 +481,18 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - sample(sFramePixelDiff, mDiffResult); + record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { mRecording->extend(); + llassert(mRecording->getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS)); } else { mRecording->getPotentialRecording().nextPeriod(); + llassert(mRecording->getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS)); } } } @@ -503,7 +505,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ofstream os(file_name.c_str()); - //total scene loading time os << std::setprecision(4); LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording(); @@ -565,7 +566,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); it != end_it; ++it) { @@ -588,7 +589,53 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); it != end_it; ++it) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f748344cc8..f060e8933b 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2071,7 +2071,7 @@ bool idle_startup() if (wearables_time > max_wearables_time()) { LLNotificationsUtil::add("ClothingLoading"); - add(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, 1); + record(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, wearables_time); LLStartUp::setStartupState( STATE_CLEANUP ); return TRUE; } diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index b945ec2318..f3406d9f8d 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -212,7 +212,7 @@ BOOL LLStatusBar::postBuild() pgp.rect(r); pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); pgp.mouse_opaque(false); - pgp.stat.measurement_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); + pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); pgp.units("%"); pgp.min(0.f); pgp.max(5.f); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 8bf7bcc398..910cb24bb2 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -65,8 +65,8 @@ #include "bufferstream.h" bool LLTextureFetchDebugger::sDebuggerEnabled = false ; -LLTrace::MeasurementStatHandle<> LLTextureFetch::sCacheHitRate("texture_cache_hits"); -LLTrace::MeasurementStatHandle<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency"); +LLTrace::SampleStatHandle<> LLTextureFetch::sCacheHitRate("texture_cache_hits"); +LLTrace::SampleStatHandle<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency"); ////////////////////////////////////////////////////////////////////////////// @@ -1833,7 +1833,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (log_to_viewer_log || log_to_sim) { U64 timeNow = LLTimer::getTotalTime(); - mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime); + mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime.value()); mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP); mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize); mFetcher->mTextureInfo.setRequestOffset(mID, mRequestedOffset); @@ -2278,7 +2278,7 @@ bool LLTextureFetchWorker::writeToCacheComplete() // Threads: Ttf void LLTextureFetchWorker::recordTextureStart(bool is_http) { - if (! mMetricsStartTime) + if (! mMetricsStartTime.value()) { mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); } @@ -2291,7 +2291,7 @@ void LLTextureFetchWorker::recordTextureStart(bool is_http) // Threads: Ttf void LLTextureFetchWorker::recordTextureDone(bool is_http) { - if (mMetricsStartTime) + if (mMetricsStartTime.value()) { LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_TEXTURE, is_http, diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 4dcb9dd4b8..573b32c4bd 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -308,8 +308,8 @@ private: LLMutex mQueueMutex; //to protect mRequestMap and mCommands only LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue. - static LLTrace::MeasurementStatHandle<> sCacheHitRate; - static LLTrace::MeasurementStatHandle<> sCacheReadLatency; + static LLTrace::SampleStatHandle<> sCacheHitRate; + static LLTrace::SampleStatHandle<> sCacheReadLatency; LLTextureCache* mTextureCache; LLImageDecodeThread* mImageDecodeThread; diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 8623af52ff..0bbf2cbbea 100644 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -233,7 +233,7 @@ namespace LLViewerAssetStatsFF &sDequeuedAssetRequestsOther }; - static LLTrace::MeasurementStatHandle sResponseAssetRequestsTempTextureHTTP ("assetresponsetimestemptexturehttp", + static LLTrace::EventStatHandle sResponseAssetRequestsTempTextureHTTP ("assetresponsetimestemptexturehttp", "Time spent responding to temporary texture asset http requests"), sResponseAssetRequestsTempTextureUDP ("assetresponsetimestemptextureudp", "Time spent responding to temporary texture asset udp requests"), @@ -250,7 +250,7 @@ namespace LLViewerAssetStatsFF sResponsedAssetRequestsOther ("assetresponsetimesother", "Time spent responding to other asset requests"); - static LLTrace::MeasurementStatHandle* sResponse[EVACCount] = { + static LLTrace::EventStatHandle* sResponse[EVACCount] = { &sResponseAssetRequestsTempTextureHTTP, &sResponseAssetRequestsTempTextureUDP, &sResponseAssetRequestsNonTempTextureHTTP, @@ -283,7 +283,6 @@ LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) mPhaseStats(src.mPhaseStats), mAvatarRezStates(src.mAvatarRezStates) { - src.mCurRecording->update(); mRegionRecordings = src.mRegionRecordings; mCurRecording = &mRegionRecordings[mRegionHandle]; @@ -485,7 +484,7 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output) .resp_mean(rec.getMean(*sResponse[EVACOtherGet]).value()); } - S32 fps = (S32)rec.getSum(LLStatViewer::FPS_SAMPLE); + S32 fps = (S32)rec.getLastValue(LLStatViewer::FPS_SAMPLE); if (!compact_output || fps != 0) { r.fps.count(fps); @@ -561,7 +560,7 @@ void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, { const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - sample(*sResponse[int(eac)], LLTrace::Microseconds(duration)); + record(*sResponse[int(eac)], LLTrace::Microseconds(duration)); } void record_avatar_stats() diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index 56eaa13df9..af99710aca 100644 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -83,7 +83,7 @@ public: * for compatibility with the pre-existing timestamp on the texture * fetcher class, LLTextureFetch. */ - typedef U64 duration_t; + typedef LLUnit duration_t; /** * Type for the region identifier used in stats. Currently uses diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 6f41abbd8a..5c2dd20ec3 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -69,7 +69,7 @@ public: protected: void recordMetrics() { - if (mMetricsStartTime) + if (mMetricsStartTime.value()) { // Okay, it appears this request was used for useful things. Record // the expected dequeue and duration of request processing. diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 50b14183c7..d912918129 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2222,7 +2222,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) ) { - sample(LLStatViewer::AGENT_POSITION_SNAP, LLTrace::Meters(diff.length())); + record(LLStatViewer::AGENT_POSITION_SNAP, LLTrace::Meters(diff.length())); } } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 6ffd3d8fa4..c6ac7af93c 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -95,7 +95,7 @@ extern LLPipeline gPipeline; U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check. std::map LLViewerObjectList::sIPAndPortToIndex; std::map LLViewerObjectList::sIndexAndLocalIDToUUID; -LLTrace::MeasurementStatHandle<> LLViewerObjectList::sCacheHitRate("object_cache_hits"); +LLTrace::SampleStatHandle<> LLViewerObjectList::sCacheHitRate("object_cache_hits"); LLViewerObjectList::LLViewerObjectList() { diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 65447156e7..464554245e 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -198,7 +198,7 @@ protected: std::vector mOrphanChildren; // UUID's of orphaned objects S32 mNumOrphans; - static LLTrace::MeasurementStatHandle<> sCacheHitRate; + static LLTrace::SampleStatHandle<> sCacheHitRate; typedef std::vector > vobj_list_t; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index e8196e9655..635611c02e 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -74,7 +74,6 @@ LLTrace::CountStatHandle<> FPS("framesrendered"), IM_COUNT("imcount", "IMs sent"), OBJECT_CREATE("objectcreate"), OBJECT_REZ("objectrez", "Object rez count"), - LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"), LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"), LSL_SAVES("lslsaves", "Number of times user has saved a script"), ANIMATION_UPLOADS("animationuploads", "Animations uploaded"), @@ -98,13 +97,7 @@ LLTrace::CountStatHandle KBIT("kbitstat"), ACTUAL_IN_KBIT("actualinkbitstat"), ACTUAL_OUT_KBIT("actualoutkbitstat"); -LLTrace::CountStatHandle AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"), - TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), - MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), - FPS_10_TIME("fps10time", "Seconds below 10 FPS"), - FPS_8_TIME("fps8time", "Seconds below 8 FPS"), - FPS_2_TIME("fps2time", "Seconds below 2 FPS"), - SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"), +LLTrace::CountStatHandle SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"), SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"), LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%"); @@ -129,36 +122,34 @@ SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "", LL_SIM_STAT_TIME_DIL SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS), SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS); -LLTrace::MeasurementStatHandle<> FPS_SAMPLE("fpssample"), - NUM_IMAGES("numimagesstat"), - NUM_RAW_IMAGES("numrawimagesstat"), - NUM_OBJECTS("numobjectsstat"), - NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), - NUM_SIZE_CULLED("numsizeculledstat"), - NUM_VIS_CULLED("numvisculledstat"), - ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"), - LIGHTING_DETAIL("lightingdetail", "Lighting Detail"), - VISIBLE_AVATARS("visibleavatars", "Visible Avatars"), - SHADER_OBJECTS("shaderobjects", "Object Shaders"), - DRAW_DISTANCE("drawdistance", "Draw Distance"), - CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled"), - PENDING_VFS_OPERATIONS("vfspendingoperations"), - PACKETS_LOST_PERCENT("packetslostpercentstat"), - WINDOW_WIDTH("windowwidth", "Window width"), - WINDOW_HEIGHT("windowheight", "Window height"); +LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"), + NUM_IMAGES("numimagesstat"), + NUM_RAW_IMAGES("numrawimagesstat"), + NUM_OBJECTS("numobjectsstat"), + NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), + NUM_SIZE_CULLED("numsizeculledstat"), + NUM_VIS_CULLED("numvisculledstat"), + ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"), + LIGHTING_DETAIL("lightingdetail", "Lighting Detail"), + VISIBLE_AVATARS("visibleavatars", "Visible Avatars"), + SHADER_OBJECTS("shaderobjects", "Object Shaders"), + DRAW_DISTANCE("drawdistance", "Draw Distance"), + PENDING_VFS_OPERATIONS("vfspendingoperations"), + PACKETS_LOST_PERCENT("packetslostpercentstat"), + WINDOW_WIDTH("windowwidth", "Window width"), + WINDOW_HEIGHT("windowheight", "Window height"); -LLTrace::MeasurementStatHandle AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections"); +static LLTrace::SampleStatHandle CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled"); - -LLTrace::MeasurementStatHandle GL_TEX_MEM("gltexmemstat"), - GL_BOUND_MEM("glboundmemstat"), - RAW_MEM("rawmemstat"), - FORMATTED_MEM("formattedmemstat"), - DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), - MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting"); +LLTrace::SampleStatHandle GL_TEX_MEM("gltexmemstat"), + GL_BOUND_MEM("glboundmemstat"), + RAW_MEM("rawmemstat"), + FORMATTED_MEM("formattedmemstat"), + DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), + MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting"); -SimMeasurement SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS), +SimMeasurement SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS), SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS), SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS), SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS), @@ -173,21 +164,32 @@ SimMeasurement SIM_FRAME_TIME("simframemsec", "", LL_SIM_ SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME), SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME); -SimMeasurement SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES), +SimMeasurement SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES), SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY); +LLTrace::SampleStatHandle FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), + FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), + SIM_PING("simpingstat"); + +LLTrace::EventStatHandle AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections"); + +LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"); + +LLTrace::EventStatHandle REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), + FRAME_STACKTIME("framestacktime", "FRAME_SECS"), + UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), + NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), + IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), + REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), + RENDER_STACKTIME("renderstacktime", "RENDER_SECS"); + +LLTrace::EventStatHandle AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"), + TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), + MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), + FPS_10_TIME("fps10time", "Seconds below 10 FPS"), + FPS_8_TIME("fps8time", "Seconds below 8 FPS"), + FPS_2_TIME("fps2time", "Seconds below 2 FPS"); -LLTrace::MeasurementStatHandle FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), - FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), - LOGIN_SECONDS("loginseconds", "Time between LoginRequest and LoginReply"), - REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), - FRAME_STACKTIME("framestacktime", "FRAME_SECS"), - UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), - NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), - IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), - REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), - RENDER_STACKTIME("renderstacktime", "RENDER_SECS"), - SIM_PING("simpingstat"); } @@ -230,15 +232,15 @@ void LLViewerStats::updateFrameStats(const F64 time_diff) if (time_diff >= 0.5) { - add(LLStatViewer::FPS_2_TIME, time_diff_seconds); + record(LLStatViewer::FPS_2_TIME, time_diff_seconds); } if (time_diff >= 0.125) { - add(LLStatViewer::FPS_8_TIME, time_diff_seconds); + record(LLStatViewer::FPS_8_TIME, time_diff_seconds); } if (time_diff >= 0.1) { - add(LLStatViewer::FPS_10_TIME, time_diff_seconds); + record(LLStatViewer::FPS_10_TIME, time_diff_seconds); } if (gFrameCount && mLastTimeDiff > 0.0) @@ -311,35 +313,36 @@ void update_statistics() { if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { - add(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds); + record(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds); } else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { - add(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds); + record(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds); } else if (LLFloaterReg::instanceVisible("build")) { - add(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds); + record(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds); } } LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); - sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); + sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); sample(LLStatViewer::LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail()); - sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip")); - sample(LLStatViewer::CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles")); + sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip")); + sample(LLStatViewer::CHAT_BUBBLES, gSavedSettings.getBOOL("UseChatBubbles")); typedef LLInstanceTracker, std::string> trace_type_t; - sample(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Frame")).as()); LLUnit idle_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Idle")); LLUnit network_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Network")); - sample(LLStatViewer::UPDATE_STACKTIME, idle_secs - network_secs); - sample(LLStatViewer::NETWORK_STACKTIME, network_secs); - sample(LLStatViewer::IMAGE_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Update Images")).as()); - sample(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Sort Draw State")).as()); - sample(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Render Geometry")).as()); + + record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Frame"))); + record(LLStatViewer::UPDATE_STACKTIME, idle_secs - network_secs); + record(LLStatViewer::NETWORK_STACKTIME, network_secs); + record(LLStatViewer::IMAGE_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Update Images"))); + record(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Sort Draw State"))); + record(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Render Geometry"))); LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost()); if (cdp) diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index e94ba23163..c0ac6d220f 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -46,10 +46,10 @@ struct SimMeasurementSampler : public LLInstanceTracker -struct SimMeasurement : public LLTrace::MeasurementStatHandle, public SimMeasurementSampler +struct SimMeasurement : public LLTrace::SampleStatHandle, public SimMeasurementSampler { SimMeasurement(const char* name, const char* description, ESimStatID stat_id) - : LLTrace::MeasurementStatHandle(name, description), + : LLTrace::SampleStatHandle(name, description), SimMeasurementSampler(stat_id) {} @@ -66,7 +66,8 @@ void sample(SimMeasurement& measurement, VALUE_T value) { LLTrace::sample(measurement, value); } -extern LLTrace::CountStatHandle<> FPS, + +extern LLTrace::CountStatHandle<> FPS, PACKETS_IN, PACKETS_LOST, PACKETS_OUT, @@ -76,7 +77,6 @@ extern LLTrace::CountStatHandle<> FPS, IM_COUNT, OBJECT_CREATE, OBJECT_REZ, - LOADING_WEARABLES_LONG_DELAY, LOGIN_TIMEOUTS, LSL_SAVES, ANIMATION_UPLOADS, @@ -102,15 +102,9 @@ extern LLTrace::CountStatHandle KBIT, ACTUAL_IN_KBIT, ACTUAL_OUT_KBIT; -extern LLTrace::CountStatHandle AVATAR_EDIT_TIME, - TOOLBOX_TIME, - MOUSELOOK_TIME, - FPS_10_TIME, - FPS_8_TIME, - FPS_2_TIME, - SIM_20_FPS_TIME, - SIM_PHYSICS_20_FPS_TIME, - LOSS_5_PERCENT_TIME; +extern LLTrace::CountStatHandle SIM_20_FPS_TIME, + SIM_PHYSICS_20_FPS_TIME, + LOSS_5_PERCENT_TIME; extern SimMeasurement<> SIM_TIME_DILATION, SIM_FPS, @@ -133,32 +127,29 @@ extern SimMeasurement<> SIM_TIME_DILATION, SIM_PHYSICS_PINNED_TASKS, SIM_PHYSICS_LOD_TASKS; -extern LLTrace::MeasurementStatHandle<> FPS_SAMPLE, - NUM_IMAGES, - NUM_RAW_IMAGES, - NUM_OBJECTS, - NUM_ACTIVE_OBJECTS, - NUM_SIZE_CULLED, - NUM_VIS_CULLED, - ENABLE_VBO, - LIGHTING_DETAIL, - VISIBLE_AVATARS, - SHADER_OBJECTS, - DRAW_DISTANCE, - CHAT_BUBBLES, - PENDING_VFS_OPERATIONS, - PACKETS_LOST_PERCENT, - WINDOW_WIDTH, - WINDOW_HEIGHT; - -extern LLTrace::MeasurementStatHandle AGENT_POSITION_SNAP; - -extern LLTrace::MeasurementStatHandle DELTA_BANDWIDTH, - MAX_BANDWIDTH, - GL_TEX_MEM, - GL_BOUND_MEM, - RAW_MEM, - FORMATTED_MEM; +extern LLTrace::SampleStatHandle<> FPS_SAMPLE, + NUM_IMAGES, + NUM_RAW_IMAGES, + NUM_OBJECTS, + NUM_ACTIVE_OBJECTS, + NUM_SIZE_CULLED, + NUM_VIS_CULLED, + ENABLE_VBO, + LIGHTING_DETAIL, + VISIBLE_AVATARS, + SHADER_OBJECTS, + DRAW_DISTANCE, + PENDING_VFS_OPERATIONS, + PACKETS_LOST_PERCENT, + WINDOW_WIDTH, + WINDOW_HEIGHT; + +extern LLTrace::SampleStatHandle DELTA_BANDWIDTH, + MAX_BANDWIDTH, + GL_TEX_MEM, + GL_BOUND_MEM, + RAW_MEM, + FORMATTED_MEM; extern SimMeasurement SIM_FRAME_TIME, SIM_NET_TIME, @@ -179,17 +170,29 @@ extern SimMeasurement SIM_UNACKED_BYTES, SIM_PHYSICS_MEM; -extern LLTrace::MeasurementStatHandle FRAMETIME_JITTER, - FRAMETIME_SLEW, - LOGIN_SECONDS, - REGION_CROSSING_TIME, - FRAME_STACKTIME, - UPDATE_STACKTIME, - NETWORK_STACKTIME, - IMAGE_STACKTIME, - REBUILD_STACKTIME, - RENDER_STACKTIME, - SIM_PING; +extern LLTrace::SampleStatHandle FRAMETIME_JITTER, + FRAMETIME_SLEW, + SIM_PING; + +extern LLTrace::EventStatHandle AGENT_POSITION_SNAP; + +extern LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY; + +extern LLTrace::EventStatHandle REGION_CROSSING_TIME, + FRAME_STACKTIME, + UPDATE_STACKTIME, + NETWORK_STACKTIME, + IMAGE_STACKTIME, + REBUILD_STACKTIME, + RENDER_STACKTIME; + +extern LLTrace::EventStatHandle AVATAR_EDIT_TIME, + TOOLBOX_TIME, + MOUSELOOK_TIME, + FPS_10_TIME, + FPS_8_TIME, + FPS_2_TIME; + } class LLViewerStats : public LLSingleton diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 08d296b88e..5299e7d2c1 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -249,7 +249,7 @@ std::string LLViewerWindow::sSnapshotDir; std::string LLViewerWindow::sMovieBaseName; -LLTrace::MeasurementStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity"); +LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity"); class RecordToChatConsole : public LLError::Recorder, public LLSingleton @@ -456,6 +456,8 @@ public: if (gSavedSettings.getBOOL("DebugShowRenderInfo")) { + LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); + if (gPipeline.getUseVertexShaders() == 0) { addText(xpos, ypos, "Shaders Disabled"); @@ -561,7 +563,7 @@ public: addText(xpos, ypos, llformat("%d Unique Textures", LLImageGL::sUniqueCount)); ypos += y_inc; - addText(xpos, ypos, llformat("%d Render Calls", gPipeline.mBatchCount)); + addText(xpos, ypos, llformat("%d Render Calls", last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize))); ypos += y_inc; addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects())); @@ -576,15 +578,10 @@ public: gPipeline.mTextureMatrixOps = 0; gPipeline.mMatrixOpCount = 0; - if (gPipeline.mBatchCount > 0) - { - addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", gPipeline.mMinBatchSize, gPipeline.mMaxBatchSize, - gPipeline.mTrianglesDrawn/gPipeline.mBatchCount)); - - gPipeline.mMinBatchSize = gPipeline.mMaxBatchSize; - gPipeline.mMaxBatchSize = 0; - gPipeline.mBatchCount = 0; - } + if (last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize) > 0) + { + addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", last_frame_recording.getMin(LLPipeline::sStatBatchSize), last_frame_recording.getMax(LLPipeline::sStatBatchSize), last_frame_recording.getMean(LLPipeline::sStatBatchSize))); + } ypos += y_inc; addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls)); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 004a59fda5..9fbb06a41e 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -250,7 +250,7 @@ public: S32 getCurrentMouseDX() const { return mCurrentMouseDelta.mX; } S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; } LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } - static LLTrace::MeasurementStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; } + static LLTrace::SampleStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } @@ -482,7 +482,7 @@ private: // Object temporarily hovered over while dragging LLPointer mDragHoveredObject; - static LLTrace::MeasurementStatHandle<> sMouseVelocityStat; + static LLTrace::SampleStatHandle<> sMouseVelocityStat; }; // diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 69f998f0f3..b6f48b4a66 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -914,7 +914,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) { ++mRegionCrossingCount; LLTrace::Seconds delta = mRegionCrossingTimer.getElapsedTimeF32(); - sample(LLStatViewer::REGION_CROSSING_TIME, delta); + record(LLStatViewer::REGION_CROSSING_TIME, delta); // Diagnostics llinfos << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << llendl; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3f6269e768..6a0ef13894 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -198,6 +198,7 @@ BOOL LLPipeline::CameraOffset; F32 LLPipeline::CameraMaxCoF; F32 LLPipeline::CameraDoFResScale; F32 LLPipeline::RenderAutoHideSurfaceAreaLimit; +LLTrace::EventStatHandle LLPipeline::sStatBatchSize("renderbatchsize"); const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f; @@ -403,17 +404,9 @@ bool addDeferredAttachments(LLRenderTarget& target) LLPipeline::LLPipeline() : mBackfaceCull(FALSE), - mBatchCount(0), mMatrixOpCount(0), mTextureMatrixOps(0), - mMaxBatchSize(0), - mMinBatchSize(0), - mMeanBatchSize(0), - mTrianglesDrawn(0), mNumVisibleNodes(0), - mVerticesRelit(0), - mLightingChanges(0), - mGeometryChanges(0), mNumVisibleFaces(0), mInitialized(FALSE), @@ -1809,17 +1802,7 @@ void LLPipeline::resetFrameStats() { assertInitialized(); - add(LLStatViewer::TRIANGLES_DRAWN, mTrianglesDrawn); - - if (mBatchCount > 0) - { - mMeanBatchSize = gPipeline.mTrianglesDrawn/gPipeline.mBatchCount; - } - mTrianglesDrawn = 0; sCompiles = 0; - mVerticesRelit = 0; - mLightingChanges = 0; - mGeometryChanges = 0; mNumVisibleFaces = 0; if (mOldRenderDebugMask != mRenderDebugMask) @@ -1827,7 +1810,6 @@ void LLPipeline::resetFrameStats() gObjectList.clearDebugText(); mOldRenderDebugMask = mRenderDebugMask; } - } //external functions for asynchronous updating @@ -2585,7 +2567,6 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) if (update_complete && assertInitialized()) { drawablep->setState(LLDrawable::BUILT); - mGeometryChanges++; } return update_complete; } @@ -3347,7 +3328,6 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) } } - mNumVisibleFaces += drawablep->getNumFaces(); } @@ -4516,10 +4496,8 @@ void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type) count = index_count/3; } - mTrianglesDrawn += count; - mBatchCount++; - mMaxBatchSize = llmax(mMaxBatchSize, count); - mMinBatchSize = llmin(mMinBatchSize, count); + record(sStatBatchSize, count); + add(LLStatViewer::TRIANGLES_DRAWN, count); if (LLPipeline::sRenderFrameTest) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 720ddf79f5..ec976d3ecc 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -492,23 +492,14 @@ public: LLQuaternion mFlyCamRotation; BOOL mBackfaceCull; - S32 mBatchCount; S32 mMatrixOpCount; S32 mTextureMatrixOps; - S32 mMaxBatchSize; - S32 mMinBatchSize; - S32 mMeanBatchSize; - S32 mTrianglesDrawn; S32 mNumVisibleNodes; - S32 mVerticesRelit; S32 mDebugTextureUploadCost; S32 mDebugSculptUploadCost; S32 mDebugMeshUploadCost; - S32 mLightingChanges; - S32 mGeometryChanges; - S32 mNumVisibleFaces; static S32 sCompiles; @@ -542,6 +533,8 @@ public: static S32 sVisibleLightCount; static F32 sMinRenderSize; + static LLTrace::EventStatHandle sStatBatchSize; + //screen texture U32 mScreenWidth; U32 mScreenHeight; -- cgit v1.2.3 From 074c1f1de45f60059c97cf9cfd0bbb9fddbb52c4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 May 2013 17:02:27 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics made LLCopyOnWritePointer enforce write access through write() again disabled some error checking on release for download builds --- indra/llcommon/llpointer.h | 3 +++ indra/llcommon/lltrace.h | 2 ++ 2 files changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index c83e55577d..e640ffd595 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -196,6 +196,9 @@ public: *(pointer_t*)(this) = new Type(*pointer_t::mPointer); } } + + const Type* operator->() const { return pointer_t::mPointer; } + const Type& operator*() const { return *pointer_t::mPointer; } }; #endif diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index f94576de45..e950a119d3 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -175,10 +175,12 @@ public: // 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