summaryrefslogtreecommitdiff
path: root/indra/llui/llstatbar.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-09-30 10:41:29 -0700
committerRichard Linden <none@none>2012-09-30 10:41:29 -0700
commitb1baf982b1bd41a150233d0a28d3601226924c65 (patch)
tree6ec661467cac92ffae9070e2c3df9c51c614f060 /indra/llui/llstatbar.cpp
parent38354e19063478c8cda0408547ad05023b457041 (diff)
SH-3275 WIP Run viewer metrics for object update messages
factored out lltrace::sampler into separate file added rudimentary lltrace support to llstatgraph made llstatgraph use param blocks more effectively moves initial set of stats over to lltrace removed windows.h #defines for min and max
Diffstat (limited to 'indra/llui/llstatbar.cpp')
-rw-r--r--indra/llui/llstatbar.cpp79
1 files changed, 59 insertions, 20 deletions
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index a21d7aa6a1..2d1b582598 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -36,6 +36,7 @@
#include "llstat.h"
#include "lluictrlfactory.h"
+#include "lltracesampler.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -46,6 +47,8 @@ LLStatBar::LLStatBar(const Params& p)
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
mStatp(LLStat::getInstance(p.stat)),
+ mFloatStatp(LLTrace::Stat<F32>::getInstance(p.stat)),
+ mIntStatp(LLTrace::Stat<S32>::getInstance(p.stat)),
mTickSpacing(p.tick_spacing),
mLabelSpacing(p.label_spacing),
mPrecision(p.precision),
@@ -84,30 +87,66 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
void LLStatBar::draw()
{
- if (!mStatp)
+ F32 current = 0.f,
+ min = 0.f,
+ max = 0.f,
+ mean = 0.f;
+
+ if (mStatp)
{
-// llinfos << "No stats for statistics bar!" << llendl;
- return;
+ // Get the values.
+ if (mPerSec)
+ {
+ current = mStatp->getCurrentPerSec();
+ min = mStatp->getMinPerSec();
+ max = mStatp->getMaxPerSec();
+ mean = mStatp->getMeanPerSec();
+ }
+ else
+ {
+ current = mStatp->getCurrent();
+ min = mStatp->getMin();
+ max = mStatp->getMax();
+ mean = mStatp->getMean();
+ }
}
-
- // Get the values.
- F32 current, min, max, mean;
- if (mPerSec)
+ else if (mFloatStatp)
{
- current = mStatp->getCurrentPerSec();
- min = mStatp->getMinPerSec();
- max = mStatp->getMaxPerSec();
- mean = mStatp->getMeanPerSec();
+ LLTrace::Sampler* sampler = LLThread::getTraceData()->getPrimarySampler();
+ if (mPerSec)
+ {
+ current = sampler->getSum(*mFloatStatp) / sampler->getSampleTime();
+ min = sampler->getMin(*mFloatStatp) / sampler->getSampleTime();
+ max = sampler->getMax(*mFloatStatp) / sampler->getSampleTime();
+ mean = sampler->getMean(*mFloatStatp) / sampler->getSampleTime();
+ }
+ else
+ {
+ current = sampler->getSum(*mFloatStatp);
+ min = sampler->getMin(*mFloatStatp);
+ max = sampler->getMax(*mFloatStatp);
+ mean = sampler->getMean(*mFloatStatp);
+ }
}
- else
+ else if (mIntStatp)
{
- current = mStatp->getCurrent();
- min = mStatp->getMin();
- max = mStatp->getMax();
- mean = mStatp->getMean();
+ LLTrace::Sampler* sampler = LLThread::getTraceData()->getPrimarySampler();
+ if (mPerSec)
+ {
+ current = (F32)sampler->getSum(*mIntStatp) / sampler->getSampleTime();
+ min = (F32)sampler->getMin(*mIntStatp) / sampler->getSampleTime();
+ max = (F32)sampler->getMax(*mIntStatp) / sampler->getSampleTime();
+ mean = (F32)sampler->getMean(*mIntStatp) / sampler->getSampleTime();
+ }
+ else
+ {
+ current = (F32)sampler->getSum(*mIntStatp);
+ min = (F32)sampler->getMin(*mIntStatp);
+ max = (F32)sampler->getMax(*mIntStatp);
+ mean = (F32)sampler->getMean(*mIntStatp);
+ }
}
-
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
if (mDisplayMean)
@@ -153,7 +192,7 @@ void LLStatBar::draw()
LLFontGL::RIGHT, LLFontGL::TOP);
value_format = llformat( "%%.%df", mPrecision);
- if (mDisplayBar)
+ if (mDisplayBar && mStatp)
{
std::string tick_label;
@@ -213,9 +252,9 @@ void LLStatBar::draw()
right = (S32) ((max - mMinBar) * value_scale);
gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
- S32 num_values = mStatp->getNumValues() - 1;
if (mDisplayHistory)
{
+ S32 num_values = mStatp->getNumValues() - 1;
S32 i;
for (i = 0; i < num_values; i++)
{
@@ -270,7 +309,7 @@ LLRect LLStatBar::getRequiredRect()
if (mDisplayBar)
{
- if (mDisplayHistory)
+ if (mDisplayHistory && mStatp)
{
rect.mTop = 35 + mStatp->getNumBins();
}