diff options
author | Richard Linden <none@none> | 2012-09-26 19:12:40 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-09-26 19:12:40 -0700 |
commit | 07c4be092b276f0d7c14ba12872efb31c1f16764 (patch) | |
tree | 06c7d37425301130295fe62a2f4db2ea7c2b562c /indra/llcommon/lltrace.h | |
parent | 05a3203d8274a0a0999faad128f629614b8d62c5 (diff) |
SH-3275 WIP Run viewer metrics for object update messages
slave threads now pushing data to master thread
Diffstat (limited to 'indra/llcommon/lltrace.h')
-rw-r--r-- | indra/llcommon/lltrace.h | 63 |
1 files changed, 16 insertions, 47 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index e4bec0a644..601b5ed182 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -396,7 +396,7 @@ namespace LLTrace private: // returns data for current thread - class ThreadTraceData* getThreadTrace(); + class ThreadTrace* getThreadTrace(); AccumulatorBuffer<StatAccumulator<F32> > mF32Stats; AccumulatorBuffer<StatAccumulator<S32> > mS32Stats; @@ -404,48 +404,19 @@ namespace LLTrace AccumulatorBuffer<TimerAccumulator> mTimers; }; - class ThreadTraceData + class ThreadTrace { public: - ThreadTraceData() - { - mPrimarySampler.makePrimary(); - } - - ThreadTraceData(const ThreadTraceData& other) - : mPrimarySampler(other.mPrimarySampler) - { - mPrimarySampler.makePrimary(); - } + ThreadTrace(); + ThreadTrace(const ThreadTrace& other); - void activate(Sampler* sampler) - { - flushPrimary(); - mActiveSamplers.push_back(sampler); - } + virtual ~ThreadTrace() {} - void deactivate(Sampler* sampler) - { - sampler->mergeFrom(mPrimarySampler); - - // TODO: replace with intrusive list - std::list<Sampler*>::iterator found_it = std::find(mActiveSamplers.begin(), mActiveSamplers.end(), sampler); - if (found_it != mActiveSamplers.end()) - { - mActiveSamplers.erase(found_it); - } - } + void activate(Sampler* sampler); + void deactivate(Sampler* sampler); + void flushPrimary(); - void flushPrimary() - { - for (std::list<Sampler*>::iterator it = mActiveSamplers.begin(), end_it = mActiveSamplers.end(); - it != end_it; - ++it) - { - (*it)->mergeFrom(mPrimarySampler); - } - mPrimarySampler.reset(); - } + virtual void pushToMaster() = 0; Sampler* getPrimarySampler() { return &mPrimarySampler; } protected: @@ -453,15 +424,16 @@ namespace LLTrace std::list<Sampler*> mActiveSamplers; }; - class MasterThreadTrace : public ThreadTraceData + class MasterThreadTrace : public ThreadTrace { public: - MasterThreadTrace() - {} + MasterThreadTrace(); void addSlaveThread(class SlaveThreadTrace* child); void removeSlaveThread(class SlaveThreadTrace* child); + /*virtual */ void pushToMaster(); + // call this periodically to gather stats data from slave threads void pullFromSlaveThreads(); @@ -480,12 +452,12 @@ namespace LLTrace LLMutex mSlaveListMutex; }; - class SlaveThreadTrace : public ThreadTraceData + class SlaveThreadTrace : public ThreadTrace { public: explicit SlaveThreadTrace() - : ThreadTraceData(getMasterThreadTrace()), + : ThreadTrace(getMasterThreadTrace()), mSharedData(mPrimarySampler) { getMasterThreadTrace().addSlaveThread(this); @@ -497,10 +469,7 @@ namespace LLTrace } // call this periodically to gather stats data for master thread to consume - void pushToParent() - { - mSharedData.copyFrom(mPrimarySampler); - } + /*virtual*/ void pushToMaster(); MasterThreadTrace* mMaster; |