Skip to content
Snippets Groups Projects
Commit 0127e662 authored by Richard Linden's avatar Richard Linden
Browse files

stat bars with no stats now show n/a instead of o

parent 40a7c63e
Branches
Tags
No related merge requests found
...@@ -333,6 +333,21 @@ namespace LLTrace ...@@ -333,6 +333,21 @@ namespace LLTrace
const Recording& getPrevRecording(U32 offset) const; const Recording& getPrevRecording(U32 offset) const;
Recording snapshotCurRecording() const; Recording snapshotCurRecording() const;
template <typename T>
size_t getSampleCount(const TraceType<T>& stat, size_t num_periods = U32_MAX)
{
size_t total_periods = mNumPeriods;
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
size_t num_samples = 0;
for (S32 i = 1; i <= num_periods; i++)
{
S32 index = (mCurPeriod + total_periods - i) % total_periods;
num_samples += mRecordingPeriods[index].getSampleCount(stat);
}
return num_samples;
}
// //
// PERIODIC MIN // PERIODIC MIN
// //
......
...@@ -225,6 +225,9 @@ void LLStatBar::draw() ...@@ -225,6 +225,9 @@ void LLStatBar::draw()
max = 0, max = 0,
mean = 0; mean = 0;
S32 num_samples = 0;
LLLocalClipRect _(getLocalRect()); LLLocalClipRect _(getLocalRect());
LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
...@@ -236,6 +239,7 @@ void LLStatBar::draw() ...@@ -236,6 +239,7 @@ void LLStatBar::draw()
if (mPerSec) if (mPerSec)
{ {
unit_label += "/s"; unit_label += "/s";
num_samples = frame_recording.getSampleCount(*mCountFloatp, mNumFrames);
current = last_frame_recording.getPerSec(*mCountFloatp); current = last_frame_recording.getPerSec(*mCountFloatp);
min = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames); min = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
max = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames); max = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
...@@ -243,6 +247,7 @@ void LLStatBar::draw() ...@@ -243,6 +247,7 @@ void LLStatBar::draw()
} }
else else
{ {
num_samples = frame_recording.getSampleCount(*mCountFloatp, mNumFrames);
current = last_frame_recording.getSum(*mCountFloatp); current = last_frame_recording.getSum(*mCountFloatp);
min = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames); min = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames); max = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames);
...@@ -254,6 +259,7 @@ void LLStatBar::draw() ...@@ -254,6 +259,7 @@ void LLStatBar::draw()
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
unit_label = mUnitLabel.empty() ? mEventFloatp->getUnitLabel() : mUnitLabel; unit_label = mUnitLabel.empty() ? mEventFloatp->getUnitLabel() : mUnitLabel;
num_samples = frame_recording.getSampleCount(*mEventFloatp, mNumFrames);
current = last_frame_recording.getMean(*mEventFloatp); current = last_frame_recording.getMean(*mEventFloatp);
min = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames); min = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames); max = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames);
...@@ -264,6 +270,7 @@ void LLStatBar::draw() ...@@ -264,6 +270,7 @@ void LLStatBar::draw()
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
unit_label = mUnitLabel.empty() ? mSampleFloatp->getUnitLabel() : mUnitLabel; unit_label = mUnitLabel.empty() ? mSampleFloatp->getUnitLabel() : mUnitLabel;
num_samples = frame_recording.getSampleCount(*mSampleFloatp, mNumFrames);
current = last_frame_recording.getMean(*mSampleFloatp); current = last_frame_recording.getMean(*mSampleFloatp);
min = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames); min = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames); max = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames);
...@@ -329,7 +336,9 @@ void LLStatBar::draw() ...@@ -329,7 +336,9 @@ void LLStatBar::draw()
{ {
decimal_digits = 0; decimal_digits = 0;
} }
std::string value_str = llformat("%10.*f %s", decimal_digits, mean, unit_label.c_str()); std::string value_str = num_samples
? llformat("%10.*f %s", decimal_digits, mean, unit_label.c_str())
: "n/a";
// Draw the current value. // Draw the current value.
if (mOrientation == HORIZONTAL) if (mOrientation == HORIZONTAL)
...@@ -345,7 +354,8 @@ void LLStatBar::draw() ...@@ -345,7 +354,8 @@ void LLStatBar::draw()
LLFontGL::RIGHT, LLFontGL::TOP); LLFontGL::RIGHT, LLFontGL::TOP);
} }
if (mDisplayBar && (mCountFloatp || mEventFloatp || mSampleFloatp)) if (mDisplayBar
&& (mCountFloatp || mEventFloatp || mSampleFloatp))
{ {
// Draw the tick marks. // Draw the tick marks.
LLGLSUIDefault gls_ui; LLGLSUIDefault gls_ui;
...@@ -431,7 +441,6 @@ void LLStatBar::draw() ...@@ -431,7 +441,6 @@ void LLStatBar::draw()
if (begin < 0) if (begin < 0)
{ {
begin = 0; begin = 0;
llwarns << "Min:" << min << llendl;
} }
S32 end = (S32) ((max - mCurMinBar) * value_scale); S32 end = (S32) ((max - mCurMinBar) * value_scale);
...@@ -444,6 +453,8 @@ void LLStatBar::draw() ...@@ -444,6 +453,8 @@ void LLStatBar::draw()
gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f)); gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
} }
if (num_samples)
{
F32 span = (mOrientation == HORIZONTAL) F32 span = (mOrientation == HORIZONTAL)
? (bar_right - bar_left) ? (bar_right - bar_left)
: (bar_top - bar_bottom); : (bar_top - bar_bottom);
...@@ -529,6 +540,7 @@ void LLStatBar::draw() ...@@ -529,6 +540,7 @@ void LLStatBar::draw()
} }
} }
} }
}
LLView::draw(); LLView::draw();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment