diff options
author | Richard Linden <none@none> | 2012-10-18 17:32:44 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-10-18 17:32:44 -0700 |
commit | 1fadd6138eebf980776f80b9642f4c19279fcadd (patch) | |
tree | ae5ae3e2916f918e23c259406082d8596f89a2aa /indra/llcommon/lltrace.h | |
parent | a52d203a4f1d2988e8ffba16258f3f132f22f56d (diff) |
SH-3405 WIP convert existing stats to lltrace system
fixed trace recording on background threads hitting null pointer
Diffstat (limited to 'indra/llcommon/lltrace.h')
-rw-r--r-- | indra/llcommon/lltrace.h | 19 |
1 files changed, 14 insertions, 5 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); |