summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-03-18 08:43:03 -0700
committerRichard Linden <none@none>2013-03-18 08:43:03 -0700
commit8de397b19ec9e2f6206fd5ae57dba96c70e78b74 (patch)
tree722986d9114ffbcc47d57c00ec5cf32e2444281d /indra/llui
parent7b4d27ecbcb5ac702459be97cbf6b81354850658 (diff)
SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
changed LLCriticalDamp to LLSmoothInterpolation and sped up interpolator lookup improvements to stats display of llstatbar added scene load stats floater accessed with ctrl|shift|2
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/lllayoutstack.cpp6
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/llscrollbar.cpp4
-rw-r--r--indra/llui/llstatbar.cpp131
-rw-r--r--indra/llui/llstatbar.h12
-rw-r--r--indra/llui/lltabcontainer.cpp2
7 files changed, 117 insertions, 44 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 705fe16559..93ffa7b70d 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -758,11 +758,11 @@ void LLButton::draw()
mCurGlowStrength = lerp(mCurGlowStrength,
mFlashing ? (flash? 1.0 : 0.0)
: mHoverGlowStrength,
- LLCriticalDamp::getInterpolant(0.05f));
+ LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw button image, if available.
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 194d2b700c..d4a310b8cf 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -586,7 +586,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant));
if (panelp->mVisibleAmt > 0.99f)
{
panelp->mVisibleAmt = 1.f;
@@ -611,7 +611,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
if (panelp->mVisibleAmt < 0.001f)
{
panelp->mVisibleAmt = 0.f;
@@ -638,7 +638,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
}
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index cd6cc6a75e..13888920f9 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3673,7 +3673,7 @@ void LLTearOffMenu::draw()
if (getRect().getHeight() != mTargetHeight)
{
// animate towards target height
- reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
+ reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f))));
}
LLFloater::draw();
}
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 5d3bf7a670..92a80c73fe 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -493,11 +493,11 @@ void LLScrollbar::draw()
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
{
- mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw background and thumb.
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 2bc385061a..219ddad452 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -36,6 +36,7 @@
#include "lluictrlfactory.h"
#include "lltracerecording.h"
+#include "llcriticaldamp.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -45,6 +46,7 @@ LLStatBar::LLStatBar(const Params& p)
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
+ mCurMaxBar(p.bar_max),
mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)),
mCountIntp(LLTrace::CountStatHandle<S64>::getInstance(p.stat)),
mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)),
@@ -54,11 +56,14 @@ LLStatBar::LLStatBar(const Params& p)
mPrecision(p.precision),
mUpdatesPerSec(p.update_rate),
mUnitScale(p.unit_scale),
+ mNumFrames(p.num_frames),
+ mMaxHeight(p.max_height),
mPerSec(p.show_per_sec),
mDisplayBar(p.show_bar),
mDisplayHistory(p.show_history),
mDisplayMean(p.show_mean),
- mOrientation(p.orientation)
+ mOrientation(p.orientation),
+ mScaleRange(p.scale_range)
{}
BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -171,24 +176,38 @@ void LLStatBar::draw()
S32 bar_top, bar_left, bar_right, bar_bottom;
if (mOrientation == HORIZONTAL)
{
- bar_top = getRect().getHeight() - 15;
+ bar_top = llmax(5, getRect().getHeight() - 15);
bar_left = 0;
- bar_right = getRect().getWidth() - 80;
- bar_bottom = 0;
+ bar_right = getRect().getWidth() - 40;
+ bar_bottom = llmin(bar_top - 5, 0);
}
else // VERTICAL
{
- bar_top = getRect().getHeight() - 15; // 16 pixels from top.
+ bar_top = llmax(5, getRect().getHeight() - 15);
bar_left = 0;
bar_right = getRect().getWidth();
- bar_bottom = 20;
+ bar_bottom = llmin(bar_top - 5, 20);
}
const S32 tick_length = 4;
const S32 tick_width = 1;
+ if (mScaleRange)
+ {
+ F32 cur_max = mLabelSpacing;
+ while(max > cur_max)
+ {
+ cur_max += mLabelSpacing;
+ }
+ mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f);
+ }
+ else
+ {
+ mCurMaxBar = mMaxBar;
+ }
+
F32 value_scale = (mOrientation == HORIZONTAL)
- ? (bar_top - bar_bottom)/(mMaxBar - mMinBar)
- : (bar_right - bar_left)/(mMaxBar - mMinBar);
+ ? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar)
+ : (bar_right - bar_left)/(mCurMaxBar - mMinBar);
LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
@@ -209,7 +228,9 @@ void LLStatBar::draw()
// Draw the value.
if (mOrientation == HORIZONTAL)
{
-
+ LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(),
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
}
else
{
@@ -227,12 +248,13 @@ void LLStatBar::draw()
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- for (F32 tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
{
const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
const S32 end = begin + tick_width;
if (mOrientation == HORIZONTAL)
{
+ gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f));
}
else
{
@@ -241,7 +263,7 @@ void LLStatBar::draw()
}
// Draw the tick labels (and big ticks).
- for (F32 tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mLabelSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mLabelSpacing)
{
const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
const S32 end = begin + tick_width;
@@ -250,13 +272,17 @@ void LLStatBar::draw()
// draw labels for the tick marks
if (mOrientation == HORIZONTAL)
{
+ gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin,
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::LEFT, LLFontGL::VCENTER);
}
else
{
gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length,
LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLFontGL::LEFT, LLFontGL::TOP);
+ LLFontGL::RIGHT, LLFontGL::TOP);
}
}
@@ -288,69 +314,99 @@ void LLStatBar::draw()
gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
}
+ F32 span = (mOrientation == HORIZONTAL)
+ ? (bar_right - bar_left)
+ : (bar_top - bar_bottom);
+
if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
const S32 num_values = frame_recording.getNumPeriods() - 1;
- S32 begin = 0;
- S32 end = 0;
+ F32 begin = 0;
+ F32 end = 0;
S32 i;
- for (i = 1; i <= num_values; i++)
+ gGL.color4f( 1.f, 0.f, 0.f, 1.f );
+ gGL.begin( LLRender::QUADS );
+ const S32 max_frame = llmin(mNumFrames, num_values);
+ U32 num_samples = 0;
+ for (i = 1; i <= max_frame; i++)
{
+ F32 offset = ((F32)i / (F32)mNumFrames) * span;
+ LLTrace::Recording& recording = frame_recording.getPrevRecordingPeriod(i);
if (mPerSec)
{
if (mCountFloatp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).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 = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
}
else if (mMeasurementFloatp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ //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);
}
else if (mMeasurementIntp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ //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);
}
}
else
{
if (mCountFloatp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).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 = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
}
else if (mMeasurementFloatp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementFloatp);
}
else if (mMeasurementIntp)
{
- begin = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale);
- end = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementIntp);
}
}
+
+ if (!num_samples) continue;
+
if (mOrientation == HORIZONTAL)
{
- gl_rect_2d(bar_right - i, end, bar_right - i - 1, begin, LLColor4(1.f, 0.f, 0.f, 1.f));
+ gGL.vertex2f((F32)bar_right - offset, end);
+ gGL.vertex2f((F32)bar_right - offset, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, end);
}
else
{
- gl_rect_2d(begin, bar_bottom+i+1, end, bar_bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
+ gGL.vertex2i(begin, (F32)bar_bottom+offset+1.f);
+ gGL.vertex2i(begin, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset+1.f);
}
}
+ gGL.end();
}
else
{
@@ -410,7 +466,14 @@ LLRect LLStatBar::getRequiredRect()
{
if (mDisplayHistory)
{
- rect.mTop = 35 + LLTrace::get_frame_recording().getNumPeriods();
+ if (mOrientation == HORIZONTAL)
+ {
+ rect.mTop = mMaxHeight;
+ }
+ else
+ {
+ rect.mTop = 35 + llmin(mMaxHeight, llmin(mNumFrames, LLTrace::get_frame_recording().getNumPeriods()));
+ }
}
else
{
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index 0ec8aaeaa9..a83ccbe9e5 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -52,8 +52,11 @@ public:
Optional<bool> show_per_sec,
show_bar,
show_history,
- show_mean;
+ show_mean,
+ scale_range;
+ Optional<S32> num_frames,
+ max_height;
Optional<std::string> stat;
Optional<EOrientation> orientation;
@@ -71,6 +74,9 @@ public:
show_bar("show_bar", TRUE),
show_history("show_history", false),
show_mean("show_mean", true),
+ scale_range("scale_range", true),
+ num_frames("num_frames", 300),
+ max_height("max_height", 200),
stat("stat"),
orientation("orientation", VERTICAL)
{
@@ -92,15 +98,19 @@ public:
private:
F32 mMinBar;
F32 mMaxBar;
+ F32 mCurMaxBar;
F32 mTickSpacing;
F32 mLabelSpacing;
U32 mPrecision;
F32 mUpdatesPerSec;
F32 mUnitScale;
+ S32 mNumFrames;
+ S32 mMaxHeight;
bool mPerSec; // Use the per sec stats.
bool mDisplayBar; // Display the bar graph.
bool mDisplayHistory;
bool mDisplayMean; // If true, display mean, if false, display current value
+ bool mScaleRange;
EOrientation mOrientation;
LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5fc2cc350d..4df35f77a5 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -406,7 +406,7 @@ void LLTabContainer::draw()
}
}
- setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
+ setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f)));
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
if (!mIsVertical)