summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-10-02 15:37:16 -0700
committerRichard Linden <none@none>2012-10-02 15:37:16 -0700
commitdbe9742703cf14db85ec3d16c540efc68dce95a6 (patch)
treee15c2814f98a4cbdcd9d281ce4762f2fca5a86a5 /indra
parent14b1b0b2bb6bac5bc688cc4d14c33f1b680dd3b4 (diff)
SH-3404 create sampler class
renamed LLTrace::ThreadTrace to LLTrace::ThreadRecorder renamed LLTrace::Sampler to LLTrace::Recording
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/CMakeLists.txt4
-rw-r--r--indra/llcommon/llapr.cpp23
-rw-r--r--indra/llcommon/llapr.h26
-rw-r--r--indra/llcommon/llqueuedthread.cpp2
-rw-r--r--indra/llcommon/llthread.cpp4
-rw-r--r--indra/llcommon/lltrace.cpp143
-rw-r--r--indra/llcommon/lltrace.h66
-rw-r--r--indra/llcommon/lltracerecording.cpp (renamed from indra/llcommon/lltracesampler.cpp)44
-rw-r--r--indra/llcommon/lltracerecording.h (renamed from indra/llcommon/lltracesampler.h)26
-rw-r--r--indra/llui/llstatbar.cpp20
-rw-r--r--indra/llui/llstatgraph.cpp8
-rw-r--r--indra/newview/llappviewer.cpp2
-rwxr-xr-xindra/newview/llviewerstats.cpp3
-rwxr-xr-xindra/newview/llviewerstats.h7
-rw-r--r--indra/newview/llviewertexturelist.cpp4
15 files changed, 187 insertions, 195 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index e10dbb3e4d..1ccee23e1e 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -101,7 +101,7 @@ set(llcommon_SOURCE_FILES
llthreadsafequeue.cpp
lltimer.cpp
lltrace.cpp
- lltracesampler.cpp
+ lltracerecording.cpp
lluri.cpp
lluuid.cpp
llworkerthread.cpp
@@ -244,7 +244,7 @@ set(llcommon_HEADER_FILES
llthreadsafequeue.h
lltimer.h
lltrace.h
- lltracesampler.h
+ lltracerecording.h
lltreeiterators.h
lltypeinfolookup.h
lluri.h
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index d23b70690d..1db3aa9e89 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -486,29 +486,6 @@ S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset)
//
bool LLThreadLocalPointerBase::sInitialized = false;
-LLThreadLocalPointerBase::LLThreadLocalPointerBase()
-: mThreadKey(NULL)
-{
- if (sInitialized)
- {
- initStorage();
- }
-}
-
-LLThreadLocalPointerBase::LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other)
-: mThreadKey(NULL)
-{
- if (sInitialized)
- {
- initStorage();
- }
-}
-
-LLThreadLocalPointerBase::~LLThreadLocalPointerBase()
-{
- destroyStorage();
-}
-
void LLThreadLocalPointerBase::set( void* value )
{
llassert(sInitialized && mThreadKey);
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 6efb44a663..821274aeb3 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -261,9 +261,28 @@ public:
class LLThreadLocalPointerBase : LLInstanceTracker<LLThreadLocalPointerBase>
{
public:
- LLThreadLocalPointerBase();
- LLThreadLocalPointerBase(const LLThreadLocalPointerBase& other);
- ~LLThreadLocalPointerBase();
+ LLThreadLocalPointerBase()
+ : mThreadKey(NULL)
+ {
+ if (sInitialized)
+ {
+ initStorage();
+ }
+ }
+
+ LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other)
+ : mThreadKey(NULL)
+ {
+ if (sInitialized)
+ {
+ initStorage();
+ }
+ }
+
+ ~LLThreadLocalPointerBase()
+ {
+ destroyStorage();
+ }
static void initAllThreadLocalStorage();
static void destroyAllThreadLocalStorage();
@@ -312,7 +331,6 @@ class LLThreadLocalPointer : public LLThreadLocalPointerBase
public:
LLThreadLocalPointer()
- : LLThreadLocalPointerBase()
{}
explicit LLThreadLocalPointer(T* value)
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 9aa449d037..6e2a2b140f 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -112,7 +112,7 @@ void LLQueuedThread::shutdown()
// virtual
S32 LLQueuedThread::update(F32 max_time_ms)
{
- LLTrace::get_thread_trace()->pushToMaster();
+ LLTrace::get_thread_recorder()->pushToMaster();
if (!mStarted)
{
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index c705e5103b..6723e427f5 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -85,7 +85,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
{
LLThread *threadp = (LLThread *)datap;
- LLTrace::ThreadTrace* thread_trace = new LLTrace::SlaveThreadTrace();
+ LLTrace::ThreadRecorder* thread_recorder = new LLTrace::SlaveThreadRecorder();
#if !LL_DARWIN
sThreadIndex = threadp->mID;
@@ -99,7 +99,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
// We're done with the run function, this thread is done executing now.
threadp->mStatus = STOPPED;
- delete thread_trace;
+ delete thread_recorder;
return NULL;
}
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index 04817fd4f4..6b4c3aeb06 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -26,28 +26,28 @@
#include "linden_common.h"
#include "lltrace.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
namespace LLTrace
{
-static MasterThreadTrace* gMasterThreadTrace = NULL;
+static MasterThreadRecorder* gMasterThreadRecorder = NULL;
void init()
{
- gMasterThreadTrace = new MasterThreadTrace();
+ gMasterThreadRecorder = new MasterThreadRecorder();
}
void cleanup()
{
- delete gMasterThreadTrace;
- gMasterThreadTrace = NULL;
+ delete gMasterThreadRecorder;
+ gMasterThreadRecorder = NULL;
}
-LLThreadLocalPointer<ThreadTrace>& get_thread_trace()
+LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder()
{
- static LLThreadLocalPointer<ThreadTrace> s_trace_data;
- return s_trace_data;
+ static LLThreadLocalPointer<ThreadRecorder> s_thread_recorder;
+ return s_thread_recorder;
}
@@ -55,164 +55,161 @@ BlockTimer::Recorder::StackEntry BlockTimer::sCurRecorder;
-MasterThreadTrace& getMasterThreadTrace()
+MasterThreadRecorder& getMasterThreadRecorder()
{
- llassert(gMasterThreadTrace != NULL);
- return *gMasterThreadTrace;
+ llassert(gMasterThreadRecorder != NULL);
+ return *gMasterThreadRecorder;
}
///////////////////////////////////////////////////////////////////////
-// MasterThreadTrace
+// ThreadRecorder
///////////////////////////////////////////////////////////////////////
-ThreadTrace::ThreadTrace()
+ThreadRecorder::ThreadRecorder()
{
- get_thread_trace() = this;
- mPrimarySampler.makePrimary();
- mTotalSampler.start();
+ get_thread_recorder() = this;
+ mPrimaryRecording.makePrimary();
+ mFullRecording.start();
}
-ThreadTrace::ThreadTrace( const ThreadTrace& other )
-: mPrimarySampler(other.mPrimarySampler),
- mTotalSampler(other.mTotalSampler)
+ThreadRecorder::ThreadRecorder( const ThreadRecorder& other )
+: mPrimaryRecording(other.mPrimaryRecording),
+ mFullRecording(other.mFullRecording)
{
- get_thread_trace() = this;
- mPrimarySampler.makePrimary();
- mTotalSampler.start();
+ get_thread_recorder() = this;
+ mPrimaryRecording.makePrimary();
+ mFullRecording.start();
}
-ThreadTrace::~ThreadTrace()
+ThreadRecorder::~ThreadRecorder()
{
- get_thread_trace() = NULL;
+ get_thread_recorder() = NULL;
}
-//TODO: remove this and use llviewerstats sampler
-Sampler* ThreadTrace::getPrimarySampler()
+//TODO: remove this and use llviewerstats recording
+Recording* ThreadRecorder::getPrimaryRecording()
{
- return &mPrimarySampler;
+ return &mPrimaryRecording;
}
-void ThreadTrace::activate( Sampler* sampler )
+void ThreadRecorder::activate( Recording* recorder )
{
- for (std::list<Sampler*>::iterator it = mActiveSamplers.begin(), end_it = mActiveSamplers.end();
+ for (std::list<Recording*>::iterator it = mActiveRecordings.begin(), end_it = mActiveRecordings.end();
it != end_it;
++it)
{
- (*it)->mMeasurements.write()->mergeSamples(*mPrimarySampler.mMeasurements);
+ (*it)->mMeasurements.write()->mergeSamples(*mPrimaryRecording.mMeasurements);
}
- mPrimarySampler.mMeasurements.write()->reset();
+ mPrimaryRecording.mMeasurements.write()->reset();
- sampler->initDeltas(mPrimarySampler);
+ recorder->initDeltas(mPrimaryRecording);
- mActiveSamplers.push_front(sampler);
+ mActiveRecordings.push_front(recorder);
}
//TODO: consider merging results down the list to one past the buffered item.
// this would require 2 buffers per sampler, to separate current total from running total
-void ThreadTrace::deactivate( Sampler* sampler )
+void ThreadRecorder::deactivate( Recording* recorder )
{
- sampler->mergeDeltas(mPrimarySampler);
+ recorder->mergeDeltas(mPrimaryRecording);
// TODO: replace with intrusive list
- std::list<Sampler*>::iterator found_it = std::find(mActiveSamplers.begin(), mActiveSamplers.end(), sampler);
- if (found_it != mActiveSamplers.end())
+ std::list<Recording*>::iterator found_it = std::find(mActiveRecordings.begin(), mActiveRecordings.end(), recorder);
+ if (found_it != mActiveRecordings.end())
{
- mActiveSamplers.erase(found_it);
+ mActiveRecordings.erase(found_it);
}
}
///////////////////////////////////////////////////////////////////////
-// SlaveThreadTrace
+// SlaveThreadRecorder
///////////////////////////////////////////////////////////////////////
-SlaveThreadTrace::SlaveThreadTrace()
-: ThreadTrace(getMasterThreadTrace())
+SlaveThreadRecorder::SlaveThreadRecorder()
+: ThreadRecorder(getMasterThreadRecorder())
{
- getMasterThreadTrace().addSlaveThread(this);
+ getMasterThreadRecorder().addSlaveThread(this);
}
-SlaveThreadTrace::~SlaveThreadTrace()
+SlaveThreadRecorder::~SlaveThreadRecorder()
{
- getMasterThreadTrace().removeSlaveThread(this);
+ getMasterThreadRecorder().removeSlaveThread(this);
}
-void SlaveThreadTrace::pushToMaster()
+void SlaveThreadRecorder::pushToMaster()
{
- mTotalSampler.stop();
+ mFullRecording.stop();
{
- LLMutexLock(getMasterThreadTrace().getSlaveListMutex());
- mSharedData.copyFrom(mTotalSampler);
+ LLMutexLock(getMasterThreadRecorder().getSlaveListMutex());
+ mSharedData.copyFrom(mFullRecording);
}
- mTotalSampler.start();
+ mFullRecording.start();
}
-void SlaveThreadTrace::SharedData::copyFrom( const Sampler& source )
+void SlaveThreadRecorder::SharedData::copyFrom( const Recording& source )
{
- LLMutexLock lock(&mSamplerMutex);
- mSampler.mergeSamples(source);
+ LLMutexLock lock(&mRecorderMutex);
+ mRecorder.mergeSamples(source);
}
-void SlaveThreadTrace::SharedData::copyTo( Sampler& sink )
+void SlaveThreadRecorder::SharedData::copyTo( Recording& sink )
{
- LLMutexLock lock(&mSamplerMutex);
- sink.mergeSamples(mSampler);
+ LLMutexLock lock(&mRecorderMutex);
+ sink.mergeSamples(mRecorder);
}
-
-
-
///////////////////////////////////////////////////////////////////////
-// MasterThreadTrace
+// MasterThreadRecorder
///////////////////////////////////////////////////////////////////////
-void MasterThreadTrace::pullFromSlaveThreads()
+void MasterThreadRecorder::pullFromSlaveThreads()
{
LLMutexLock lock(&mSlaveListMutex);
- for (slave_thread_trace_list_t::iterator it = mSlaveThreadTraces.begin(), end_it = mSlaveThreadTraces.end();
+ for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end();
it != end_it;
++it)
{
- (*it)->mSlaveTrace->mSharedData.copyTo((*it)->mSamplerStorage);
+ (*it)->mRecorder->mSharedData.copyTo((*it)->mSlaveRecording);
}
}
-void MasterThreadTrace::addSlaveThread( class SlaveThreadTrace* child )
+void MasterThreadRecorder::addSlaveThread( class SlaveThreadRecorder* child )
{
LLMutexLock lock(&mSlaveListMutex);
- mSlaveThreadTraces.push_back(new SlaveThreadTraceProxy(child));
+ mSlaveThreadRecorders.push_back(new SlaveThreadRecorderProxy(child));
}
-void MasterThreadTrace::removeSlaveThread( class SlaveThreadTrace* child )
+void MasterThreadRecorder::removeSlaveThread( class SlaveThreadRecorder* child )
{
LLMutexLock lock(&mSlaveListMutex);
- for (slave_thread_trace_list_t::iterator it = mSlaveThreadTraces.begin(), end_it = mSlaveThreadTraces.end();
+ for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end();
it != end_it;
++it)
{
- if ((*it)->mSlaveTrace == child)
+ if ((*it)->mRecorder == child)
{
- mSlaveThreadTraces.erase(it);
+ mSlaveThreadRecorders.erase(it);
break;
}
}
}
-void MasterThreadTrace::pushToMaster()
+void MasterThreadRecorder::pushToMaster()
{}
-MasterThreadTrace::MasterThreadTrace()
+MasterThreadRecorder::MasterThreadRecorder()
{}
///////////////////////////////////////////////////////////////////////
-// MasterThreadTrace::SlaveThreadTraceProxy
+// MasterThreadRecorder::SlaveThreadTraceProxy
///////////////////////////////////////////////////////////////////////
-MasterThreadTrace::SlaveThreadTraceProxy::SlaveThreadTraceProxy( class SlaveThreadTrace* trace)
-: mSlaveTrace(trace)
+MasterThreadRecorder::SlaveThreadRecorderProxy::SlaveThreadRecorderProxy( class SlaveThreadRecorder* recorder)
+: mRecorder(recorder)
{}
}
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 5ec1c821c3..c5356777ae 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -34,7 +34,7 @@
#include "llmemory.h"
#include "lltimer.h"
#include "llrefcount.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
#include <list>
@@ -45,14 +45,14 @@
namespace LLTrace
{
- class Sampler;
+ class Recording;
void init();
void cleanup();
- LLThreadLocalPointer<class ThreadTrace>& get_thread_trace();
+ LLThreadLocalPointer<class ThreadRecorder>& get_thread_recorder();
- class LL_COMMON_API MasterThreadTrace& getMasterThreadTrace();
+ class LL_COMMON_API MasterThreadRecorder& getMasterThreadRecorder();
// one per thread per type
template<typename ACCUMULATOR>
@@ -482,33 +482,33 @@ namespace LLTrace
static Recorder::StackEntry sCurRecorder;
};
- class LL_COMMON_API ThreadTrace
+ class LL_COMMON_API ThreadRecorder
{
public:
- ThreadTrace();
- ThreadTrace(const ThreadTrace& other);
+ ThreadRecorder();
+ ThreadRecorder(const ThreadRecorder& other);
- virtual ~ThreadTrace();
+ virtual ~ThreadRecorder();
- void activate(Sampler* sampler);
- void deactivate(Sampler* sampler);
+ void activate(Recording* recording);
+ void deactivate(Recording* recording);
virtual void pushToMaster() = 0;
- Sampler* getPrimarySampler();
+ Recording* getPrimaryRecording();
protected:
- Sampler mPrimarySampler;
- Sampler mTotalSampler;
- std::list<Sampler*> mActiveSamplers;
+ Recording mPrimaryRecording;
+ Recording mFullRecording;
+ std::list<Recording*> mActiveRecordings;
};
- class LL_COMMON_API MasterThreadTrace : public ThreadTrace
+ class LL_COMMON_API MasterThreadRecorder : public ThreadRecorder
{
public:
- MasterThreadTrace();
+ MasterThreadRecorder();
- void addSlaveThread(class SlaveThreadTrace* child);
- void removeSlaveThread(class SlaveThreadTrace* child);
+ void addSlaveThread(class SlaveThreadRecorder* child);
+ void removeSlaveThread(class SlaveThreadRecorder* child);
/*virtual */ void pushToMaster();
@@ -518,41 +518,41 @@ namespace LLTrace
LLMutex* getSlaveListMutex() { return &mSlaveListMutex; }
private:
- struct SlaveThreadTraceProxy
+ struct SlaveThreadRecorderProxy
{
- SlaveThreadTraceProxy(class SlaveThreadTrace* trace);
+ SlaveThreadRecorderProxy(class SlaveThreadRecorder* recorder);
- class SlaveThreadTrace* mSlaveTrace;
- Sampler mSamplerStorage;
+ class SlaveThreadRecorder* mRecorder;
+ Recording mSlaveRecording;
private:
//no need to copy these and then have to duplicate the storage
- SlaveThreadTraceProxy(const SlaveThreadTraceProxy& other) {}
+ SlaveThreadRecorderProxy(const SlaveThreadRecorderProxy& other) {}
};
- typedef std::list<SlaveThreadTraceProxy*> slave_thread_trace_list_t;
+ typedef std::list<SlaveThreadRecorderProxy*> slave_thread_recorder_list_t;
- slave_thread_trace_list_t mSlaveThreadTraces;
+ slave_thread_recorder_list_t mSlaveThreadRecorders;
LLMutex mSlaveListMutex;
};
- class LL_COMMON_API SlaveThreadTrace : public ThreadTrace
+ class LL_COMMON_API SlaveThreadRecorder : public ThreadRecorder
{
public:
- SlaveThreadTrace();
- ~SlaveThreadTrace();
+ SlaveThreadRecorder();
+ ~SlaveThreadRecorder();
// call this periodically to gather stats data for master thread to consume
/*virtual*/ void pushToMaster();
- MasterThreadTrace* mMaster;
+ MasterThreadRecorder* mMaster;
class SharedData
{
public:
- void copyFrom(const Sampler& source);
- void copyTo(Sampler& sink);
+ void copyFrom(const Recording& source);
+ void copyTo(Recording& sink);
private:
- LLMutex mSamplerMutex;
- Sampler mSampler;
+ LLMutex mRecorderMutex;
+ Recording mRecorder;
};
SharedData mSharedData;
};
diff --git a/indra/llcommon/lltracesampler.cpp b/indra/llcommon/lltracerecording.cpp
index 17e58b96e2..a792d40f9d 100644
--- a/indra/llcommon/lltracesampler.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -25,7 +25,7 @@
#include "linden_common.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
#include "lltrace.h"
#include "llthread.h"
@@ -33,10 +33,10 @@ namespace LLTrace
{
///////////////////////////////////////////////////////////////////////
-// Sampler
+// Recording
///////////////////////////////////////////////////////////////////////
-Sampler::Sampler()
+Recording::Recording()
: mElapsedSeconds(0),
mIsStarted(false),
mRatesStart(new AccumulatorBuffer<RateAccumulator<F32> >()),
@@ -47,17 +47,17 @@ Sampler::Sampler()
{
}
-Sampler::~Sampler()
+Recording::~Recording()
{
}
-void Sampler::start()
+void Recording::start()
{
reset();
resume();
}
-void Sampler::reset()
+void Recording::reset()
{
mRates.write()->reset();
mMeasurements.write()->reset();
@@ -67,54 +67,54 @@ void Sampler::reset()
mSamplingTimer.reset();
}
-void Sampler::resume()
+void Recording::resume()
{
if (!mIsStarted)
{
mSamplingTimer.reset();
- LLTrace::get_thread_trace()->activate(this);
+ LLTrace::get_thread_recorder()->activate(this);
mIsStarted = true;
}
}
-void Sampler::stop()
+void Recording::stop()
{
if (mIsStarted)
{
mElapsedSeconds += mSamplingTimer.getElapsedTimeF64();
- LLTrace::get_thread_trace()->deactivate(this);
+ LLTrace::get_thread_recorder()->deactivate(this);
mIsStarted = false;
}
}
-void Sampler::makePrimary()
+void Recording::makePrimary()
{
mRates.write()->makePrimary();
mMeasurements.write()->makePrimary();
mStackTimers.write()->makePrimary();
}
-bool Sampler::isPrimary()
+bool Recording::isPrimary()
{
return mRates->isPrimary();
}
-void Sampler::mergeSamples( const Sampler& other )
+void Recording::mergeSamples( const Recording& other )
{
mRates.write()->mergeSamples(*other.mRates);
mMeasurements.write()->mergeSamples(*other.mMeasurements);
mStackTimers.write()->mergeSamples(*other.mStackTimers);
}
-void Sampler::initDeltas( const Sampler& other )
+void Recording::initDeltas( const Recording& other )
{
mRatesStart.write()->copyFrom(*other.mRates);
mStackTimersStart.write()->copyFrom(*other.mStackTimers);
}
-void Sampler::mergeDeltas( const Sampler& other )
+void Recording::mergeDeltas( const Recording& other )
{
mRates.write()->mergeDeltas(*mRatesStart, *other.mRates);
mStackTimers.write()->mergeDeltas(*mStackTimersStart, *other.mStackTimers);
@@ -122,38 +122,38 @@ void Sampler::mergeDeltas( const Sampler& other )
}
-F32 Sampler::getSum( Rate<F32>& stat )
+F32 Recording::getSum( Rate<F32>& stat )
{
return stat.getAccumulator(mRates).getSum();
}
-F32 Sampler::getSum( Measurement<F32>& stat )
+F32 Recording::getSum( Measurement<F32>& stat )
{
return stat.getAccumulator(mMeasurements).getSum();
}
-F32 Sampler::getPerSec( Rate<F32>& stat )
+F32 Recording::getPerSec( Rate<F32>& stat )
{
return stat.getAccumulator(mRates).getSum() / mElapsedSeconds;
}
-F32 Sampler::getMin( Measurement<F32>& stat )
+F32 Recording::getMin( Measurement<F32>& stat )
{
return stat.getAccumulator(mMeasurements).getMin();
}
-F32 Sampler::getMax( Measurement<F32>& stat )
+F32 Recording::getMax( Measurement<F32>& stat )
{
return stat.getAccumulator(mMeasurements).getMax();
}
-F32 Sampler::getMean( Measurement<F32>& stat )
+F32 Recording::getMean( Measurement<F32>& stat )
{
return stat.getAccumulator(mMeasurements).getMean();
}
-F32 Sampler::getStandardDeviation( Measurement<F32>& stat )
+F32 Recording::getStandardDeviation( Measurement<F32>& stat )
{
return stat.getAccumulator(mMeasurements).getStandardDeviation();
}
diff --git a/indra/llcommon/lltracesampler.h b/indra/llcommon/lltracerecording.h
index e3498fb39f..83dc503ea6 100644
--- a/indra/llcommon/lltracesampler.h
+++ b/indra/llcommon/lltracerecording.h
@@ -1,5 +1,5 @@
/**
- * @file lltracesampler.h
+ * @file lltracerecording.h
* @brief Sampling object for collecting runtime statistics originating from lltrace.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
@@ -24,8 +24,8 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLTRACESAMPLER_H
-#define LL_LLTRACESAMPLER_H
+#ifndef LL_LLTRACERECORDING_H
+#define LL_LLTRACERECORDING_H
#include "stdtypes.h"
#include "llpreprocessor.h"
@@ -42,12 +42,12 @@ namespace LLTrace
template<typename T> class MeasurementAccumulator;
class TimerAccumulator;
- class LL_COMMON_API Sampler
+ class LL_COMMON_API Recording
{
public:
- Sampler();
+ Recording();
- ~Sampler();
+ ~Recording();
void makePrimary();
bool isPrimary();
@@ -56,9 +56,9 @@ namespace LLTrace
void stop();
void resume();
- void mergeSamples(const Sampler& other);
- void initDeltas(const Sampler& other);
- void mergeDeltas(const Sampler& other);
+ void mergeSamples(const Recording& other);
+ void initDeltas(const Recording& other);
+ void mergeDeltas(const Recording& other);
void reset();
@@ -76,9 +76,9 @@ namespace LLTrace
F64 getSampleTime() { return mElapsedSeconds; }
private:
- friend class ThreadTrace;
+ friend class ThreadRecorder;
// returns data for current thread
- class ThreadTrace* getThreadTrace();
+ class ThreadRecorder* getThreadRecorder();
LLCopyOnWritePointer<AccumulatorBuffer<RateAccumulator<F32> > > mRatesStart;
LLCopyOnWritePointer<AccumulatorBuffer<RateAccumulator<F32> > > mRates;
@@ -91,10 +91,10 @@ namespace LLTrace
F64 mElapsedSeconds;
};
- class LL_COMMON_API PeriodicSampler
+ class LL_COMMON_API PeriodicRecording
{
};
}
-#endif // LL_LLTRACESAMPLER_H
+#endif // LL_LLTRACERECORDING_H
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 1f8be3da62..bc9603804b 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -36,7 +36,7 @@
#include "llstat.h"
#include "lluictrlfactory.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -111,20 +111,20 @@ void LLStatBar::draw()
}
else if (mFloatStatp)
{
- LLTrace::Sampler* sampler = LLTrace::get_thread_trace()->getPrimarySampler();
+ LLTrace::Recording* recording = LLTrace::get_thread_recorder()->getPrimaryRecording();
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();
+ current = recording->getSum(*mFloatStatp) / recording->getSampleTime();
+ //min = recording->getMin(*mFloatStatp) / recording->getSampleTime();
+ //max = recording->getMax(*mFloatStatp) / recording->getSampleTime();
+ //mean = recording->getMean(*mFloatStatp) / recording->getSampleTime();
}
else
{
- current = sampler->getSum(*mFloatStatp);
- //min = sampler->getMin(*mFloatStatp);
- //max = sampler->getMax(*mFloatStatp);
- //mean = sampler->getMean(*mFloatStatp);
+ current = recording->getSum(*mFloatStatp);
+ //min = recording->getMin(*mFloatStatp);
+ //max = recording->getMax(*mFloatStatp);
+ //mean = recording->getMean(*mFloatStatp);
}
}
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index e0d7623999..aed9e4ec93 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -35,7 +35,7 @@
#include "llstat.h"
#include "llgl.h"
#include "llglheaders.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
//#include "llviewercontrol.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -85,15 +85,15 @@ void LLStatGraph::draw()
}
else if (mF32Statp)
{
- LLTrace::Sampler* sampler = LLTrace::get_thread_trace()->getPrimarySampler();
+ LLTrace::Recording* recording = LLTrace::get_thread_recorder()->getPrimaryRecording();
if (mPerSec)
{
- mValue = sampler->getSum(*mF32Statp) / sampler->getSampleTime();
+ mValue = recording->getSum(*mF32Statp) / recording->getSampleTime();
}
else
{
- mValue = sampler->getSum(*mF32Statp);
+ mValue = recording->getSum(*mF32Statp);
}
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 0bb87dfa6c..22f3cce9e8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1222,7 +1222,7 @@ bool LLAppViewer::mainLoop()
{
LLFastTimer _(FTM_FRAME);
LLFastTimer::nextFrame();
- LLTrace::getMasterThreadTrace().pullFromSlaveThreads();
+ LLTrace::getMasterThreadRecorder().pullFromSlaveThreads();
//clear call stack records
llclearcallstacks;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index e2b09a1902..a6e9643edd 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -276,12 +276,11 @@ LLViewerStats::LLViewerStats() :
}
mAgentPositionSnaps.reset();
- mSampler->start();
+ mRecording.start();
}
LLViewerStats::~LLViewerStats()
{
- delete mSampler;
}
void LLViewerStats::resetStats()
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 9e809dd08c..ca5f6c6821 100755
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -29,7 +29,8 @@
#include "llstat.h"
#include "lltextureinfo.h"
-#include "lltracesampler.h"
+#include "lltracerecording.h"
+#include "lltrace.h"
extern LLTrace::Rate<F32> STAT_KBIT,
STAT_LAYERS_KBIT,
@@ -297,11 +298,11 @@ public:
static void recordPhaseStat(const std::string& phase_name, F32 value);
};
- LLTrace::Sampler* getSampler() { return mSampler; }
+ LLTrace::Recording& getRecording() { return mRecording; }
private:
F64 mStats[ST_COUNT];
- LLTrace::Sampler* mSampler;
+ LLTrace::Recording mRecording;
F64 mLastTimeDiff; // used for time stat updates
};
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 21a83b1676..4e62cbd714 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -622,9 +622,9 @@ void LLViewerTextureList::updateImages(F32 max_time)
}
cleared = FALSE;
- LLTrace::Sampler* sampler = LLTrace::getThreadTrace()->getPrimarySampler();
+ LLTrace::Recording* recording = LLTrace::get_thread_recorder()->getPrimaryRecording();
- LLAppViewer::getTextureFetch()->setTextureBandwidth(sampler->getMean(STAT_TEXTURE_KBIT) / sampler->getSampleTime());
+ LLAppViewer::getTextureFetch()->setTextureBandwidth(recording->getPerSec(STAT_TEXTURE_KBIT));
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);