summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltracerecording.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-08-12 20:05:16 -0700
committerRichard Linden <none@none>2013-08-12 20:05:16 -0700
commitcc31b4ae7934010762b8aaaa7e190c74a1cd7820 (patch)
tree61bb7e622417a5223fa108522e16f6b7dee147f3 /indra/llcommon/lltracerecording.cpp
parente340009fc59d59e59b2e8d903a884acb76b178eb (diff)
SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue bounces once per second
SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary made llerrs/infos/etc properly variadic wrt tags LL_INFOS("A", "B", "C") works, for example fixed unit tests remove llsimplestat
Diffstat (limited to 'indra/llcommon/lltracerecording.cpp')
-rw-r--r--indra/llcommon/lltracerecording.cpp150
1 files changed, 100 insertions, 50 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index a4d58d8ab1..42d97ce314 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -242,9 +242,7 @@ F64 Recording::getSum( const TraceType<EventAccumulator>& stat )
F64 Recording::getPerSec( const TraceType<CountAccumulator>& stat )
{
F64 sum = mBuffers->mCounts[stat.getIndex()].getSum();
- return (sum != 0.0)
- ? (sum / mElapsedSeconds.value())
- : 0.0;
+ return sum / mElapsedSeconds.value();
}
U32 Recording::getSampleCount( const TraceType<CountAccumulator>& stat )
@@ -522,71 +520,98 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
getCurRecording().splitTo(other.getCurRecording());
}
-
-F64 PeriodicRecording::getPeriodMean( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+F64 PeriodicRecording::getPeriodMin( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
{
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
- F64 mean = 0;
- if (num_periods <= 0) { return mean; }
-
- S32 total_sample_count = 0;
-
+ bool has_value = false;
+ F64 min_val = std::numeric_limits<F64>::max();
for (S32 i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + total_periods - i) % total_periods;
- Recording& recording = mRecordingPeriods[index];
-
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
- S32 period_sample_count = recording.getSampleCount(stat);
- mean += recording.getMean(stat) * period_sample_count;
- total_sample_count += period_sample_count;
+ min_val = llmin(min_val, recording.getMin(stat));
+ has_value = true;
}
}
- if (total_sample_count)
+ return has_value
+ ? min_val
+ : NaN;
+}
+
+F64 PeriodicRecording::getPeriodMax( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
+
+ bool has_value = false;
+ F64 max_val = std::numeric_limits<F64>::min();
+ for (S32 i = 1; i <= num_periods; i++)
{
- mean = mean / total_sample_count;
+ Recording& recording = getPrevRecording(i);
+ if (recording.hasValue(stat))
+ {
+ max_val = llmax(max_val, recording.getMax(stat));
+ has_value = true;
+ }
}
- return mean;
+
+ return has_value
+ ? max_val
+ : NaN;
}
-F64 PeriodicRecording::getPeriodMin( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+// calculates means using aggregates per period
+F64 PeriodicRecording::getPeriodMean( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
{
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
- F64 min_val = std::numeric_limits<F64>::max();
+ F64 mean = 0;
+ S32 valid_period_count = 0;
+
for (S32 i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + total_periods - i) % total_periods;
- Recording& recording = mRecordingPeriods[index];
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
- min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat));
+ mean += recording.getMean(stat);
+ valid_period_count++;
}
}
- return min_val;
+
+ return valid_period_count
+ ? mean / (F64)valid_period_count
+ : NaN;
}
-F64 PeriodicRecording::getPeriodMax( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+
+F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<EventAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
{
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
- F64 max_val = std::numeric_limits<F64>::min();
+ F64 period_mean = getPeriodMean(stat, num_periods);
+ F64 sum_of_squares = 0;
+ S32 valid_period_count = 0;
+
for (S32 i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + total_periods - i) % total_periods;
- Recording& recording = mRecordingPeriods[index];
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
- max_val = llmax(max_val, recording.getMax(stat));
+ F64 delta = recording.getMean(stat) - period_mean;
+ sum_of_squares += delta * delta;
+ valid_period_count++;
}
}
- return max_val;
+
+ return valid_period_count
+ ? sqrt((F64)sum_of_squares / (F64)valid_period_count)
+ : NaN;
}
F64 PeriodicRecording::getPeriodMin( const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
@@ -594,17 +619,21 @@ F64 PeriodicRecording::getPeriodMin( const TraceType<SampleAccumulator>& stat, s
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
+ bool has_value = false;
F64 min_val = std::numeric_limits<F64>::max();
for (S32 i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + total_periods - i) % total_periods;
- Recording& recording = mRecordingPeriods[index];
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
min_val = llmin(min_val, recording.getMin(stat));
+ has_value = true;
}
}
- return min_val;
+
+ return has_value
+ ? min_val
+ : NaN;
}
F64 PeriodicRecording::getPeriodMax(const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/)
@@ -612,17 +641,21 @@ F64 PeriodicRecording::getPeriodMax(const TraceType<SampleAccumulator>& stat, si
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
+ bool has_value = false;
F64 max_val = std::numeric_limits<F64>::min();
for (S32 i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + total_periods - i) % total_periods;
- Recording& recording = mRecordingPeriods[index];
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
max_val = llmax(max_val, recording.getMax(stat));
+ has_value = true;
}
}
- return max_val;
+
+ return has_value
+ ? max_val
+ : NaN;
}
@@ -631,31 +664,48 @@ F64 PeriodicRecording::getPeriodMean( const TraceType<SampleAccumulator>& stat,
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
- LLUnit<F64, LLUnits::Seconds> total_duration(0.f);
-
+ S32 valid_period_count = 0;
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;
- Recording& recording = mRecordingPeriods[index];
+ Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
{
- LLUnit<F64, LLUnits::Seconds> recording_duration = recording.getDuration();
- mean += recording.getMean(stat) * recording_duration.value();
- total_duration += recording_duration;
+ mean += recording.getMean(stat);
+ valid_period_count++;
}
}
- if (total_duration.value())
- {
- mean = mean / total_duration;
- }
- return mean;
+ return valid_period_count
+ ? mean / F64(valid_period_count)
+ : NaN;
}
+F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<SampleAccumulator>& stat, size_t num_periods /*= U32_MAX*/ )
+{
+ size_t total_periods = mRecordingPeriods.size();
+ num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
+ F64 period_mean = getPeriodMean(stat, num_periods);
+ S32 valid_period_count = 0;
+ F64 sum_of_squares = 0;
+
+ for (S32 i = 1; i <= num_periods; i++)
+ {
+ Recording& recording = getPrevRecording(i);
+ if (recording.hasValue(stat))
+ {
+ F64 delta = recording.getMean(stat) - period_mean;
+ sum_of_squares += delta * delta;
+ valid_period_count++;
+ }
+ }
+
+ return valid_period_count
+ ? sqrt(sum_of_squares / (F64)valid_period_count)
+ : NaN;
+}
///////////////////////////////////////////////////////////////////////
// ExtendableRecording