summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-08-29 22:50:56 -0700
committerRichard Linden <none@none>2012-08-29 22:50:56 -0700
commitb3e9c46c94dad0c81a5adcb9152521b5368c66a7 (patch)
tree5500efa88002b9c0cbcf6f23e78487742847f19d /indra/llcommon
parent5a03b8282da64433c2525f0950e8fb86995f66dc (diff)
SH-3275 WIP Run viewer metrics for object update messages
further cleanup of LLStat removed llfloaterlagmeter
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llstat.cpp84
-rw-r--r--indra/llcommon/llstat.h31
2 files changed, 25 insertions, 90 deletions
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index 3678c8e1c1..b46d2e58b2 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -51,9 +51,10 @@ void LLStat::reset()
mNextBin = 0;
}
-LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer)
-: mUseFrameTimer(use_frame_timer),
- mNumBins(num_bins),
+LLStat::LLStat(std::string name, BOOL use_frame_timer)
+: LLInstanceTracker<LLStat, std::string>(name),
+ mUseFrameTimer(use_frame_timer),
+ mNumBins(50),
mName(name),
mBins(NULL)
{
@@ -61,48 +62,24 @@ LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer)
mLastTime = 0.f;
reset();
-
- if (!mName.empty())
- {
- stat_map_t::iterator iter = getStatList().find(mName);
- if (iter != getStatList().end())
- llwarns << "LLStat with duplicate name: " << mName << llendl;
- getStatList().insert(std::make_pair(mName, this));
- }
-}
-
-LLStat::stat_map_t& LLStat::getStatList()
-{
- static LLStat::stat_map_t stat_list;
- return stat_list;
}
-
LLStat::~LLStat()
{
delete[] mBins;
-
- if (!mName.empty())
- {
- // handle multiple entries with the same name
- stat_map_t::iterator iter = getStatList().find(mName);
- while (iter != getStatList().end() && iter->second != this)
- ++iter;
- getStatList().erase(iter);
- }
-}
-
-void LLStat::start()
-{
- if (mUseFrameTimer)
- {
- mBins[mNextBin].mBeginTime = sFrameTimer.getElapsedSeconds();
- }
- else
- {
- mBins[mNextBin].mBeginTime = sTimer.getElapsedTimeF64();
- }
}
+//
+//void LLStat::start()
+//{
+// if (mUseFrameTimer)
+// {
+// mBins[mNextBin].mBeginTime = sFrameTimer.getElapsedSeconds();
+// }
+// else
+// {
+// mBins[mNextBin].mBeginTime = sTimer.getElapsedTimeF64();
+// }
+//}
void LLStat::addValue(const F32 value)
{
@@ -299,31 +276,6 @@ F32 LLStat::getMeanPerSec() const
}
}
-F32 LLStat::getMeanDuration() const
-{
- F32 dur = 0.0f;
- S32 count = 0;
- for (S32 i=0; (i < mNumBins) && (i < mNumValues); i++)
- {
- if (i == mNextBin)
- {
- continue;
- }
- dur += mBins[i].mDT;
- count++;
- }
-
- if (count > 0)
- {
- dur /= F32(count);
- return dur;
- }
- else
- {
- return 0.f;
- }
-}
-
F32 LLStat::getMaxPerSec() const
{
F32 value;
@@ -398,7 +350,3 @@ S32 LLStat::getNextBin() const
return mNextBin;
}
-F64 LLStat::getLastTime() const
-{
- return mLastTime;
-}
diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h
index 38377a010b..82a246275d 100644
--- a/indra/llcommon/llstat.h
+++ b/indra/llcommon/llstat.h
@@ -31,22 +31,18 @@
#include "lltimer.h"
#include "llframetimer.h"
+#include "llinstancetracker.h"
class LLSD;
// ----------------------------------------------------------------------------
-class LL_COMMON_API LLStat
+class LL_COMMON_API LLStat : public LLInstanceTracker<LLStat, std::string>
{
-private:
- typedef std::multimap<std::string, LLStat*> stat_map_t;
-
- static stat_map_t& getStatList();
-
public:
- LLStat(std::string name = std::string(), S32 num_bins = 32, BOOL use_frame_timer = FALSE);
+ LLStat(std::string name = std::string(), BOOL use_frame_timer = FALSE);
~LLStat();
- void start(); // Start the timer for the current "frame", otherwise uses the time tracked from
+ //void start(); // Start the timer for the current "frame", otherwise uses the time tracked from
// the last addValue
void reset();
void addValue(const F32 value = 1.f); // Adds the current value being tracked, and tracks the DT.
@@ -57,23 +53,24 @@ public:
F32 getPrev(S32 age) const; // Age is how many "addValues" previously - zero is current
F32 getPrevPerSec(S32 age) const; // Age is how many "addValues" previously - zero is current
+
F32 getCurrent() const;
F32 getCurrentPerSec() const;
F32 getMin() const;
F32 getMinPerSec() const;
+
F32 getMean() const;
F32 getMeanPerSec() const;
- F32 getMeanDuration() const;
+
F32 getMax() const;
F32 getMaxPerSec() const;
U32 getNumValues() const;
S32 getNumBins() const;
- F64 getLastTime() const;
private:
- BOOL mUseFrameTimer;
+ bool mUseFrameTimer;
U32 mNumValues;
U32 mNumBins;
F32 mLastValue;
@@ -93,6 +90,7 @@ private:
F32 mDT;
};
ValueEntry* mBins;
+
S32 mCurBin;
S32 mNextBin;
@@ -100,17 +98,6 @@ private:
static LLTimer sTimer;
static LLFrameTimer sFrameTimer;
-
-public:
- static LLStat* getStat(const std::string& name)
- {
- // return the first stat that matches 'name'
- stat_map_t::iterator iter = getStatList().find(name);
- if (iter != getStatList().end())
- return iter->second;
- else
- return NULL;
- }
};
#endif // LL_STAT_