SL-16329 - track frame time and jitter (as average deviation frame to frame) in stats window
parent
68b75be652
commit
ca0b9a3753
|
|
@ -858,7 +858,6 @@ F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, S3
|
|||
: NaN;
|
||||
}
|
||||
|
||||
|
||||
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
|
|
@ -952,6 +951,32 @@ F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, S
|
|||
: NaN;
|
||||
}
|
||||
|
||||
F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
num_periods = llmin(num_periods, getNumRecordedPeriods());
|
||||
|
||||
std::vector<F64> buf;
|
||||
for (S32 i = 1; i <= num_periods; i++)
|
||||
{
|
||||
Recording& recording = getPrevRecording(i);
|
||||
if (recording.getDuration() > (F32Seconds)0.f)
|
||||
{
|
||||
if (recording.hasValue(stat))
|
||||
{
|
||||
buf.push_back(recording.getMean(stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buf.size()==0)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
std::sort(buf.begin(), buf.end());
|
||||
|
||||
return F64((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]);
|
||||
}
|
||||
|
||||
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
|
|
|
|||
|
|
@ -599,6 +599,35 @@ namespace LLTrace
|
|||
return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
|
||||
}
|
||||
|
||||
F64 getPeriodMedian( const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
|
||||
|
||||
template <typename T>
|
||||
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMedianPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
num_periods = llmin(num_periods, getNumRecordedPeriods());
|
||||
|
||||
std::vector <typename RelatedTypes<typename T::value_t>::fractional_t> buf;
|
||||
for (S32 i = 1; i <= num_periods; i++)
|
||||
{
|
||||
Recording& recording = getPrevRecording(i);
|
||||
if (recording.getDuration() > (F32Seconds)0.f)
|
||||
{
|
||||
buf.push_back(recording.getPerSec(stat));
|
||||
}
|
||||
}
|
||||
std::sort(buf.begin(), buf.end());
|
||||
|
||||
return typename RelatedTypes<T>::fractional_t((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename RelatedTypes<T>::fractional_t getPeriodMedianPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
return typename RelatedTypes<T>::fractional_t(getPeriodMedianPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
|
||||
}
|
||||
|
||||
//
|
||||
// PERIODIC STANDARD DEVIATION
|
||||
//
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ LLStatBar::Params::Params()
|
|||
tick_spacing("tick_spacing", 0.f),
|
||||
decimal_digits("decimal_digits", 3),
|
||||
show_bar("show_bar", false),
|
||||
show_median("show_median", false),
|
||||
show_history("show_history", false),
|
||||
scale_range("scale_range", true),
|
||||
num_frames("num_frames", 200),
|
||||
|
|
@ -186,6 +187,7 @@ LLStatBar::LLStatBar(const Params& p)
|
|||
mNumShortHistoryFrames(p.num_frames_short),
|
||||
mMaxHeight(p.max_height),
|
||||
mDisplayBar(p.show_bar),
|
||||
mShowMedian(p.show_median),
|
||||
mDisplayHistory(p.show_history),
|
||||
mOrientation(p.orientation),
|
||||
mAutoScaleMax(!p.bar_max.isProvided()),
|
||||
|
|
@ -318,7 +320,14 @@ void LLStatBar::draw()
|
|||
min = frame_recording.getPeriodMinPerSec(count_stat, num_frames);
|
||||
max = frame_recording.getPeriodMaxPerSec(count_stat, num_frames);
|
||||
mean = frame_recording.getPeriodMeanPerSec(count_stat, num_frames);
|
||||
display_value = mean;
|
||||
if (mShowMedian)
|
||||
{
|
||||
display_value = frame_recording.getPeriodMedianPerSec(count_stat, num_frames);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_value = mean;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STAT_EVENT:
|
||||
|
|
@ -344,7 +353,11 @@ void LLStatBar::draw()
|
|||
mean = frame_recording.getPeriodMean(sample_stat, num_frames);
|
||||
num_rapid_changes = calc_num_rapid_changes(frame_recording, sample_stat, RAPID_CHANGE_WINDOW);
|
||||
|
||||
if (num_rapid_changes / RAPID_CHANGE_WINDOW.value() > MAX_RAPID_CHANGES_PER_SEC)
|
||||
if (mShowMedian)
|
||||
{
|
||||
display_value = frame_recording.getPeriodMedian(sample_stat, num_frames);
|
||||
}
|
||||
else if (num_rapid_changes / RAPID_CHANGE_WINDOW.value() > MAX_RAPID_CHANGES_PER_SEC)
|
||||
{
|
||||
display_value = mean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,10 @@ public:
|
|||
bar_max,
|
||||
tick_spacing;
|
||||
|
||||
Optional<bool> show_bar,
|
||||
Optional<bool> show_bar,
|
||||
show_history,
|
||||
scale_range;
|
||||
scale_range,
|
||||
show_median; // default is mean
|
||||
|
||||
Optional<S32> decimal_digits,
|
||||
num_frames,
|
||||
|
|
@ -112,6 +113,7 @@ private:
|
|||
|
||||
bool mDisplayBar, // Display the bar graph.
|
||||
mDisplayHistory,
|
||||
mShowMedian,
|
||||
mAutoScaleMax,
|
||||
mAutoScaleMin;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -183,8 +183,9 @@ SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_S
|
|||
SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
|
||||
|
||||
LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"),
|
||||
FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
|
||||
SIM_PING("simpingstat");
|
||||
FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
|
||||
FRAMETIME("frametime", "Measured frame time"),
|
||||
SIM_PING("simpingstat");
|
||||
|
||||
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections");
|
||||
|
||||
|
|
@ -261,8 +262,12 @@ void LLViewerStats::updateFrameStats(const F64Seconds time_diff)
|
|||
// new "stutter" meter
|
||||
add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0);
|
||||
|
||||
sample(LLStatViewer::FRAMETIME, time_diff);
|
||||
|
||||
// old stats that were never really used
|
||||
sample(LLStatViewer::FRAMETIME_JITTER, F64Milliseconds (mLastTimeDiff - time_diff));
|
||||
F64Seconds jit = (F64Seconds) std::fabs((mLastTimeDiff - time_diff));
|
||||
LL_INFOS() << "times " << mLastTimeDiff << ", " << time_diff << " jit " << jit << LL_ENDL;
|
||||
sample(LLStatViewer::FRAMETIME_JITTER, jit);
|
||||
|
||||
F32Seconds average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount;
|
||||
sample(LLStatViewer::FRAMETIME_SLEW, F64Milliseconds (average_frametime - time_diff));
|
||||
|
|
|
|||
|
|
@ -218,8 +218,8 @@ extern SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM;
|
|||
|
||||
|
||||
extern LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER,
|
||||
FRAMETIME_SLEW,
|
||||
SIM_PING;
|
||||
FRAMETIME_SLEW,
|
||||
SIM_PING;
|
||||
|
||||
extern LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,25 @@
|
|||
decimal_digits="1"
|
||||
show_bar="true"
|
||||
show_history="true"/>
|
||||
<stat_bar name="frame_mean"
|
||||
label="frame (mean)"
|
||||
unit_label="ms"
|
||||
stat="frametime"
|
||||
decimal_digits="1"
|
||||
show_bar="false"
|
||||
show_history="false"/>
|
||||
<stat_bar name="frame_median"
|
||||
label="frame (median)"
|
||||
unit_label="ms"
|
||||
stat="frametime"
|
||||
show_median="true"
|
||||
decimal_digits="1"
|
||||
show_bar="false"
|
||||
show_history="false"/>
|
||||
<stat_bar name="framet_jitter"
|
||||
label="jitter"
|
||||
decimal_digits="1"
|
||||
stat="frametimejitter"/>
|
||||
<stat_bar name="bandwidth"
|
||||
label="UDP Data Received"
|
||||
stat="activemessagedatareceived"
|
||||
|
|
|
|||
Loading…
Reference in New Issue