summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltraceaccumulators.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-09-25 19:12:35 -0700
committerRichard Linden <none@none>2013-09-25 19:12:35 -0700
commit053d97db1b283ca2548dc1f64756ddfc5166158f (patch)
tree5bcbc17e5092fc54791e880bc4640d4b43af7e50 /indra/llcommon/lltraceaccumulators.h
parentab8f64a96754edaa68dd1ff97b9519eff4496aa6 (diff)
better memory usage for LLTrace (tighter packing of recording arrays)
removed complicated and unnecessary fast timer gapless handoff logic (it should be gapless anyway) improved MemTrackable API, better separation of shadow and footprint added memory usage stats to floater_stats.xml
Diffstat (limited to 'indra/llcommon/lltraceaccumulators.h')
-rw-r--r--indra/llcommon/lltraceaccumulators.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index 37a35f4e23..4fe84455a6 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -35,6 +35,7 @@
#include "lltimer.h"
#include "llrefcount.h"
#include "llthreadlocalstorage.h"
+#include "llmemory.h"
#include <limits>
namespace LLTrace
@@ -51,7 +52,7 @@ namespace LLTrace
class AccumulatorBuffer : public LLRefCount
{
typedef AccumulatorBuffer<ACCUMULATOR> self_t;
- static const U32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 64;
+ static const U32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16;
private:
struct StaticAllocationMarker { };
@@ -149,7 +150,9 @@ namespace LLTrace
size_t next_slot = sNextStorageSlot++;
if (next_slot >= mStorageSize)
{
- resize(mStorageSize + (mStorageSize >> 2));
+ // don't perform doubling, as this should only happen during startup
+ // want to keep a tight bounds as we will have a lot of these buffers
+ resize(mStorageSize + ACCUMULATOR_BUFFER_SIZE_INCREMENT);
}
llassert(mStorage && next_slot < mStorageSize);
return next_slot;
@@ -199,7 +202,7 @@ namespace LLTrace
// so as not to trigger an access violation
sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker());
sInitialized = true;
- sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE);
+ sDefaultBuffer->resize(ACCUMULATOR_BUFFER_SIZE_INCREMENT);
}
return sDefaultBuffer;
}
@@ -427,6 +430,17 @@ namespace LLTrace
typedef F64Seconds value_t;
};
+ // arrays are allocated with 32 byte alignment
+ void *operator new [](size_t size)
+ {
+ return ll_aligned_malloc(32, size);
+ }
+
+ void operator delete[](void* ptr, size_t size)
+ {
+ ll_aligned_free(32, ptr);
+ }
+
TimeBlockAccumulator();
void addSamples(const self_t& other, EBufferAppendType append_type);
void reset(const self_t* other);
@@ -435,8 +449,7 @@ namespace LLTrace
//
// members
//
- U64 mStartTotalTimeCounter,
- mTotalTimeCounter,
+ U64 mTotalTimeCounter,
mSelfTimeCounter;
U32 mCalls;
class TimeBlock* mParent; // last acknowledged parent of this time block