summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltrace.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-10-03 19:32:59 -0700
committerRichard Linden <none@none>2012-10-03 19:32:59 -0700
commit8f5e83789254d19a1a31737b0d7515cd7e967b26 (patch)
treee010acddfb59491fe805371b91167e679b8fa598 /indra/llcommon/lltrace.h
parent7196619b4a0823a332e10b7f98464a1649e0dfd2 (diff)
SH-3405 WIP convert existing stats to lltrace system
SH-3403 FIX implement unit conversion LLUnit implements unit tracking and conversion added support for LLUnit to LLTrace duplicated most llstats into LLTrace equivalents
Diffstat (limited to 'indra/llcommon/lltrace.h')
-rw-r--r--indra/llcommon/lltrace.h62
1 files changed, 55 insertions, 7 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 39de79e4c1..6a889f74df 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -35,6 +35,7 @@
#include "lltimer.h"
#include "llrefcount.h"
#include "lltracerecording.h"
+#include "llunit.h"
#include <list>
@@ -42,11 +43,8 @@
#define TOKEN_PASTE(x, y) TOKEN_PASTE_ACTUAL(x, y)
#define RECORD_BLOCK_TIME(block_timer) LLTrace::BlockTimer::Recorder TOKEN_PASTE(block_time_recorder, __COUNTER__)(block_timer);
-
namespace LLTrace
{
- class Recording;
-
void init();
void cleanup();
@@ -325,10 +323,10 @@ namespace LLTrace
U32 mNumSamples;
};
- template <typename T>
+ template <typename T, typename IS_UNIT = void>
class LL_COMMON_API Measurement
: public TraceType<MeasurementAccumulator<T> >,
- public LLInstanceTracker<Measurement<T>, std::string>
+ public LLInstanceTracker<Measurement<T, IS_UNIT>, std::string>
{
public:
Measurement(const std::string& name)
@@ -343,13 +341,37 @@ namespace LLTrace
};
template <typename T>
+ class LL_COMMON_API Measurement <T, typename T::is_unit_t>
+ : public Measurement<typename T::value_t>
+ {
+ public:
+ typedef Measurement<typename T::value_t> base_measurement_t;
+ Measurement(const std::string& name)
+ : Measurement<typename T::value_t>(name)
+ {}
+
+ template<typename UNIT_T>
+ void sample(UNIT_T value)
+ {
+ base_measurement_t::sample(value.get());
+ }
+
+ template<typename UNIT_T>
+ typename T::value_t get()
+ {
+ UNIT_T value(*this);
+ return value.get();
+ }
+ };
+
+ template <typename T, typename IS_UNIT = void>
class LL_COMMON_API Rate
- : public TraceType<RateAccumulator<T> >,
+ : public TraceType<RateAccumulator<T> >,
public LLInstanceTracker<Rate<T>, std::string>
{
public:
Rate(const std::string& name)
- : TraceType(name),
+ : TraceType(name),
LLInstanceTracker(name)
{}
@@ -359,6 +381,30 @@ namespace LLTrace
}
};
+ template <typename T>
+ class LL_COMMON_API Rate <T, typename T::is_unit_t>
+ : public Rate<typename T::value_t>
+ {
+ public:
+ Rate(const std::string& name)
+ : Rate<typename T::value_t>(name)
+ {}
+
+ template<typename UNIT_T>
+ void add(UNIT_T value)
+ {
+ getPrimaryAccumulator().add(value.get());
+ }
+
+ template<typename UNIT_T>
+ typename T::value_t get()
+ {
+ UNIT_T value(*this);
+ return value.get();
+ }
+
+ };
+
class LL_COMMON_API TimerAccumulator
{
public:
@@ -482,6 +528,8 @@ namespace LLTrace
static Recorder::StackEntry sCurRecorder;
};
+ class Recording;
+
class LL_COMMON_API ThreadRecorder
{
public: