summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lltrace.h96
-rw-r--r--indra/llcommon/lltracerecording.cpp268
-rw-r--r--indra/llcommon/lltracerecording.h209
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp7
-rw-r--r--indra/llui/llstatbar.cpp170
-rw-r--r--indra/llui/llstatbar.h9
-rw-r--r--indra/llui/llstatgraph.cpp16
-rw-r--r--indra/llui/llstatgraph.h12
-rw-r--r--indra/newview/llscenemonitor.cpp36
9 files changed, 297 insertions, 526 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 0daac95ea4..d6b51a63ee 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -273,25 +273,23 @@ protected:
const size_t mAccumulatorIndex;
};
-template<typename T>
class EventAccumulator
{
public:
- typedef T value_t;
+ typedef F64 value_t;
typedef F64 mean_t;
- typedef EventAccumulator<T> self_t;
EventAccumulator()
: mSum(0),
- mMin((std::numeric_limits<T>::max)()),
- mMax((std::numeric_limits<T>::min)()),
+ mMin((std::numeric_limits<F64>::max)()),
+ mMax((std::numeric_limits<F64>::min)()),
mMean(0),
mVarianceSum(0),
mNumSamples(0),
mLastValue(0)
{}
- void record(T value)
+ void record(F64 value)
{
mNumSamples++;
mSum += value;
@@ -305,12 +303,12 @@ public:
mMax = value;
}
F64 old_mean = mMean;
- mMean += ((F64)value - old_mean) / (F64)mNumSamples;
- mVarianceSum += ((F64)value - old_mean) * ((F64)value - mMean);
+ mMean += (value - old_mean) / (F64)mNumSamples;
+ mVarianceSum += (value - old_mean) * (value - mMean);
mLastValue = value;
}
- void addSamples(const self_t& other, bool append)
+ void addSamples(const EventAccumulator& other, bool append)
{
if (other.mNumSamples)
{
@@ -354,12 +352,12 @@ public:
}
}
- void reset(const self_t* other)
+ void reset(const EventAccumulator* other)
{
mNumSamples = 0;
mSum = 0;
- mMin = std::numeric_limits<T>::max();
- mMax = std::numeric_limits<T>::min();
+ mMin = std::numeric_limits<F64>::max();
+ mMax = std::numeric_limits<F64>::min();
mMean = 0;
mVarianceSum = 0;
mLastValue = other ? other->mLastValue : 0;
@@ -367,16 +365,16 @@ public:
void flush() {}
- 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 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:
- T mSum,
+ F64 mSum,
mMin,
mMax,
mLastValue;
@@ -388,18 +386,16 @@ private:
};
-template<typename T>
class SampleAccumulator
{
public:
- typedef T value_t;
+ typedef F64 value_t;
typedef F64 mean_t;
- typedef SampleAccumulator<T> self_t;
SampleAccumulator()
: mSum(0),
- mMin((std::numeric_limits<T>::max)()),
- mMax((std::numeric_limits<T>::min)()),
+ mMin((std::numeric_limits<F64>::max)()),
+ mMax((std::numeric_limits<F64>::min)()),
mMean(0),
mVarianceSum(0),
mLastSampleTimeStamp(LLTimer::getTotalSeconds()),
@@ -409,7 +405,7 @@ public:
mHasValue(false)
{}
- void sample(T value)
+ void sample(F64 value)
{
LLUnitImplicit<LLUnits::Seconds, F64> time_stamp = LLTimer::getTotalSeconds();
LLUnitImplicit<LLUnits::Seconds, F64> delta_time = time_stamp - mLastSampleTimeStamp;
@@ -418,15 +414,15 @@ public:
if (mHasValue)
{
mTotalSamplingTime += delta_time;
- mSum += (F64)mLastValue * 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) * ((F64)mLastValue - old_mean);
- mVarianceSum += delta_time * ((F64)mLastValue - old_mean) * ((F64)mLastValue - mMean);
+ mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean);
+ mVarianceSum += delta_time * (mLastValue - old_mean) * (mLastValue - mMean);
}
mLastValue = value;
@@ -434,7 +430,7 @@ public:
mHasValue = true;
}
- void addSamples(const self_t& other, bool append)
+ void addSamples(const SampleAccumulator& other, bool append)
{
if (other.mTotalSamplingTime)
{
@@ -485,12 +481,12 @@ public:
}
}
- void reset(const self_t* other)
+ void reset(const SampleAccumulator* other)
{
mNumSamples = 0;
mSum = 0;
- mMin = std::numeric_limits<T>::max();
- mMax = std::numeric_limits<T>::min();
+ mMin = std::numeric_limits<F64>::max();
+ mMax = std::numeric_limits<F64>::min();
mMean = other ? other->mLastValue : 0;
mVarianceSum = 0;
mLastSampleTimeStamp = LLTimer::getTotalSeconds();
@@ -506,22 +502,22 @@ public:
if (mHasValue)
{
- mSum += (F64)mLastValue * delta_time;
+ mSum += 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 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:
- T mSum,
+ F64 mSum,
mMin,
mMax,
mLastValue;
@@ -537,12 +533,10 @@ private:
U32 mNumSamples;
};
-template<typename T>
class CountAccumulator
{
public:
- typedef CountAccumulator<T> self_t;
- typedef T value_t;
+ typedef F64 value_t;
typedef F64 mean_t;
CountAccumulator()
@@ -550,19 +544,19 @@ public:
mNumSamples(0)
{}
- void add(T value)
+ void add(F64 value)
{
mNumSamples++;
mSum += value;
}
- void addSamples(const CountAccumulator<T>& other, bool /*append*/)
+ void addSamples(const CountAccumulator& other, bool /*append*/)
{
mSum += other.mSum;
mNumSamples += other.mNumSamples;
}
- void reset(const self_t* other)
+ void reset(const CountAccumulator* other)
{
mNumSamples = 0;
mSum = 0;
@@ -570,12 +564,12 @@ public:
void flush() {}
- T getSum() const { return (T)mSum; }
+ F64 getSum() const { return mSum; }
U32 getSampleCount() const { return mNumSamples; }
private:
- T mSum;
+ F64 mSum;
U32 mNumSamples;
};
@@ -659,11 +653,11 @@ public:
template <typename T = F64>
class EventStatHandle
-: public TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >
+: public TraceType<EventAccumulator>
{
public:
typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t;
- typedef TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t;
+ typedef TraceType<EventAccumulator> trace_t;
EventStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
@@ -679,11 +673,11 @@ void record(EventStatHandle<T>& measurement, VALUE_T value)
template <typename T = F64>
class SampleStatHandle
-: public TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >
+: public TraceType<SampleAccumulator>
{
public:
- typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t;
- typedef TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t;
+ typedef F64 storage_t;
+ typedef TraceType<SampleAccumulator> trace_t;
SampleStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
@@ -699,11 +693,11 @@ void sample(SampleStatHandle<T>& measurement, VALUE_T value)
template <typename T = F64>
class CountStatHandle
-: public TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >
+: public TraceType<CountAccumulator>
{
public:
typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t;
- typedef TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t;
+ typedef TraceType<CountAccumulator> trace_t;
CountStatHandle(const char* name, const char* description = NULL)
: trace_t(name)
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index aedb9c7542..61ba21a365 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -44,11 +44,8 @@ RecordingBuffers::RecordingBuffers()
void RecordingBuffers::handOffTo(RecordingBuffers& other)
{
- other.mCountsFloat.reset(&mCountsFloat);
other.mCounts.reset(&mCounts);
- other.mSamplesFloat.reset(&mSamplesFloat);
other.mSamples.reset(&mSamples);
- other.mEventsFloat.reset(&mEventsFloat);
other.mEvents.reset(&mEvents);
other.mStackTimers.reset(&mStackTimers);
other.mMemStats.reset(&mMemStats);
@@ -56,11 +53,8 @@ void RecordingBuffers::handOffTo(RecordingBuffers& other)
void RecordingBuffers::makePrimary()
{
- mCountsFloat.makePrimary();
mCounts.makePrimary();
- mSamplesFloat.makePrimary();
mSamples.makePrimary();
- mEventsFloat.makePrimary();
mEvents.makePrimary();
mStackTimers.makePrimary();
mMemStats.makePrimary();
@@ -85,11 +79,8 @@ bool RecordingBuffers::isPrimary() const
void RecordingBuffers::append( const RecordingBuffers& other )
{
- mCountsFloat.addSamples(other.mCountsFloat);
mCounts.addSamples(other.mCounts);
- mSamplesFloat.addSamples(other.mSamplesFloat);
mSamples.addSamples(other.mSamples);
- mEventsFloat.addSamples(other.mEventsFloat);
mEvents.addSamples(other.mEvents);
mMemStats.addSamples(other.mMemStats);
mStackTimers.addSamples(other.mStackTimers);
@@ -97,11 +88,8 @@ void RecordingBuffers::append( const RecordingBuffers& other )
void RecordingBuffers::merge( const RecordingBuffers& other)
{
- mCountsFloat.addSamples(other.mCountsFloat, false);
mCounts.addSamples(other.mCounts, false);
- mSamplesFloat.addSamples(other.mSamplesFloat, false);
mSamples.addSamples(other.mSamples, false);
- mEventsFloat.addSamples(other.mEventsFloat, false);
mEvents.addSamples(other.mEvents, false);
mMemStats.addSamples(other.mMemStats, false);
// for now, hold out timers from merge, need to be displayed per thread
@@ -110,11 +98,8 @@ void RecordingBuffers::merge( const RecordingBuffers& other)
void RecordingBuffers::reset(RecordingBuffers* other)
{
- mCountsFloat.reset(other ? &other->mCountsFloat : NULL);
mCounts.reset(other ? &other->mCounts : 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);
@@ -122,7 +107,6 @@ void RecordingBuffers::reset(RecordingBuffers* other)
void RecordingBuffers::flush()
{
- mSamplesFloat.flush();
mSamples.flush();
}
@@ -280,200 +264,100 @@ LLUnit<LLUnits::Bytes, F32> Recording::getPerSec(const TraceType<MemStatAccumula
}
-F64 Recording::getSum( const TraceType<CountAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mCountsFloat[stat.getIndex()].getSum();
-}
-
-S64 Recording::getSum( const TraceType<CountAccumulator<S64> >& stat )
+F64 Recording::getSum( const TraceType<CountAccumulator>& stat )
{
update();
return mBuffers->mCounts[stat.getIndex()].getSum();
}
-F64 Recording::getSum( const TraceType<EventAccumulator<F64> >& stat )
+F64 Recording::getSum( const TraceType<EventAccumulator>& stat )
{
update();
- return (F64)mBuffers->mEventsFloat[stat.getIndex()].getSum();
+ return (F64)mBuffers->mEvents[stat.getIndex()].getSum();
}
-S64 Recording::getSum( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getPerSec( const TraceType<CountAccumulator>& stat )
{
update();
- return (S64)mBuffers->mEvents[stat.getIndex()].getSum();
-}
-
-
-
-F64 Recording::getPerSec( const TraceType<CountAccumulator<F64> >& stat )
-{
- update();
- F64 sum = mBuffers->mCountsFloat[stat.getIndex()].getSum();
+ F64 sum = mBuffers->mCounts[stat.getIndex()].getSum();
return (sum != 0.0)
? (sum / mElapsedSeconds)
: 0.0;
}
-F64 Recording::getPerSec( const TraceType<CountAccumulator<S64> >& stat )
-{
- S64 sum = mBuffers->mCounts[stat.getIndex()].getSum();
- return (sum != 0)
- ? ((F64)sum / mElapsedSeconds)
- : 0.0;
-}
-
-U32 Recording::getSampleCount( const TraceType<CountAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mCountsFloat[stat.getIndex()].getSampleCount();
-}
-
-U32 Recording::getSampleCount( const TraceType<CountAccumulator<S64> >& stat )
+U32 Recording::getSampleCount( const TraceType<CountAccumulator>& stat )
{
update();
return mBuffers->mCounts[stat.getIndex()].getSampleCount();
}
-F64 Recording::getMin( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getMin();
-}
-
-S64 Recording::getMin( const TraceType<SampleAccumulator<S64> >& stat )
+F64 Recording::getMin( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getMin();
}
-F64 Recording::getMax( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getMax();
-}
-
-S64 Recording::getMax( const TraceType<SampleAccumulator<S64> >& stat )
+F64 Recording::getMax( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getMax();
}
-F64 Recording::getMean( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getMean();
-}
-
-F64 Recording::getMean( const TraceType<SampleAccumulator<S64> >& stat )
+F64 Recording::getMean( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getMean();
}
-F64 Recording::getStandardDeviation( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getStandardDeviation();
-}
-
-F64 Recording::getStandardDeviation( const TraceType<SampleAccumulator<S64> >& stat )
+F64 Recording::getStandardDeviation( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getStandardDeviation();
}
-F64 Recording::getLastValue( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getLastValue();
-}
-
-S64 Recording::getLastValue( const TraceType<SampleAccumulator<S64> >& stat )
+F64 Recording::getLastValue( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getLastValue();
}
-U32 Recording::getSampleCount( const TraceType<SampleAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mSamplesFloat[stat.getIndex()].getSampleCount();
-}
-
-U32 Recording::getSampleCount( const TraceType<SampleAccumulator<S64> >& stat )
+U32 Recording::getSampleCount( const TraceType<SampleAccumulator>& stat )
{
update();
return mBuffers->mSamples[stat.getIndex()].getSampleCount();
}
-F64 Recording::getMin( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getMin();
-}
-
-S64 Recording::getMin( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getMin( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getMin();
}
-F64 Recording::getMax( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getMax();
-}
-
-S64 Recording::getMax( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getMax( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getMax();
}
-F64 Recording::getMean( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getMean();
-}
-
-F64 Recording::getMean( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getMean( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getMean();
}
-F64 Recording::getStandardDeviation( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getStandardDeviation();
-}
-
-F64 Recording::getStandardDeviation( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getStandardDeviation( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getStandardDeviation();
}
-F64 Recording::getLastValue( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getLastValue();
-}
-
-S64 Recording::getLastValue( const TraceType<EventAccumulator<S64> >& stat )
+F64 Recording::getLastValue( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getLastValue();
}
-U32 Recording::getSampleCount( const TraceType<EventAccumulator<F64> >& stat )
-{
- update();
- return mBuffers->mEventsFloat[stat.getIndex()].getSampleCount();
-}
-
-U32 Recording::getSampleCount( const TraceType<EventAccumulator<S64> >& stat )
+U32 Recording::getSampleCount( const TraceType<EventAccumulator>& stat )
{
update();
return mBuffers->mEvents[stat.getIndex()].getSampleCount();
@@ -667,6 +551,122 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
getCurRecording().splitTo(other.getCurRecording());
}
+
+F64 PeriodicRecording::getPeriodMean( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ F64 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;
+}
+
+F64 PeriodicRecording::getPeriodMin( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ F64 min_val = std::numeric_limits<F64>::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;
+}
+
+F64 PeriodicRecording::getPeriodMax( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ F64 max_val = std::numeric_limits<F64>::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;
+}
+
+F64 PeriodicRecording::getPeriodMin( const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ F64 min_val = std::numeric_limits<F64>::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;
+}
+
+F64 PeriodicRecording::getPeriodMax(const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/)
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ F64 max_val = std::numeric_limits<F64>::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;
+}
+
+
+F64 PeriodicRecording::getPeriodMean( const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, total_periods);
+
+ LLUnit<LLUnits::Seconds, F64> total_duration = 0.f;
+
+ F64 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<LLUnits::Seconds, F64> 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;
+}
+
+
+
///////////////////////////////////////////////////////////////////////
// ExtendableRecording
///////////////////////////////////////////////////////////////////////
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 58b40fa378..b4452d67a0 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -119,12 +119,9 @@ namespace LLTrace
void reset(RecordingBuffers* other = NULL);
void flush();
- AccumulatorBuffer<CountAccumulator<F64> > mCountsFloat;
- AccumulatorBuffer<CountAccumulator<S64> > mCounts;
- AccumulatorBuffer<SampleAccumulator<F64> > mSamplesFloat;
- AccumulatorBuffer<SampleAccumulator<S64> > mSamples;
- AccumulatorBuffer<EventAccumulator<F64> > mEventsFloat;
- AccumulatorBuffer<EventAccumulator<S64> > mEvents;
+ AccumulatorBuffer<CountAccumulator> mCounts;
+ AccumulatorBuffer<SampleAccumulator> mSamples;
+ AccumulatorBuffer<EventAccumulator> mEvents;
AccumulatorBuffer<TimeBlockAccumulator> mStackTimers;
AccumulatorBuffer<MemStatAccumulator> mMemStats;
};
@@ -164,121 +161,105 @@ namespace LLTrace
LLUnit<LLUnits::Bytes, F32> getPerSec(const TraceType<MemStatAccumulator>& stat);
// CountStatHandle accessors
- F64 getSum(const TraceType<CountAccumulator<F64> >& stat);
- S64 getSum(const TraceType<CountAccumulator<S64> >& stat);
+ F64 getSum(const TraceType<CountAccumulator>& stat);
template <typename T>
T getSum(const CountStatHandle<T>& stat)
{
- return (T)getSum(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getSum(static_cast<const TraceType<CountAccumulator>&> (stat));
}
- F64 getPerSec(const TraceType<CountAccumulator<F64> >& stat);
- F64 getPerSec(const TraceType<CountAccumulator<S64> >& stat);
+ F64 getPerSec(const TraceType<CountAccumulator>& stat);
template <typename T>
T getPerSec(const CountStatHandle<T>& stat)
{
- return (T)getPerSec(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getPerSec(static_cast<const TraceType<CountAccumulator>&> (stat));
}
- U32 getSampleCount(const TraceType<CountAccumulator<F64> >& stat);
- U32 getSampleCount(const TraceType<CountAccumulator<S64> >& stat);
+ U32 getSampleCount(const TraceType<CountAccumulator>& stat);
// SampleStatHandle accessors
- F64 getMin(const TraceType<SampleAccumulator<F64> >& stat);
- S64 getMin(const TraceType<SampleAccumulator<S64> >& stat);
+ F64 getMin(const TraceType<SampleAccumulator>& stat);
template <typename T>
T getMin(const SampleStatHandle<T>& stat)
{
- return (T)getMin(static_cast<const TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMin(static_cast<const TraceType<SampleAccumulator>&> (stat));
}
- F64 getMax(const TraceType<SampleAccumulator<F64> >& stat);
- S64 getMax(const TraceType<SampleAccumulator<S64> >& stat);
+ F64 getMax(const TraceType<SampleAccumulator>& stat);
template <typename T>
T getMax(const SampleStatHandle<T>& stat)
{
- return (T)getMax(static_cast<const TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMax(static_cast<const TraceType<SampleAccumulator>&> (stat));
}
- F64 getMean(const TraceType<SampleAccumulator<F64> >& stat);
- F64 getMean(const TraceType<SampleAccumulator<S64> >& stat);
+ F64 getMean(const TraceType<SampleAccumulator>& stat);
template <typename T>
T getMean(SampleStatHandle<T>& stat)
{
- return (T)getMean(static_cast<const TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMean(static_cast<const TraceType<SampleAccumulator>&> (stat));
}
- F64 getStandardDeviation(const TraceType<SampleAccumulator<F64> >& stat);
- F64 getStandardDeviation(const TraceType<SampleAccumulator<S64> >& stat);
+ F64 getStandardDeviation(const TraceType<SampleAccumulator>& stat);
template <typename T>
T getStandardDeviation(const SampleStatHandle<T>& stat)
{
- return (T)getStandardDeviation(static_cast<const TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getStandardDeviation(static_cast<const TraceType<SampleAccumulator>&> (stat));
}
- F64 getLastValue(const TraceType<SampleAccumulator<F64> >& stat);
- S64 getLastValue(const TraceType<SampleAccumulator<S64> >& stat);
+ F64 getLastValue(const TraceType<SampleAccumulator>& stat);
template <typename T>
T getLastValue(const SampleStatHandle<T>& stat)
{
- return (T)getLastValue(static_cast<const TraceType<SampleAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getLastValue(static_cast<const TraceType<SampleAccumulator>&> (stat));
}
- U32 getSampleCount(const TraceType<SampleAccumulator<F64> >& stat);
- U32 getSampleCount(const TraceType<SampleAccumulator<S64> >& stat);
+ U32 getSampleCount(const TraceType<SampleAccumulator>& stat);
// EventStatHandle accessors
- F64 getSum(const TraceType<EventAccumulator<F64> >& stat);
- S64 getSum(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getSum(const TraceType<EventAccumulator>& stat);
template <typename T>
T getSum(const EventStatHandle<T>& stat)
{
- return (T)getSum(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getSum(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- F64 getMin(const TraceType<EventAccumulator<F64> >& stat);
- S64 getMin(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getMin(const TraceType<EventAccumulator>& stat);
template <typename T>
T getMin(const EventStatHandle<T>& stat)
{
- return (T)getMin(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMin(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- F64 getMax(const TraceType<EventAccumulator<F64> >& stat);
- S64 getMax(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getMax(const TraceType<EventAccumulator>& stat);
template <typename T>
T getMax(const EventStatHandle<T>& stat)
{
- return (T)getMax(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMax(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- F64 getMean(const TraceType<EventAccumulator<F64> >& stat);
- F64 getMean(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getMean(const TraceType<EventAccumulator>& stat);
template <typename T>
T getMean(EventStatHandle<T>& stat)
{
- return (T)getMean(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getMean(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- F64 getStandardDeviation(const TraceType<EventAccumulator<F64> >& stat);
- F64 getStandardDeviation(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getStandardDeviation(const TraceType<EventAccumulator>& stat);
template <typename T>
T getStandardDeviation(const EventStatHandle<T>& stat)
{
- return (T)getStandardDeviation(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getStandardDeviation(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- F64 getLastValue(const TraceType<EventAccumulator<F64> >& stat);
- S64 getLastValue(const TraceType<EventAccumulator<S64> >& stat);
+ F64 getLastValue(const TraceType<EventAccumulator>& stat);
template <typename T>
T getLastValue(const EventStatHandle<T>& stat)
{
- return (T)getLastValue(static_cast<const TraceType<EventAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));
+ return (T)getLastValue(static_cast<const TraceType<EventAccumulator>&> (stat));
}
- U32 getSampleCount(const TraceType<EventAccumulator<F64> >& stat);
- U32 getSampleCount(const TraceType<EventAccumulator<S64> >& stat);
+ U32 getSampleCount(const TraceType<EventAccumulator>& stat);
LLUnit<LLUnits::Seconds, F64> getDuration() const { return LLUnit<LLUnits::Seconds, F64>(mElapsedSeconds); }
@@ -335,34 +316,18 @@ namespace LLTrace
return min_val;
}
- template <typename T>
- T getPeriodMin(const TraceType<SampleAccumulator<T> >& stat, size_t num_periods = U32_MAX)
+ F64 getPeriodMin(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMin(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
{
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
-
- T min_val = std::numeric_limits<T>::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;
+ return T(getPeriodMin(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
}
-
- template <typename T>
- T getPeriodMin(const TraceType<EventAccumulator<T> >& stat, size_t num_periods = U32_MAX)
- {
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
- T min_val = std::numeric_limits<T>::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;
+ F64 getPeriodMin(const TraceType<EventAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMin(const EventStatHandle<T>& stat, size_t num_periods = U32_MAX)
+ {
+ return T(getPeriodMin(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
}
template <typename T>
@@ -396,34 +361,18 @@ namespace LLTrace
return max_val;
}
- template <typename T>
- T getPeriodMax(const TraceType<SampleAccumulator<T> >& stat, size_t num_periods = U32_MAX)
+ F64 getPeriodMax(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMax(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
{
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
-
- typename T max_val = std::numeric_limits<T>::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;
+ return T(getPeriodMax(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
}
- template <typename T>
- T getPeriodMax(const TraceType<EventAccumulator<T> >& stat, size_t num_periods = U32_MAX)
+ F64 getPeriodMax(const TraceType<EventAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMax(const EventStatHandle<T>& stat, size_t num_periods = U32_MAX)
{
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
-
- typename T max_val = std::numeric_limits<T>::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;
+ return T(getPeriodMax(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
}
template <typename T>
@@ -463,62 +412,18 @@ namespace LLTrace
return mean;
}
- template <typename T>
- typename SampleAccumulator<T>::mean_t getPeriodMean(const TraceType<SampleAccumulator<T> >& stat, size_t num_periods = U32_MAX)
+ F64 getPeriodMean(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
{
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
-
- LLUnit<LLUnits::Seconds, F64> total_duration = 0.f;
-
- typename SampleAccumulator<T>::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<LLUnits::Seconds, F64> 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;
+ return T(getPeriodMean(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
}
- template <typename T>
- typename EventAccumulator<T>::mean_t getPeriodMean(const TraceType<EventAccumulator<T> >& stat, size_t num_periods = U32_MAX)
+ F64 getPeriodMean(const TraceType<EventAccumulator>& stat, size_t num_periods = U32_MAX);
+ template<typename T>
+ T getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = U32_MAX)
{
- size_t total_periods = mRecordingPeriods.size();
- num_periods = llmin(num_periods, total_periods);
-
- typename EventAccumulator<T>::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;
+ return T(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
}
template <typename T>
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index c281b768ce..c1a0700eff 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -147,13 +147,6 @@ ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringU
return it;
}
-AccumulatorBuffer<CountAccumulator<F64> > gCountsFloat;
-AccumulatorBuffer<EventAccumulator<F64> > gMeasurementsFloat;
-AccumulatorBuffer<CountAccumulator<S64> > gCounts;
-AccumulatorBuffer<EventAccumulator<S64> > gMeasurements;
-AccumulatorBuffer<TimeBlockAccumulator> gStackTimers;
-AccumulatorBuffer<MemStatAccumulator> gMemStats;
-
void ThreadRecorder::deactivate( Recording* recording )
{
active_recording_list_t::reverse_iterator it = bringUpToDate(recording);
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 22ca90df7a..6966df8213 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -97,9 +97,9 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
void LLStatBar::draw()
{
F32 current = 0.f,
- min = 0.f,
- max = 0.f,
- mean = 0.f;
+ min = 0.f,
+ max = 0.f,
+ mean = 0.f;
LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
@@ -110,35 +110,16 @@ void LLStatBar::draw()
if (mPerSec)
{
current = last_frame_recording.getPerSec(*mCountFloatp);
- min = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
- max = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
- mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp, mNumFrames);
+ min = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
+ max = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp, mNumFrames);
}
else
{
current = last_frame_recording.getSum(*mCountFloatp);
- min = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames);
- max = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames);
- mean = frame_recording.getPeriodMean(*mCountFloatp, mNumFrames);
- }
- }
- else if (mCountIntp)
- {
- LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
-
- if (mPerSec)
- {
- current = last_frame_recording.getPerSec(*mCountIntp);
- min = frame_recording.getPeriodMinPerSec(*mCountIntp, mNumFrames);
- max = frame_recording.getPeriodMaxPerSec(*mCountIntp, mNumFrames);
- mean = frame_recording.getPeriodMeanPerSec(*mCountIntp, mNumFrames);
- }
- else
- {
- current = last_frame_recording.getSum(*mCountIntp);
- min = frame_recording.getPeriodMin(*mCountIntp, mNumFrames);
- max = frame_recording.getPeriodMax(*mCountIntp, mNumFrames);
- mean = frame_recording.getPeriodMean(*mCountIntp, mNumFrames);
+ min = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames);
+ max = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames);
+ mean = frame_recording.getPeriodMean(*mCountFloatp, mNumFrames);
}
}
else if (mEventFloatp)
@@ -146,42 +127,24 @@ void LLStatBar::draw()
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
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 (mEventIntp)
- {
- 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);
+ min = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames);
+ max = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames);
+ mean = frame_recording.getPeriodMean(*mEventFloatp, 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(*mSampleIntp);
- min = frame_recording.getPeriodMin(*mSampleIntp, mNumFrames);
- max = frame_recording.getPeriodMax(*mSampleIntp, mNumFrames);
- mean = frame_recording.getPeriodMean(*mSampleIntp, mNumFrames);
+ min = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames);
+ max = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames);
+ mean = frame_recording.getPeriodMean(*mSampleFloatp, mNumFrames);
}
current *= mUnitScale;
- min *= mUnitScale;
- max *= mUnitScale;
- mean *= mUnitScale;
+ min *= mUnitScale;
+ max *= mUnitScale;
+ mean *= mUnitScale;
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
@@ -199,16 +162,16 @@ void LLStatBar::draw()
S32 bar_top, bar_left, bar_right, bar_bottom;
if (mOrientation == HORIZONTAL)
{
- bar_top = llmax(5, getRect().getHeight() - 15);
- bar_left = 0;
- bar_right = getRect().getWidth() - 40;
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth() - 40;
bar_bottom = llmin(bar_top - 5, 0);
}
else // VERTICAL
{
- bar_top = llmax(5, getRect().getHeight() - 15);
- bar_left = 0;
- bar_right = getRect().getWidth();
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth();
bar_bottom = llmin(bar_top - 5, 20);
}
const S32 tick_length = 4;
@@ -263,7 +226,7 @@ void LLStatBar::draw()
}
value_format = llformat( "%%.%df", mPrecision);
- if (mDisplayBar && (mCountFloatp || mCountIntp || mEventFloatp || mEventIntp || mSampleFloatp || mSampleIntp))
+ if (mDisplayBar && (mCountFloatp || mEventFloatp || mSampleFloatp))
{
std::string tick_label;
@@ -272,7 +235,7 @@ void LLStatBar::draw()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
S32 last_tick = 0;
S32 last_label = 0;
- const S32 MIN_TICK_SPACING = mOrientation == HORIZONTAL ? 20 : 30;
+ const S32 MIN_TICK_SPACING = mOrientation == HORIZONTAL ? 20 : 30;
const S32 MIN_LABEL_SPACING = mOrientation == HORIZONTAL ? 40 : 60;
for (F32 tick_value = mMinBar + mTickSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
{
@@ -350,7 +313,7 @@ void LLStatBar::draw()
? (bar_right - bar_left)
: (bar_top - bar_bottom);
- if (mDisplayHistory && (mCountFloatp || mCountIntp || mEventFloatp || mEventIntp || mSampleFloatp || mSampleIntp))
+ if (mDisplayHistory && (mCountFloatp || mEventFloatp || mSampleFloatp))
{
const S32 num_values = frame_recording.getNumPeriods() - 1;
F32 begin = 0;
@@ -368,42 +331,22 @@ void LLStatBar::draw()
{
if (mCountFloatp)
{
- begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale);
- end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mCountFloatp);
}
- else if (mCountIntp)
- {
- begin = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale);
- end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
- num_samples = recording.getSampleCount(*mCountIntp);
- }
else if (mEventFloatp)
{
//rate isn't defined for measurement stats, so use mean
- begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
- end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mEventFloatp);
}
- else if (mEventIntp)
- {
- //rate isn't defined for measurement stats, so use mean
- 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;
+ begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mEventFloatp);
}
}
@@ -411,41 +354,23 @@ void LLStatBar::draw()
{
if (mCountFloatp)
{
- begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale);
- end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mCountFloatp);
}
- else if (mCountIntp)
- {
- begin = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale);
- end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
- num_samples = recording.getSampleCount(*mCountIntp);
- }
else if (mEventFloatp)
{
- begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
- end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
+ 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(*mEventFloatp) - mMinBar) * value_scale);
- end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mEventFloatp);
}
- else if (mSampleIntp)
- {
- begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
- end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
- num_samples = recording.getSampleCount(*mEventFloatp);
- }
- }
+ }
if (!num_samples) continue;
@@ -501,20 +426,17 @@ void LLStatBar::draw()
void LLStatBar::setStat(const std::string& stat_name)
{
- mCountFloatp = LLTrace::CountStatHandle<>::getInstance(stat_name);
- mCountIntp = LLTrace::CountStatHandle<S64>::getInstance(stat_name);
- mEventFloatp = LLTrace::EventStatHandle<>::getInstance(stat_name);
- mEventIntp = LLTrace::EventStatHandle<S64>::getInstance(stat_name);
- mSampleFloatp = LLTrace::SampleStatHandle<>::getInstance(stat_name);
- mSampleIntp = LLTrace::SampleStatHandle<S64>::getInstance(stat_name);
+ mCountFloatp = LLTrace::TraceType<LLTrace::CountAccumulator>::getInstance(stat_name);
+ mEventFloatp = LLTrace::TraceType<LLTrace::EventAccumulator>::getInstance(stat_name);
+ mSampleFloatp = LLTrace::TraceType<LLTrace::SampleAccumulator>::getInstance(stat_name);
}
void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing)
{
- mMinBar = bar_min;
- mMaxBar = bar_max;
- mTickSpacing = tick_spacing;
+ mMinBar = bar_min;
+ mMaxBar = bar_max;
+ mTickSpacing = tick_spacing;
}
LLRect LLStatBar::getRequiredRect()
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index a0ed9699aa..3daec297bb 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -111,12 +111,9 @@ private:
bool mScaleRange;
EOrientation mOrientation;
- LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp;
- LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp;
- LLTrace::TraceType<LLTrace::EventAccumulator<F64> >* mEventFloatp;
- LLTrace::TraceType<LLTrace::EventAccumulator<S64> >* mEventIntp;
- LLTrace::TraceType<LLTrace::SampleAccumulator<F64> >* mSampleFloatp;
- LLTrace::TraceType<LLTrace::SampleAccumulator<S64> >* mSampleIntp;
+ LLTrace::TraceType<LLTrace::CountAccumulator>* mCountFloatp;
+ LLTrace::TraceType<LLTrace::EventAccumulator>* mEventFloatp;
+ LLTrace::TraceType<LLTrace::SampleAccumulator>* mSampleFloatp;
LLFrameTimer mUpdateTimer;
LLUIString mLabel;
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index af01e66095..a44bc18733 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -47,8 +47,7 @@ LLStatGraph::LLStatGraph(const Params& p)
mPerSec(true),
mPrecision(p.precision),
mValue(p.value),
- mNewStatFloatp(p.stat.count_stat_float),
- mNewStatIntp(p.stat.count_stat_int)
+ mNewStatFloatp(p.stat.count_stat_float)
{
setToolTip(p.name());
@@ -77,19 +76,6 @@ void LLStatGraph::draw()
mValue = recording.getSum(*mNewStatFloatp);
}
}
- else if (mNewStatIntp)
- {
- LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecording();
-
- if (mPerSec)
- {
- mValue = recording.getPerSec(*mNewStatIntp);
- }
- else
- {
- mValue = recording.getSum(*mNewStatIntp);
- }
- }
frac = (mValue - mMin) / range;
frac = llmax(0.f, frac);
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index 08681b3704..38fe12d18b 100644
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -57,12 +57,9 @@ public:
struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
{
- Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float;
- Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int;
- Alternative<LLTrace::TraceType<LLTrace::EventAccumulator<F64> >* > event_stat_float;
- Alternative<LLTrace::TraceType<LLTrace::EventAccumulator<S64> >* > event_stat_int;
- Alternative<LLTrace::TraceType<LLTrace::SampleAccumulator<F64> >* > sample_stat_float;
- Alternative<LLTrace::TraceType<LLTrace::SampleAccumulator<S64> >* > sample_stat_int;
+ Alternative<LLTrace::TraceType<LLTrace::CountAccumulator>* > count_stat_float;
+ Alternative<LLTrace::TraceType<LLTrace::EventAccumulator>* > event_stat_float;
+ Alternative<LLTrace::TraceType<LLTrace::SampleAccumulator>* > sample_stat_float;
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -107,8 +104,7 @@ public:
/*virtual*/ void setValue(const LLSD& value);
private:
- LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mNewStatFloatp;
- LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mNewStatIntp;
+ LLTrace::TraceType<LLTrace::CountAccumulator>* mNewStatFloatp;
BOOL mPerSec;
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index bb1cfaa9a8..1bbd6ae2b9 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -493,6 +493,7 @@ void LLSceneMonitor::fetchQueryResult()
//dump results to a file _scene_xmonitor_results.csv
void LLSceneMonitor::dumpToFile(std::string file_name)
{
+ using namespace LLTrace;
if (!hasResults()) return;
LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL;
@@ -501,7 +502,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
os << std::setprecision(4);
- LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording();
+ PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording();
U32 frame_count = scene_load_recording.getNumPeriods();
LLUnit<LLUnits::Seconds, F64> frame_time;
@@ -514,7 +515,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
}
os << std::endl;
- for (LLTrace::CountStatHandle<F64>::instance_iter it = LLTrace::CountStatHandle<F64>::beginInstances(), end_it = LLTrace::CountStatHandle<F64>::endInstances();
+ for (CountStatHandle<F64>::instance_iter it = CountStatHandle<F64>::beginInstances(), end_it = CountStatHandle<F64>::endInstances();
it != end_it;
++it)
{
@@ -537,7 +538,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
}
}
- for (LLTrace::CountStatHandle<S64>::instance_iter it = LLTrace::CountStatHandle<S64>::beginInstances(), end_it = LLTrace::CountStatHandle<S64>::endInstances();
+ for (CountStatHandle<S64>::instance_iter it = CountStatHandle<S64>::beginInstances(), end_it = CountStatHandle<S64>::endInstances();
it != end_it;
++it)
{
@@ -560,7 +561,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
}
}
- for (LLTrace::EventStatHandle<F64>::instance_iter it = LLTrace::EventStatHandle<F64>::beginInstances(), end_it = LLTrace::EventStatHandle<F64>::endInstances();
+ for (EventStatHandle<F64>::instance_iter it = EventStatHandle<F64>::beginInstances(), end_it = EventStatHandle<F64>::endInstances();
it != end_it;
++it)
{
@@ -583,7 +584,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
}
}
- for (LLTrace::EventStatHandle<S64>::instance_iter it = LLTrace::EventStatHandle<S64>::beginInstances(), end_it = LLTrace::EventStatHandle<S64>::endInstances();
+ for (EventStatHandle<S64>::instance_iter it = EventStatHandle<S64>::beginInstances(), end_it = EventStatHandle<S64>::endInstances();
it != end_it;
++it)
{
@@ -606,30 +607,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
}
}
- for (LLTrace::SampleStatHandle<F64>::instance_iter it = LLTrace::SampleStatHandle<F64>::beginInstances(), end_it = LLTrace::SampleStatHandle<F64>::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<S64>::instance_iter it = LLTrace::SampleStatHandle<S64>::beginInstances(), end_it = LLTrace::SampleStatHandle<S64>::endInstances();
+ for (TraceType<SampleAccumulator>::instance_iter it = TraceType<SampleAccumulator>::beginInstances(), end_it = TraceType<SampleAccumulator>::endInstances();
it != end_it;
++it)
{