summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-10-18 17:32:44 -0700
committerRichard Linden <none@none>2012-10-18 17:32:44 -0700
commit1fadd6138eebf980776f80b9642f4c19279fcadd (patch)
treeae5ae3e2916f918e23c259406082d8596f89a2aa /indra/llcommon
parenta52d203a4f1d2988e8ffba16258f3f132f22f56d (diff)
SH-3405 WIP convert existing stats to lltrace system
fixed trace recording on background threads hitting null pointer
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/lltrace.h19
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp9
-rw-r--r--indra/llcommon/lltracethreadrecorder.h4
3 files changed, 20 insertions, 12 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 2a479b31d7..2cdae4b0d2 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -167,15 +167,24 @@ namespace LLTrace
size_t next_slot = mNextStorageSlot++;
if (next_slot >= mStorageSize)
{
- size_t new_size = mStorageSize + (mStorageSize >> 2);
- delete [] mStorage;
- mStorage = new ACCUMULATOR[new_size];
- mStorageSize = new_size;
+ resize(mStorageSize + (mStorageSize >> 2));
}
- llassert(next_slot < mStorageSize);
+ llassert(mStorage && next_slot < mStorageSize);
return next_slot;
}
+ void resize(size_t new_size)
+ {
+ ACCUMULATOR* old_storage = mStorage;
+ mStorage = new ACCUMULATOR[new_size];
+ for (S32 i = 0; i < mStorageSize; i++)
+ {
+ mStorage[i] = old_storage[i];
+ }
+ mStorageSize = new_size;
+ delete[] old_storage;
+ }
+
static AccumulatorBuffer<ACCUMULATOR>& getDefaultBuffer()
{
static AccumulatorBuffer sBuffer(STATIC_ALLOC);
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 02dc55771b..e81333f7f2 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -127,7 +127,6 @@ void ThreadRecorder::ActiveRecording::moveBaselineToTarget()
///////////////////////////////////////////////////////////////////////
SlaveThreadRecorder::SlaveThreadRecorder()
-: ThreadRecorder(getMasterThreadRecorder())
{
getMasterThreadRecorder().addSlaveThread(this);
}
@@ -149,14 +148,14 @@ void SlaveThreadRecorder::pushToMaster()
void SlaveThreadRecorder::SharedData::copyFrom( const Recording& source )
{
- LLMutexLock lock(&mRecorderMutex);
- mRecorder.mergeRecording(source);
+ LLMutexLock lock(&mRecordingMutex);
+ mRecording.mergeRecording(source);
}
void SlaveThreadRecorder::SharedData::copyTo( Recording& sink )
{
- LLMutexLock lock(&mRecorderMutex);
- sink.mergeRecording(mRecorder);
+ LLMutexLock lock(&mRecordingMutex);
+ sink.mergeRecording(mRecording);
}
///////////////////////////////////////////////////////////////////////
diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h
index 678b1a89f0..c9231265af 100644
--- a/indra/llcommon/lltracethreadrecorder.h
+++ b/indra/llcommon/lltracethreadrecorder.h
@@ -114,8 +114,8 @@ namespace LLTrace
void copyFrom(const Recording& source);
void copyTo(Recording& sink);
private:
- LLMutex mRecorderMutex;
- Recording mRecorder;
+ LLMutex mRecordingMutex;
+ Recording mRecording;
};
SharedData mSharedData;
};