summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llfasttimer.cpp7
-rw-r--r--indra/llcommon/lltrace.h18
-rw-r--r--indra/llcommon/lltracerecording.cpp10
-rw-r--r--indra/llcommon/lltracerecording.h11
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp33
-rw-r--r--indra/llcommon/lltracethreadrecorder.h12
6 files changed, 65 insertions, 26 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index a144a8c94e..e58c5c0f98 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -425,6 +425,13 @@ void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other )
mTotalTimeCounter = 0;
mChildTimeCounter = 0;
mCalls = 0;
+ if (other)
+ {
+ mLastCaller = other->mLastCaller;
+ mActiveCount = other->mActiveCount;
+ mMoveUpTree = other->mMoveUpTree;
+ mParent = other->mParent;
+ }
}
} // namespace LLTrace
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 0f927bad53..c38e92962b 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -243,8 +243,6 @@ namespace LLTrace
: public LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>
{
public:
- typedef typename MeanValueType<TraceType<ACCUMULATOR> >::type mean_t;
-
TraceType(const char* name, const char* description = NULL)
: LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>(name),
mName(name),
@@ -468,7 +466,6 @@ namespace LLTrace
: public TraceType<TimeBlockAccumulator>
{
public:
- typedef F32 mean_t;
TraceType(const char* name, const char* description = "")
: TraceType<TimeBlockAccumulator>(name, description)
@@ -476,17 +473,30 @@ namespace LLTrace
};
template<>
+ struct MeanValueType<TraceType<TimeBlockAccumulator::CallCountAspect> >
+ {
+ typedef F64 type;
+ };
+
+
+ template<>
class TraceType<TimeBlockAccumulator::SelfTimeAspect>
: public TraceType<TimeBlockAccumulator>
{
public:
- typedef F32 mean_t;
TraceType(const char* name, const char* description = "")
: TraceType<TimeBlockAccumulator>(name, description)
{}
};
+ template<>
+ struct MeanValueType<TraceType<TimeBlockAccumulator::SelfTimeAspect> >
+ {
+ typedef LLUnit<LLUnits::Seconds, F64> type;
+ };
+
+
class TimeBlock;
class TimeBlockTreeNode
{
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 913c4cbdad..737b95cdd5 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -109,8 +109,18 @@ void Recording::handleSplitTo(Recording& other)
{
stop();
other.restart();
+ syncTo(other);
+}
+
+void Recording::syncTo(Recording& other)
+{
+ other.mCountsFloat.write()->reset(mCountsFloat);
other.mMeasurementsFloat.write()->reset(mMeasurementsFloat);
+ other.mCounts.write()->reset(mCounts);
other.mMeasurements.write()->reset(mMeasurements);
+ other.mStackTimers.write()->reset(mStackTimers);
+ other.mMemStats.write()->reset(mMemStats);
+
//TODO: figure out how to get seamless handoff of timing stats
}
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index f575fbd8b2..af9ba02b29 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -119,6 +119,7 @@ namespace LLTrace
// gather data from recording, ignoring time relationship (for example, pulling data from slave threads)
void mergeRecording(const Recording& other);
+ // grab latest recorded data
void update();
// Timer accessors
@@ -217,6 +218,8 @@ namespace LLTrace
LLUnit<LLUnits::Seconds, F64> getDuration() const { return LLUnit<LLUnits::Seconds, F64>(mElapsedSeconds); }
+ void syncTo(Recording& other);
+
private:
friend class ThreadRecorder;
@@ -337,9 +340,9 @@ namespace LLTrace
}
template <typename T>
- typename TraceType<T>::mean_t getPeriodMean(const TraceType<T>& stat) const
+ typename MeanValueType<TraceType<T> >::type getPeriodMean(const TraceType<T>& stat) const
{
- typename TraceType<T>::mean_t mean = 0.0;
+ typename MeanValueType<TraceType<T> >::type mean = 0.0;
for (S32 i = 0; i < mNumPeriods; i++)
{
if (mRecordingPeriods[i].getDuration() > 0.f)
@@ -352,9 +355,9 @@ namespace LLTrace
}
template <typename T>
- typename TraceType<T>::mean_t getPeriodMeanPerSec(const TraceType<T>& stat) const
+ typename MeanValueType<TraceType<T> >::type getPeriodMeanPerSec(const TraceType<T>& stat) const
{
- typename TraceType<T>::mean_t mean = 0.0;
+ typename MeanValueType<TraceType<T> >::type mean = 0.0;
for (S32 i = 0; i < mNumPeriods; i++)
{
if (mRecordingPeriods[i].getDuration() > 0.f)
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 7b493a651e..113febcca8 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -76,7 +76,7 @@ ThreadRecorder::~ThreadRecorder()
while(mActiveRecordings.size())
{
- mActiveRecordings.front().mTargetRecording->stop();
+ mActiveRecordings.front()->mTargetRecording->stop();
}
set_thread_recorder(NULL);
delete[] mTimeBlockTreeNodes;
@@ -94,31 +94,37 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode(S32 index)
void ThreadRecorder::activate( Recording* recording )
{
- mActiveRecordings.push_front(ActiveRecording(recording));
- mActiveRecordings.front().mBaseline.makePrimary();
+ ActiveRecording* active_recording = new ActiveRecording(recording);
+ if (!mActiveRecordings.empty())
+ {
+ mActiveRecordings.front()->mBaseline.syncTo(active_recording->mBaseline);
+ }
+ mActiveRecordings.push_front(active_recording);
+
+ mActiveRecordings.front()->mBaseline.makePrimary();
}
-std::list<ThreadRecorder::ActiveRecording>::iterator ThreadRecorder::update( Recording* recording )
+ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::update( Recording* recording )
{
- std::list<ActiveRecording>::iterator it, end_it;
+ active_recording_list_t::iterator it, end_it;
for (it = mActiveRecordings.begin(), end_it = mActiveRecordings.end();
it != end_it;
++it)
{
- std::list<ActiveRecording>::iterator next_it = it;
+ active_recording_list_t::iterator next_it = it;
++next_it;
// if we have another recording further down in the stack...
if (next_it != mActiveRecordings.end())
{
// ...push our gathered data down to it
- next_it->mBaseline.appendRecording(it->mBaseline);
+ (*next_it)->mBaseline.appendRecording((*it)->mBaseline);
}
// copy accumulated measurements into result buffer and clear accumulator (mBaseline)
- it->moveBaselineToTarget();
+ (*it)->moveBaselineToTarget();
- if (it->mTargetRecording == recording)
+ if ((*it)->mTargetRecording == recording)
{
// found the recording, so return it
break;
@@ -142,17 +148,18 @@ AccumulatorBuffer<MemStatAccumulator> gMemStats;
void ThreadRecorder::deactivate( Recording* recording )
{
- std::list<ActiveRecording>::iterator it = update(recording);
+ active_recording_list_t::iterator it = update(recording);
if (it != mActiveRecordings.end())
{
// and if we've found the recording we wanted to update
- std::list<ActiveRecording>::iterator next_it = it;
+ active_recording_list_t::iterator next_it = it;
++next_it;
if (next_it != mActiveRecordings.end())
{
- next_it->mTargetRecording->makePrimary();
+ (*next_it)->mTargetRecording->makePrimary();
}
+ delete *it;
mActiveRecordings.erase(it);
}
}
@@ -244,7 +251,7 @@ void MasterThreadRecorder::pullFromSlaveThreads()
LLMutexLock lock(&mSlaveListMutex);
- Recording& target_recording = mActiveRecordings.front().mBaseline;
+ Recording& target_recording = mActiveRecordings.front()->mBaseline;
for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end();
it != end_it;
++it)
diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h
index 337035974c..0e6c091900 100644
--- a/indra/llcommon/lltracethreadrecorder.h
+++ b/indra/llcommon/lltracethreadrecorder.h
@@ -39,13 +39,14 @@ namespace LLTrace
{
protected:
struct ActiveRecording;
+ typedef std::list<ActiveRecording*> active_recording_list_t;
public:
ThreadRecorder();
virtual ~ThreadRecorder();
void activate(Recording* recording);
- std::list<struct ActiveRecording>::iterator update(Recording* recording);
+ active_recording_list_t::iterator update(Recording* recording);
void deactivate(Recording* recording);
virtual void pushToMaster() = 0;
@@ -63,11 +64,12 @@ namespace LLTrace
void moveBaselineToTarget();
};
Recording mThreadRecording;
- std::list<ActiveRecording> mActiveRecordings;
- class BlockTimer* mRootTimer;
- TimeBlockTreeNode* mTimeBlockTreeNodes;
- size_t mNumTimeBlockTreeNodes;
+ active_recording_list_t mActiveRecordings;
+
+ class BlockTimer* mRootTimer;
+ TimeBlockTreeNode* mTimeBlockTreeNodes;
+ size_t mNumTimeBlockTreeNodes;
};
class LL_COMMON_API MasterThreadRecorder : public ThreadRecorder