summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-11-01 00:32:45 -0700
committerRichard Linden <none@none>2012-11-01 00:32:45 -0700
commit3ccbce90e37b92d5b32a2507804adc91bc58065d (patch)
tree519ae7f820bc8adde6617736c9d35c82c152705b /indra/llui
parentb71e991c1860bbea0387f9434cc2b4b31a26469a (diff)
parent819adb5eb4d7f982121f3dbd82750e05d26864d9 (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-interesting-metrics
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llstatbar.cpp138
-rw-r--r--indra/llui/llstatbar.h11
-rw-r--r--indra/llui/llstatgraph.cpp20
-rw-r--r--indra/llui/llstatgraph.h13
4 files changed, 120 insertions, 62 deletions
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 535c6f96e3..6b40f8d475 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -34,7 +34,6 @@
#include "llgl.h"
#include "llfontgl.h"
-#include "llstat.h"
#include "lluictrlfactory.h"
#include "lltracerecording.h"
@@ -46,8 +45,10 @@ LLStatBar::LLStatBar(const Params& p)
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
- mStatp(LLStat::getInstance(p.stat)),
- mNewStatp(LLTrace::Count<>::getInstance(p.stat)),
+ mCountFloatp(LLTrace::Count<>::getInstance(p.stat)),
+ mCountIntp(LLTrace::Count<S64>::getInstance(p.stat)),
+ mMeasurementFloatp(LLTrace::Measurement<>::getInstance(p.stat)),
+ mMeasurementIntp(LLTrace::Measurement<S64>::getInstance(p.stat)),
mTickSpacing(p.tick_spacing),
mLabelSpacing(p.label_spacing),
mPrecision(p.precision),
@@ -90,46 +91,62 @@ void LLStatBar::draw()
max = 0.f,
mean = 0.f;
- if (mStatp)
+ LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
+
+ if (mCountFloatp)
{
- // Get the values.
+ LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
+
if (mPerSec)
{
- current = mStatp->getCurrentPerSec();
- min = mStatp->getMinPerSec();
- max = mStatp->getMaxPerSec();
- mean = mStatp->getMeanPerSec();
+ current = last_frame_recording.getPerSec(*mCountFloatp);
+ min = frame_recording.getPeriodMinPerSec(*mCountFloatp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountFloatp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp);
}
else
{
- current = mStatp->getCurrent();
- min = mStatp->getMin();
- max = mStatp->getMax();
- mean = mStatp->getMean();
+ current = last_frame_recording.getSum(*mCountFloatp);
+ min = frame_recording.getPeriodMin(*mCountFloatp);
+ max = frame_recording.getPeriodMax(*mCountFloatp);
+ mean = frame_recording.getPeriodMean(*mCountFloatp);
}
}
- else if (mNewStatp)
+ else if (mCountIntp)
{
- LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
- LLTrace::Recording& windowed_frame_recording = frame_recording.getTotalRecording();
if (mPerSec)
{
- current = last_frame_recording.getPerSec(*mNewStatp);
- //min = frame_window_recording.getMin(*mNewStatp) / frame_window_recording.getDuration();
- //max = frame_window_recording.getMax(*mNewStatp) / frame_window_recording.getDuration();
- mean = windowed_frame_recording.getPerSec(*mNewStatp);//frame_window_recording.getMean(*mNewStatp) / frame_window_recording.getDuration();
+ current = last_frame_recording.getPerSec(*mCountIntp);
+ min = frame_recording.getPeriodMinPerSec(*mCountIntp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountIntp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountIntp);
}
else
{
- current = last_frame_recording.getSum(*mNewStatp);
- //min = last_frame_recording.getMin(*mNewStatp);
- //max = last_frame_recording.getMax(*mNewStatp);
- mean = windowed_frame_recording.getSum(*mNewStatp);
+ current = last_frame_recording.getSum(*mCountIntp);
+ min = frame_recording.getPeriodMin(*mCountIntp);
+ max = frame_recording.getPeriodMax(*mCountIntp);
+ mean = frame_recording.getPeriodMean(*mCountIntp);
}
}
-
+ else if (mMeasurementFloatp)
+ {
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementFloatp);
+ min = recording.getMin(*mMeasurementFloatp);
+ max = recording.getMax(*mMeasurementFloatp);
+ mean = recording.getMean(*mMeasurementFloatp);
+ }
+ else if (mMeasurementIntp)
+ {
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementIntp);
+ min = recording.getMin(*mMeasurementIntp);
+ max = recording.getMax(*mMeasurementIntp);
+ mean = recording.getMean(*mMeasurementIntp);
+ }
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
@@ -176,7 +193,7 @@ void LLStatBar::draw()
LLFontGL::RIGHT, LLFontGL::TOP);
value_format = llformat( "%%.%df", mPrecision);
- if (mDisplayBar && mStatp)
+ if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
std::string tick_label;
@@ -219,7 +236,7 @@ void LLStatBar::draw()
right = width;
gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
- if (mStatp->getNumValues() == 0)
+ if (frame_recording.getNumPeriods() == 0)
{
// No data, don't draw anything...
return;
@@ -236,26 +253,58 @@ 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));
- if (mDisplayHistory)
+ if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
- S32 num_values = mStatp->getNumValues() - 1;
+ S32 num_values = frame_recording.getNumPeriods() - 1;
S32 i;
- for (i = 0; i < num_values; i++)
+ for (i = 1; i <= num_values; i++)
{
- if (i == mStatp->getNextBin())
- {
- continue;
- }
if (mPerSec)
{
- left = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale) + 1;
+ if (mCountFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mCountIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ }
gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
}
else
{
- left = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale) + 1;
+ if (mCountFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mCountIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ }
gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
}
}
@@ -279,6 +328,15 @@ void LLStatBar::draw()
LLView::draw();
}
+void LLStatBar::setStat(const std::string& stat_name)
+{
+ mCountFloatp = LLTrace::Count<>::getInstance(stat_name);
+ mCountIntp = LLTrace::Count<S64>::getInstance(stat_name);
+ mMeasurementFloatp = LLTrace::Measurement<>::getInstance(stat_name);
+ mMeasurementIntp = LLTrace::Measurement<S64>::getInstance(stat_name);
+}
+
+
void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing)
{
mMinBar = bar_min;
@@ -293,9 +351,9 @@ LLRect LLStatBar::getRequiredRect()
if (mDisplayBar)
{
- if (mDisplayHistory && mStatp)
+ if (mDisplayHistory)
{
- rect.mTop = 35 + mStatp->getNumBins();
+ rect.mTop = 35 + LLTrace::get_frame_recording().getNumPeriods();
}
else
{
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index d510f0e3fe..6aefb1e213 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -30,7 +30,6 @@
#include "llview.h"
#include "llframetimer.h"
#include "lltracerecording.h"
-class LLStat;
class LLStatBar : public LLView
{
@@ -79,7 +78,8 @@ public:
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- void setStat(LLStat* stat) { mStatp = stat; }
+ void setStat(const std::string& stat_name);
+
void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
@@ -96,10 +96,11 @@ private:
BOOL mDisplayBar; // Display the bar graph.
BOOL mDisplayHistory;
BOOL mDisplayMean; // If true, display mean, if false, display current value
- LLTrace::PeriodicRecording* mFrameRecording;
- LLStat* mStatp;
- LLTrace::count_common_t* mNewStatp;
+ LLTrace::count_common_float_t* mCountFloatp;
+ LLTrace::count_common_int_t* mCountIntp;
+ LLTrace::measurement_common_float_t* mMeasurementFloatp;
+ LLTrace::measurement_common_int_t* mMeasurementIntp;
LLFrameTimer mUpdateTimer;
LLUIString mLabel;
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index e961e7d3c0..22c276a018 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -32,7 +32,6 @@
#include "llmath.h"
#include "llui.h"
-#include "llstat.h"
#include "llgl.h"
#include "llglheaders.h"
#include "lltracerecording.h"
@@ -48,8 +47,8 @@ LLStatGraph::LLStatGraph(const Params& p)
mPerSec(true),
mPrecision(p.precision),
mValue(p.value),
- mStatp(p.stat.legacy_stat),
- mNewStatp(p.stat.count_stat)
+ mNewStatFloatp(p.stat.count_stat_float),
+ mNewStatIntp(p.stat.count_stat_int)
{
setToolTip(p.name());
@@ -73,30 +72,31 @@ void LLStatGraph::draw()
{
F32 range, frac;
range = mMax - mMin;
- if (mStatp)
+ if (mNewStatFloatp)
{
+ LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
+
if (mPerSec)
{
- mValue = mStatp->getMeanPerSec();
+ mValue = recording.getPerSec(*mNewStatFloatp);
}
else
{
- mValue = mStatp->getMean();
+ mValue = recording.getSum(*mNewStatFloatp);
}
}
- else if (mNewStatp)
+ else if (mNewStatIntp)
{
LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
if (mPerSec)
{
- mValue = recording.getPerSec(*mNewStatp);
+ mValue = recording.getPerSec(*mNewStatIntp);
}
else
{
- mValue = recording.getSum(*mNewStatp);
+ mValue = recording.getSum(*mNewStatIntp);
}
-
}
frac = (mValue - mMin) / range;
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index b20966d608..f33c784262 100644
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -32,8 +32,6 @@
#include "v4color.h"
#include "lltrace.h"
-class LLStat;
-
class LLStatGraph : public LLView
{
public:
@@ -59,9 +57,10 @@ public:
struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
{
- Alternative<LLStat*> legacy_stat;
- Alternative<LLTrace::count_common_t* > count_stat;
- Alternative<LLTrace::measurement_common_t* > measurement_stat;
+ Alternative<LLTrace::count_common_float_t* > count_stat_float;
+ Alternative<LLTrace::count_common_int_t* > count_stat_int;
+ Alternative<LLTrace::measurement_common_float_t* > measurement_stat_float;
+ Alternative<LLTrace::measurement_common_int_t* > measurement_stat_int;
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -106,8 +105,8 @@ public:
/*virtual*/ void setValue(const LLSD& value);
private:
- LLStat* mStatp;
- LLTrace::count_common_t* mNewStatp;
+ LLTrace::count_common_float_t* mNewStatFloatp;
+ LLTrace::count_common_int_t* mNewStatIntp;
BOOL mPerSec;