From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 7 Oct 2013 13:38:03 -0700
Subject: renamed TraceType to StatType added more MemTrackable types optimized
 memory usage of LLTrace some more

---
 indra/llcommon/llfasttimer.cpp                     |   2 +-
 indra/llcommon/llfasttimer.h                       |  10 +-
 indra/llcommon/lltrace.cpp                         |   4 +-
 indra/llcommon/lltrace.h                           | 127 +++++++++-------
 indra/llcommon/lltraceaccumulators.cpp             |   8 +-
 indra/llcommon/lltraceaccumulators.h               |  18 +--
 indra/llcommon/lltracerecording.cpp                | 104 ++++++-------
 indra/llcommon/lltracerecording.h                  | 166 ++++++++++-----------
 indra/llrender/lltexture.h                         |   8 +-
 indra/llui/llstatbar.cpp                           |  26 ++--
 indra/llui/llstatbar.h                             |   8 +-
 indra/llui/llstatgraph.h                           |   8 +-
 indra/llui/lltextbase.cpp                          |   1 -
 indra/newview/lldrawable.cpp                       |   4 +-
 indra/newview/lldrawable.h                         |   2 +-
 indra/newview/lldynamictexture.h                   |   6 +-
 indra/newview/llface.h                             |  21 +--
 indra/newview/llscenemonitor.cpp                   |   8 +-
 indra/newview/llspatialpartition.cpp               |  36 ++---
 indra/newview/llspatialpartition.h                 |  26 +---
 indra/newview/llvieweroctree.cpp                   | 120 +++++++--------
 indra/newview/llvieweroctree.h                     |  90 +++++------
 indra/newview/llviewerregion.cpp                   |  10 +-
 indra/newview/llviewerregion.h                     |   4 +-
 indra/newview/llviewerstats.cpp                    |  14 +-
 indra/newview/llvoavatar.h                         |   6 +-
 indra/newview/llvoavatarself.h                     |  10 --
 indra/newview/llvocache.cpp                        |  20 +--
 indra/newview/llvocache.h                          |   2 +-
 .../newview/skins/default/xui/en/floater_stats.xml |  17 ++-
 30 files changed, 439 insertions(+), 447 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 32ef01b2b6..c948e0ac85 100755
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -165,7 +165,7 @@ U64 TimeBlock::countsPerSecond()
 #endif
 
 TimeBlock::TimeBlock(const char* name, TimeBlock* parent)
-:	TraceType<TimeBlockAccumulator>(name)
+:	StatType<TimeBlockAccumulator>(name)
 {}
 
 TimeBlockTreeNode& TimeBlock::getTreeNode() const
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 4eb12907dc..1266d87f08 100755
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -86,7 +86,7 @@ LL_FORCE_INLINE class BlockTimer timeThisBlock(class TimeBlock& timer)
 
 // stores a "named" timer instance to be reused via multiple BlockTimer stack instances
 class TimeBlock 
-:	public TraceType<TimeBlockAccumulator>,
+:	public StatType<TimeBlockAccumulator>,
 	public LLInstanceTracker<TimeBlock>
 {
 public:
@@ -102,14 +102,14 @@ public:
 	child_iter endChildren();
 	std::vector<TimeBlock*>& getChildren();
 
-	TraceType<TimeBlockAccumulator::CallCountFacet>& callCount() 
+	StatType<TimeBlockAccumulator::CallCountFacet>& callCount() 
 	{
-		return static_cast<TraceType<TimeBlockAccumulator::CallCountFacet>&>(*(TraceType<TimeBlockAccumulator>*)this);
+		return static_cast<StatType<TimeBlockAccumulator::CallCountFacet>&>(*(StatType<TimeBlockAccumulator>*)this);
 	}
 
-	TraceType<TimeBlockAccumulator::SelfTimeFacet>& selfTime() 
+	StatType<TimeBlockAccumulator::SelfTimeFacet>& selfTime() 
 	{
-		return static_cast<TraceType<TimeBlockAccumulator::SelfTimeFacet>&>(*(TraceType<TimeBlockAccumulator>*)this);
+		return static_cast<StatType<TimeBlockAccumulator::SelfTimeFacet>&>(*(StatType<TimeBlockAccumulator>*)this);
 	}
 
 	static TimeBlock& getRootTimeBlock();
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index 73846ba900..1ad31cacfe 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -35,7 +35,7 @@ namespace LLTrace
 
 MemStatHandle gTraceMemStat("LLTrace");
 
-TraceBase::TraceBase( const char* name, const char* description ) 
+StatBase::StatBase( const char* name, const char* description ) 
 :	mName(name),
 	mDescription(description ? description : "")
 {
@@ -47,7 +47,7 @@ TraceBase::TraceBase( const char* name, const char* description )
 #endif
 }
 
-const char* TraceBase::getUnitLabel() const
+const char* StatBase::getUnitLabel() const
 {
 	return "";
 }
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 3dc2e5248f..325112b9b1 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -38,8 +38,6 @@
 #include "llpointer.h"
 #include "llunits.h"
 
-#include <list>
-
 namespace LLTrace
 {
 class Recording;
@@ -53,11 +51,11 @@ STORAGE_TYPE storage_value(LLUnit<STORAGE_TYPE, UNIT_TYPE> val) { return val.val
 template<typename UNIT_TYPE, typename STORAGE_TYPE> 
 STORAGE_TYPE storage_value(LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> val) { return val.value(); }
 
-class TraceBase
+class StatBase
 {
 public:
-	TraceBase(const char* name, const char* description);
-	virtual ~TraceBase() {};
+	StatBase(const char* name, const char* description);
+	virtual ~StatBase() {};
 	virtual const char* getUnitLabel() const;
 
 	const std::string& getName() const { return mName; }
@@ -69,14 +67,14 @@ protected:
 };
 
 template<typename ACCUMULATOR>
-class TraceType 
-:	public TraceBase,
-	public LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>
+class StatType 
+:	public StatBase,
+	public LLInstanceTracker<StatType<ACCUMULATOR>, std::string>
 {
 public:
-	TraceType(const char* name, const char* description = NULL)
-	:	LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>(name),
-		TraceBase(name, description),
+	StatType(const char* name, const char* description = NULL)
+	:	LLInstanceTracker<StatType<ACCUMULATOR>, std::string>(name),
+		StatBase(name, description),
 		mAccumulatorIndex(AccumulatorBuffer<ACCUMULATOR>::getDefaultBuffer()->reserveSlot())
 	{}
 
@@ -95,38 +93,38 @@ protected:
 
 
 template<>
-class TraceType<TimeBlockAccumulator::CallCountFacet>
-:	public TraceType<TimeBlockAccumulator>
+class StatType<TimeBlockAccumulator::CallCountFacet>
+:	public StatType<TimeBlockAccumulator>
 {
 public:
 
-	TraceType(const char* name, const char* description = "")
-	:	TraceType<TimeBlockAccumulator>(name, description)
+	StatType(const char* name, const char* description = "")
+	:	StatType<TimeBlockAccumulator>(name, description)
 	{}
 };
 
 template<>
-class TraceType<TimeBlockAccumulator::SelfTimeFacet>
-	:	public TraceType<TimeBlockAccumulator>
+class StatType<TimeBlockAccumulator::SelfTimeFacet>
+	:	public StatType<TimeBlockAccumulator>
 {
 public:
 
-	TraceType(const char* name, const char* description = "")
-		:	TraceType<TimeBlockAccumulator>(name, description)
+	StatType(const char* name, const char* description = "")
+		:	StatType<TimeBlockAccumulator>(name, description)
 	{}
 };
 
 template <typename T = F64>
 class EventStatHandle
-:	public TraceType<EventAccumulator>
+:	public StatType<EventAccumulator>
 {
 public:
 	typedef F64 storage_t;
-	typedef TraceType<EventAccumulator> trace_t;
+	typedef StatType<EventAccumulator> stat_t;
 	typedef EventStatHandle<T> self_t;
 
 	EventStatHandle(const char* name, const char* description = NULL)
-	:	trace_t(name, description)
+	:	stat_t(name, description)
 	{}
 
 	/*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); }
@@ -142,15 +140,15 @@ void record(EventStatHandle<T>& measurement, VALUE_T value)
 
 template <typename T = F64>
 class SampleStatHandle
-:	public TraceType<SampleAccumulator>
+:	public StatType<SampleAccumulator>
 {
 public:
 	typedef F64 storage_t;
-	typedef TraceType<SampleAccumulator> trace_t;
+	typedef StatType<SampleAccumulator> stat_t;
 	typedef SampleStatHandle<T> self_t;
 
 	SampleStatHandle(const char* name, const char* description = NULL)
-	:	trace_t(name, description)
+	:	stat_t(name, description)
 	{}
 
 	/*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); }
@@ -165,15 +163,15 @@ void sample(SampleStatHandle<T>& measurement, VALUE_T value)
 
 template <typename T = F64>
 class CountStatHandle
-:	public TraceType<CountAccumulator>
+:	public StatType<CountAccumulator>
 {
 public:
 	typedef F64 storage_t;
-	typedef TraceType<CountAccumulator> trace_t;
+	typedef StatType<CountAccumulator> stat_t;
 	typedef CountStatHandle<T> self_t;
 
 	CountStatHandle(const char* name, const char* description = NULL) 
-	:	trace_t(name, description)
+	:	stat_t(name, description)
 	{}
 
 	/*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); }
@@ -187,34 +185,36 @@ void add(CountStatHandle<T>& count, VALUE_T value)
 }
 
 template<>
-class TraceType<MemStatAccumulator::AllocationFacet>
-:	public TraceType<MemStatAccumulator>
+class StatType<MemAccumulator::AllocationFacet>
+:	public StatType<MemAccumulator>
 {
 public:
 
-	TraceType(const char* name, const char* description = "")
-	:	TraceType<MemStatAccumulator>(name, description)
+	StatType(const char* name, const char* description = "")
+	:	StatType<MemAccumulator>(name, description)
 	{}
 };
 
 template<>
-class TraceType<MemStatAccumulator::DeallocationFacet>
-:	public TraceType<MemStatAccumulator>
+class StatType<MemAccumulator::DeallocationFacet>
+:	public StatType<MemAccumulator>
 {
 public:
 
-	TraceType(const char* name, const char* description = "")
-	:	TraceType<MemStatAccumulator>(name, description)
+	StatType(const char* name, const char* description = "")
+	:	StatType<MemAccumulator>(name, description)
 	{}
 };
 
-class MemStatHandle : public TraceType<MemStatAccumulator>
+class MemStatHandle : public StatType<MemAccumulator>
 {
 public:
-	typedef TraceType<MemStatAccumulator> trace_t;
+	typedef StatType<MemAccumulator> stat_t;
 	MemStatHandle(const char* name)
-	:	trace_t(name)
-	{}
+	:	stat_t(name)
+	{
+		mName = name;
+	}
 
 	void setName(const char* name)
 	{
@@ -224,14 +224,14 @@ public:
 
 	/*virtual*/ const char* getUnitLabel() const { return "KB"; }
 
-	TraceType<MemStatAccumulator::AllocationFacet>& allocations() 
+	StatType<MemAccumulator::AllocationFacet>& allocations() 
 	{ 
-		return static_cast<TraceType<MemStatAccumulator::AllocationFacet>&>(*(TraceType<MemStatAccumulator>*)this);
+		return static_cast<StatType<MemAccumulator::AllocationFacet>&>(*(StatType<MemAccumulator>*)this);
 	}
 
-	TraceType<MemStatAccumulator::DeallocationFacet>& deallocations() 
+	StatType<MemAccumulator::DeallocationFacet>& deallocations() 
 	{ 
-		return static_cast<TraceType<MemStatAccumulator::DeallocationFacet>&>(*(TraceType<MemStatAccumulator>*)this);
+		return static_cast<StatType<MemAccumulator::DeallocationFacet>&>(*(StatType<MemAccumulator>*)this);
 	}
 };
 
@@ -324,7 +324,7 @@ inline void claim_alloc(MemStatHandle& measurement, const T& value)
 {
 	S32 size = MeasureMem<T>::measureFootprint(value);
 	if(size == 0) return;
-	MemStatAccumulator& accumulator = measurement.getCurrentAccumulator();
+	MemAccumulator& accumulator = measurement.getCurrentAccumulator();
 	accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size);
 	accumulator.mAllocations.record(size);
 }
@@ -334,18 +334,18 @@ inline void disclaim_alloc(MemStatHandle& measurement, const T& value)
 {
 	S32 size = MeasureMem<T>::measureFootprint(value);
 	if(size == 0) return;
-	MemStatAccumulator& accumulator = measurement.getCurrentAccumulator();
+	MemAccumulator& accumulator = measurement.getCurrentAccumulator();
 	accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size);
 	accumulator.mDeallocations.add(size);
 }
 
 template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN>
-class MemTrackable
+class MemTrackableNonVirtual
 {
 public:
 	typedef void mem_trackable_tag_t;
 
-	MemTrackable(const char* name)
+	MemTrackableNonVirtual(const char* name)
 	:	mMemFootprint(0)
 	{
 		static bool name_initialized = false;
@@ -356,7 +356,7 @@ public:
 		}
 	}
 
-	virtual ~MemTrackable()
+	~MemTrackableNonVirtual()
 	{
 		disclaimMem(mMemFootprint);
 	}
@@ -374,12 +374,27 @@ public:
 		return ll_aligned_malloc(ALIGNMENT, size);
 	}
 
+	template<int CUSTOM_ALIGNMENT>
+	static void* aligned_new(size_t size)
+	{
+		claim_alloc(sMemStat, size);
+		return ll_aligned_malloc(CUSTOM_ALIGNMENT, size);
+	}
+
 	void operator delete(void* ptr, size_t size)
 	{
 		disclaim_alloc(sMemStat, size);
 		ll_aligned_free(ALIGNMENT, ptr);
 	}
 
+	template<int CUSTOM_ALIGNMENT>
+	static void aligned_delete(void* ptr, size_t size)
+	{
+		disclaim_alloc(sMemStat, size);
+		ll_aligned_free(CUSTOM_ALIGNMENT, ptr);
+	}
+
+
 	void* operator new [](size_t size)
 	{
 		claim_alloc(sMemStat, size);
@@ -420,7 +435,19 @@ private:
 };
 
 template<typename DERIVED, size_t ALIGNMENT>
-MemStatHandle MemTrackable<DERIVED, ALIGNMENT>::sMemStat("");
+MemStatHandle MemTrackableNonVirtual<DERIVED, ALIGNMENT>::sMemStat(typeid(MemTrackableNonVirtual<DERIVED, ALIGNMENT>).name());
 
+template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN>
+class MemTrackable : public MemTrackableNonVirtual<DERIVED, ALIGNMENT>
+{
+public:
+	MemTrackable(const char* name)
+	:	MemTrackableNonVirtual<DERIVED, ALIGNMENT>(name)
+	{}
+
+	virtual ~MemTrackable()
+	{}
+};
 }
+
 #endif // LL_LLTRACE_H
diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp
index c25bb704f5..7d0e63e76a 100644
--- a/indra/llcommon/lltraceaccumulators.cpp
+++ b/indra/llcommon/lltraceaccumulators.cpp
@@ -45,7 +45,7 @@ AccumulatorBufferGroup::AccumulatorBufferGroup()
 	claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
 	claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
 	claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
-	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator));
 }
 
 AccumulatorBufferGroup::AccumulatorBufferGroup(const AccumulatorBufferGroup& other)
@@ -59,7 +59,7 @@ AccumulatorBufferGroup::AccumulatorBufferGroup(const AccumulatorBufferGroup& oth
 	claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
 	claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
 	claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
-	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator));
 }
 
 AccumulatorBufferGroup::~AccumulatorBufferGroup()
@@ -68,7 +68,7 @@ AccumulatorBufferGroup::~AccumulatorBufferGroup()
 	disclaim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
 	disclaim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
 	disclaim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
-	disclaim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+	disclaim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator));
 }
 
 void AccumulatorBufferGroup::handOffTo(AccumulatorBufferGroup& other)
@@ -108,7 +108,7 @@ void AccumulatorBufferGroup::clearCurrent()
 	AccumulatorBuffer<SampleAccumulator>::clearCurrent();
 	AccumulatorBuffer<EventAccumulator>::clearCurrent();
 	AccumulatorBuffer<TimeBlockAccumulator>::clearCurrent();
-	AccumulatorBuffer<MemStatAccumulator>::clearCurrent();
+	AccumulatorBuffer<MemAccumulator>::clearCurrent();
 }
 
 bool AccumulatorBufferGroup::isCurrent() const
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index 27c0910665..85873d469a 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -52,7 +52,7 @@ namespace LLTrace
 	class AccumulatorBuffer : public LLRefCount
 	{
 		typedef AccumulatorBuffer<ACCUMULATOR> self_t;
-		static const S32 ACCUMULATOR_BUFFER_SIZE_INCREMENT = 16;
+		static const S32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 32;
 	private:
 		struct StaticAllocationMarker { };
 
@@ -67,7 +67,7 @@ namespace LLTrace
 		:	mStorageSize(0),
 			mStorage(NULL)
 		{
-			resize(other.mStorageSize);
+			resize(sNextStorageSlot);
 			for (S32 i = 0; i < sNextStorageSlot; i++)
 			{
 				mStorage[i] = other.mStorage[i];
@@ -152,7 +152,7 @@ namespace LLTrace
 			{
 				// 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);
+				resize(mStorageSize + mStorageSize / 2);
 			}
 			llassert(mStorage && next_slot < mStorageSize);
 			return next_slot;
@@ -207,7 +207,7 @@ namespace LLTrace
 				// so as not to trigger an access violation
 				sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker());
 				sInitialized = true;
-				sDefaultBuffer->resize(ACCUMULATOR_BUFFER_SIZE_INCREMENT);
+				sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE);
 			}
 			return sDefaultBuffer;
 		}
@@ -491,9 +491,9 @@ namespace LLTrace
 		U64					mChildTime;
 	};
 
-	struct MemStatAccumulator
+	struct MemAccumulator
 	{
-		typedef MemStatAccumulator self_t;
+		typedef MemAccumulator self_t;
 
 		// fake classes that allows us to view different facets of underlying statistic
 		struct AllocationFacet 
@@ -506,7 +506,7 @@ namespace LLTrace
 			typedef F64Bytes value_t;
 		};
 
-		void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type)
+		void addSamples(const MemAccumulator& other, EBufferAppendType append_type)
 		{
 			mAllocations.addSamples(other.mAllocations, append_type);
 			mDeallocations.addSamples(other.mDeallocations, append_type);
@@ -524,7 +524,7 @@ namespace LLTrace
 			}
 		}
 
-		void reset(const MemStatAccumulator* other)
+		void reset(const MemAccumulator* other)
 		{
 			mSize.reset(other ? &other->mSize : NULL);
 			mAllocations.reset(other ? &other->mAllocations : NULL);
@@ -561,7 +561,7 @@ namespace LLTrace
 		AccumulatorBuffer<SampleAccumulator>	mSamples;
 		AccumulatorBuffer<EventAccumulator>		mEvents;
 		AccumulatorBuffer<TimeBlockAccumulator> mStackTimers;
-		AccumulatorBuffer<MemStatAccumulator> 	mMemStats;
+		AccumulatorBuffer<MemAccumulator> 	mMemStats;
 	};
 }
 
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 06b4351339..87083eee96 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -137,26 +137,26 @@ void Recording::appendRecording( Recording& other )
 	mElapsedSeconds += other.mElapsedSeconds;
 }
 
-F64Seconds Recording::getSum(const TraceType<TimeBlockAccumulator>& stat)
+F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator>& stat)
 {
 	const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
 	return F64Seconds((F64)(accumulator.mTotalTimeCounter) 
 				/ (F64)LLTrace::TimeBlock::countsPerSecond());
 }
 
-F64Seconds Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat)
+F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat)
 {
 	const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
 	return F64Seconds((F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond());
 }
 
 
-S32 Recording::getSum(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat)
+S32 Recording::getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat)
 {
 	return mBuffers->mStackTimers[stat.getIndex()].mCalls;
 }
 
-F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat)
+F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator>& stat)
 {
 	const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
 
@@ -164,7 +164,7 @@ F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat)
 				/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value()));
 }
 
-F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat)
+F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat)
 {
 	const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
 
@@ -172,158 +172,158 @@ F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFa
 			/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value()));
 }
 
-F32 Recording::getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat)
+F32 Recording::getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& stat)
 {
 	return (F32)mBuffers->mStackTimers[stat.getIndex()].mCalls / mElapsedSeconds.value();
 }
 
-bool Recording::hasValue(const TraceType<MemStatAccumulator>& stat)
+bool Recording::hasValue(const StatType<MemAccumulator>& stat)
 {
 	return mBuffers->mMemStats[stat.getIndex()].mSize.hasValue();
 }
 
-F64Kilobytes Recording::getMin(const TraceType<MemStatAccumulator>& stat)
+F64Kilobytes Recording::getMin(const StatType<MemAccumulator>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin());
 }
 
-F64Kilobytes Recording::getMean(const TraceType<MemStatAccumulator>& stat)
+F64Kilobytes Recording::getMean(const StatType<MemAccumulator>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMean());
 }
 
-F64Kilobytes Recording::getMax(const TraceType<MemStatAccumulator>& stat)
+F64Kilobytes Recording::getMax(const StatType<MemAccumulator>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMax());
 }
 
-F64Kilobytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator>& stat)
+F64Kilobytes Recording::getStandardDeviation(const StatType<MemAccumulator>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation());
 }
 
-F64Kilobytes Recording::getLastValue(const TraceType<MemStatAccumulator>& stat)
+F64Kilobytes Recording::getLastValue(const StatType<MemAccumulator>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue());
 }
 
-F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
+F64Kilobytes Recording::getSum(const StatType<MemAccumulator::AllocationFacet>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum());
 }
 
-F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
+F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum() / mElapsedSeconds.value());
 }
 
-S32 Recording::getSampleCount(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
+S32 Recording::getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat)
 {
 	return mBuffers->mMemStats[stat.getIndex()].mAllocations.getSampleCount();
 }
 
-F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
+F64Kilobytes Recording::getSum(const StatType<MemAccumulator::DeallocationFacet>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum());
 }
 
-F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
+F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat)
 {
 	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum() / mElapsedSeconds.value());
 }
 
-S32 Recording::getSampleCount(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
+S32 Recording::getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat)
 {
 	return mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSampleCount();
 }
 
-F64 Recording::getSum( const TraceType<CountAccumulator>& stat )
+F64 Recording::getSum( const StatType<CountAccumulator>& stat )
 {
 	return mBuffers->mCounts[stat.getIndex()].getSum();
 }
 
-F64 Recording::getSum( const TraceType<EventAccumulator>& stat )
+F64 Recording::getSum( const StatType<EventAccumulator>& stat )
 {
 	return (F64)mBuffers->mEvents[stat.getIndex()].getSum();
 }
 
-F64 Recording::getPerSec( const TraceType<CountAccumulator>& stat )
+F64 Recording::getPerSec( const StatType<CountAccumulator>& stat )
 {
 	F64 sum = mBuffers->mCounts[stat.getIndex()].getSum();
 	return  sum / mElapsedSeconds.value();
 }
 
-S32 Recording::getSampleCount( const TraceType<CountAccumulator>& stat )
+S32 Recording::getSampleCount( const StatType<CountAccumulator>& stat )
 {
 	return mBuffers->mCounts[stat.getIndex()].getSampleCount();
 }
 
-bool Recording::hasValue(const TraceType<SampleAccumulator>& stat)
+bool Recording::hasValue(const StatType<SampleAccumulator>& stat)
 {
 	return mBuffers->mSamples[stat.getIndex()].hasValue();
 }
 
-F64 Recording::getMin( const TraceType<SampleAccumulator>& stat )
+F64 Recording::getMin( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getMin();
 }
 
-F64 Recording::getMax( const TraceType<SampleAccumulator>& stat )
+F64 Recording::getMax( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getMax();
 }
 
-F64 Recording::getMean( const TraceType<SampleAccumulator>& stat )
+F64 Recording::getMean( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getMean();
 }
 
-F64 Recording::getStandardDeviation( const TraceType<SampleAccumulator>& stat )
+F64 Recording::getStandardDeviation( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getStandardDeviation();
 }
 
-F64 Recording::getLastValue( const TraceType<SampleAccumulator>& stat )
+F64 Recording::getLastValue( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getLastValue();
 }
 
-S32 Recording::getSampleCount( const TraceType<SampleAccumulator>& stat )
+S32 Recording::getSampleCount( const StatType<SampleAccumulator>& stat )
 {
 	return mBuffers->mSamples[stat.getIndex()].getSampleCount();
 }
 
-bool Recording::hasValue(const TraceType<EventAccumulator>& stat)
+bool Recording::hasValue(const StatType<EventAccumulator>& stat)
 {
 	return mBuffers->mEvents[stat.getIndex()].hasValue();
 }
 
-F64 Recording::getMin( const TraceType<EventAccumulator>& stat )
+F64 Recording::getMin( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getMin();
 }
 
-F64 Recording::getMax( const TraceType<EventAccumulator>& stat )
+F64 Recording::getMax( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getMax();
 }
 
-F64 Recording::getMean( const TraceType<EventAccumulator>& stat )
+F64 Recording::getMean( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getMean();
 }
 
-F64 Recording::getStandardDeviation( const TraceType<EventAccumulator>& stat )
+F64 Recording::getStandardDeviation( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getStandardDeviation();
 }
 
-F64 Recording::getLastValue( const TraceType<EventAccumulator>& stat )
+F64 Recording::getLastValue( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getLastValue();
 }
 
-S32 Recording::getSampleCount( const TraceType<EventAccumulator>& stat )
+S32 Recording::getSampleCount( const StatType<EventAccumulator>& stat )
 {
 	return mBuffers->mEvents[stat.getIndex()].getSampleCount();
 }
@@ -534,7 +534,7 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
 	getCurRecording().splitTo(other.getCurRecording());
 }
 
-F64 PeriodicRecording::getPeriodMin( const TraceType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -556,7 +556,7 @@ F64 PeriodicRecording::getPeriodMin( const TraceType<EventAccumulator>& stat, S3
 			: NaN;
 }
 
-F64 PeriodicRecording::getPeriodMax( const TraceType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -579,7 +579,7 @@ F64 PeriodicRecording::getPeriodMax( const TraceType<EventAccumulator>& stat, S3
 }
 
 // calculates means using aggregates per period
-F64 PeriodicRecording::getPeriodMean( const TraceType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -603,7 +603,7 @@ F64 PeriodicRecording::getPeriodMean( const TraceType<EventAccumulator>& stat, S
 }
 
 
-F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -628,7 +628,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<EventAccumula
 			: NaN;
 }
 
-F64 PeriodicRecording::getPeriodMin( const TraceType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -650,7 +650,7 @@ F64 PeriodicRecording::getPeriodMin( const TraceType<SampleAccumulator>& stat, S
 			: NaN;
 }
 
-F64 PeriodicRecording::getPeriodMax(const TraceType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
+F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -673,7 +673,7 @@ F64 PeriodicRecording::getPeriodMax(const TraceType<SampleAccumulator>& stat, S3
 }
 
 
-F64 PeriodicRecording::getPeriodMean( const TraceType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -696,7 +696,7 @@ F64 PeriodicRecording::getPeriodMean( const TraceType<SampleAccumulator>& stat,
 			: NaN;
 }
 
-F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -722,7 +722,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<SampleAccumul
 }
 
 
-F64Kilobytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -739,10 +739,10 @@ F64Kilobytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator
 
 F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, S32 num_periods)
 {
-	return getPeriodMin(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods);
+	return getPeriodMin(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
 }
 
-F64Kilobytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
+F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -759,10 +759,10 @@ F64Kilobytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>
 
 F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, S32 num_periods)
 {
-	return getPeriodMax(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods);
+	return getPeriodMax(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
 }
 
-F64Kilobytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -780,10 +780,10 @@ F64Kilobytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulato
 
 F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, S32 num_periods)
 {
-	return getPeriodMean(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods);
+	return getPeriodMean(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
 }
 
-F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemStatAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
+F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
 {
 	S32 total_periods = mRecordingPeriods.size();
 	num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -810,7 +810,7 @@ F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemS
 
 F64Kilobytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods)
 {
-	return getPeriodStandardDeviation(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods);
+	return getPeriodStandardDeviation(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
 }
 
 ///////////////////////////////////////////////////////////////////////
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 8bb0b1892f..810f796666 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -113,7 +113,7 @@ private:
 namespace LLTrace
 {
 	template<typename T>
-	class TraceType;
+	class StatType;
 
 	template<typename T>
 	class CountStatHandle;
@@ -168,135 +168,135 @@ namespace LLTrace
 		void makeUnique() { mBuffers.makeUnique(); }
 
 		// Timer accessors
-		F64Seconds getSum(const TraceType<TimeBlockAccumulator>& stat);
-		F64Seconds getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat);
-		S32 getSum(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat);
+		F64Seconds getSum(const StatType<TimeBlockAccumulator>& stat);
+		F64Seconds getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat);
+		S32 getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat);
 
-		F64Seconds getPerSec(const TraceType<TimeBlockAccumulator>& stat);
-		F64Seconds getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat);
-		F32 getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat);
+		F64Seconds getPerSec(const StatType<TimeBlockAccumulator>& stat);
+		F64Seconds getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat);
+		F32 getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& stat);
 
 		// Memory accessors
-		bool hasValue(const TraceType<MemStatAccumulator>& stat);
+		bool hasValue(const StatType<MemAccumulator>& stat);
 
-		F64Kilobytes getMin(const TraceType<MemStatAccumulator>& stat);
-		F64Kilobytes getMean(const TraceType<MemStatAccumulator>& stat);
-		F64Kilobytes getMax(const TraceType<MemStatAccumulator>& stat);
-		F64Kilobytes getStandardDeviation(const TraceType<MemStatAccumulator>& stat);
-		F64Kilobytes getLastValue(const TraceType<MemStatAccumulator>& stat);
+		F64Kilobytes getMin(const StatType<MemAccumulator>& stat);
+		F64Kilobytes getMean(const StatType<MemAccumulator>& stat);
+		F64Kilobytes getMax(const StatType<MemAccumulator>& stat);
+		F64Kilobytes getStandardDeviation(const StatType<MemAccumulator>& stat);
+		F64Kilobytes getLastValue(const StatType<MemAccumulator>& stat);
 
-		F64Kilobytes getSum(const TraceType<MemStatAccumulator::AllocationFacet>& stat);
-		F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::AllocationFacet>& stat);
-		S32 getSampleCount(const TraceType<MemStatAccumulator::AllocationFacet>& stat);
+		F64Kilobytes getSum(const StatType<MemAccumulator::AllocationFacet>& stat);
+		F64Kilobytes getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat);
+		S32 getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat);
 
-		F64Kilobytes getSum(const TraceType<MemStatAccumulator::DeallocationFacet>& stat);
-		F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::DeallocationFacet>& stat);
-		S32 getSampleCount(const TraceType<MemStatAccumulator::DeallocationFacet>& stat);
+		F64Kilobytes getSum(const StatType<MemAccumulator::DeallocationFacet>& stat);
+		F64Kilobytes getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat);
+		S32 getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat);
 
 		// CountStatHandle accessors
-		F64 getSum(const TraceType<CountAccumulator>& stat);
+		F64 getSum(const StatType<CountAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::sum_t getSum(const CountStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const TraceType<CountAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const StatType<CountAccumulator>&> (stat));
 		}
 
-		F64 getPerSec(const TraceType<CountAccumulator>& stat);
+		F64 getPerSec(const StatType<CountAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::fractional_t getPerSec(const CountStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::fractional_t)getPerSec(static_cast<const TraceType<CountAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getPerSec(static_cast<const StatType<CountAccumulator>&> (stat));
 		}
 
-		S32 getSampleCount(const TraceType<CountAccumulator>& stat);
+		S32 getSampleCount(const StatType<CountAccumulator>& stat);
 
 
 		// SampleStatHandle accessors
-		bool hasValue(const TraceType<SampleAccumulator>& stat);
+		bool hasValue(const StatType<SampleAccumulator>& stat);
 
-		F64 getMin(const TraceType<SampleAccumulator>& stat);
+		F64 getMin(const StatType<SampleAccumulator>& stat);
 		template <typename T>
 		T getMin(const SampleStatHandle<T>& stat)
 		{
-			return (T)getMin(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (T)getMin(static_cast<const StatType<SampleAccumulator>&> (stat));
 		}
 
-		F64 getMax(const TraceType<SampleAccumulator>& stat);
+		F64 getMax(const StatType<SampleAccumulator>& stat);
 		template <typename T>
 		T getMax(const SampleStatHandle<T>& stat)
 		{
-			return (T)getMax(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (T)getMax(static_cast<const StatType<SampleAccumulator>&> (stat));
 		}
 
-		F64 getMean(const TraceType<SampleAccumulator>& stat);
+		F64 getMean(const StatType<SampleAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::fractional_t getMean(SampleStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const StatType<SampleAccumulator>&> (stat));
 		}
 
-		F64 getStandardDeviation(const TraceType<SampleAccumulator>& stat);
+		F64 getStandardDeviation(const StatType<SampleAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::fractional_t getStandardDeviation(const SampleStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const StatType<SampleAccumulator>&> (stat));
 		}
 
-		F64 getLastValue(const TraceType<SampleAccumulator>& stat);
+		F64 getLastValue(const StatType<SampleAccumulator>& stat);
 		template <typename T>
 		T getLastValue(const SampleStatHandle<T>& stat)
 		{
-			return (T)getLastValue(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (T)getLastValue(static_cast<const StatType<SampleAccumulator>&> (stat));
 		}
 
-		S32 getSampleCount(const TraceType<SampleAccumulator>& stat);
+		S32 getSampleCount(const StatType<SampleAccumulator>& stat);
 
 		// EventStatHandle accessors
-		bool hasValue(const TraceType<EventAccumulator>& stat);
+		bool hasValue(const StatType<EventAccumulator>& stat);
 
-		F64 getSum(const TraceType<EventAccumulator>& stat);
+		F64 getSum(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::sum_t getSum(const EventStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		F64 getMin(const TraceType<EventAccumulator>& stat);
+		F64 getMin(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		T getMin(const EventStatHandle<T>& stat)
 		{
-			return (T)getMin(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (T)getMin(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		F64 getMax(const TraceType<EventAccumulator>& stat);
+		F64 getMax(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		T getMax(const EventStatHandle<T>& stat)
 		{
-			return (T)getMax(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (T)getMax(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		F64 getMean(const TraceType<EventAccumulator>& stat);
+		F64 getMean(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::fractional_t getMean(EventStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		F64 getStandardDeviation(const TraceType<EventAccumulator>& stat);
+		F64 getStandardDeviation(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		typename RelatedTypes<T>::fractional_t getStandardDeviation(const EventStatHandle<T>& stat)
 		{
-			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		F64 getLastValue(const TraceType<EventAccumulator>& stat);
+		F64 getLastValue(const StatType<EventAccumulator>& stat);
 		template <typename T>
 		T getLastValue(const EventStatHandle<T>& stat)
 		{
-			return (T)getLastValue(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (T)getLastValue(static_cast<const StatType<EventAccumulator>&> (stat));
 		}
 
-		S32 getSampleCount(const TraceType<EventAccumulator>& stat);
+		S32 getSampleCount(const StatType<EventAccumulator>& stat);
 
 		F64Seconds getDuration() const { return mElapsedSeconds; }
 
@@ -342,7 +342,7 @@ namespace LLTrace
 		Recording snapshotCurRecording() const;
 
 		template <typename T>
-		S32 getSampleCount(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		S32 getSampleCount(const StatType<T>& stat, S32 num_periods = S32_MAX)
         {
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -362,7 +362,7 @@ namespace LLTrace
 
 		// catch all for stats that have a defined sum
 		template <typename T>
-		typename T::value_t getPeriodMin(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		typename T::value_t getPeriodMin(const StatType<T>& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -379,28 +379,28 @@ namespace LLTrace
 		template<typename T>
 		T getPeriodMin(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMin(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return T(getPeriodMin(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodMin(const TraceType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMin(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		T getPeriodMin(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMin(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
+			return T(getPeriodMin(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodMin(const TraceType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMin(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		T getPeriodMin(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMin(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
+			return T(getPeriodMin(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
 		}
 
-		F64Kilobytes getPeriodMin(const TraceType<MemStatAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
 		F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX);
 
 		template <typename T>
-		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -417,7 +417,7 @@ namespace LLTrace
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
 
 		//
@@ -426,7 +426,7 @@ namespace LLTrace
 
 		// catch all for stats that have a defined sum
 		template <typename T>
-		typename T::value_t getPeriodMax(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		typename T::value_t getPeriodMax(const StatType<T>& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -443,28 +443,28 @@ namespace LLTrace
 		template<typename T>
 		T getPeriodMax(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMax(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return T(getPeriodMax(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodMax(const TraceType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		T getPeriodMax(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMax(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
+			return T(getPeriodMax(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodMax(const TraceType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMax(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		T getPeriodMax(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return T(getPeriodMax(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
+			return T(getPeriodMax(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
 		}
 
-		F64Kilobytes getPeriodMax(const TraceType<MemStatAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
 		F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX);
 
 		template <typename T>
-		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -481,7 +481,7 @@ namespace LLTrace
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
 
 		//
@@ -490,7 +490,7 @@ namespace LLTrace
 
 		// catch all for stats that have a defined sum
 		template <typename T>
-		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const TraceType<T >& stat, S32 num_periods = S32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -513,27 +513,27 @@ namespace LLTrace
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
-		F64 getPeriodMean(const TraceType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMean(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T> 
 		typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodMean(const TraceType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodMean(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
 		}
 
-		F64Kilobytes getPeriodMean(const TraceType<MemStatAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
 		F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX);
 		
 		template <typename T>
-		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const TraceType<T>& stat, S32 num_periods = S32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
 		{
 			S32 total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
@@ -557,29 +557,29 @@ namespace LLTrace
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
 		}
 
 		//
 		// PERIODIC STANDARD DEVIATION
 		//
 
-		F64 getPeriodStandardDeviation(const TraceType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
 
 		template<typename T> 
 		typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
 		}
 
-		F64 getPeriodStandardDeviation(const TraceType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
 		template<typename T>
 		typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
 		{
-			return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
 		}
 
-		F64Kilobytes getPeriodStandardDeviation(const TraceType<MemStatAccumulator>& stat, S32 num_periods = S32_MAX);
+		F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
 		F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX);
 
 	private:
diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h
index ff711b8004..9fca8b8cd3 100755
--- a/indra/llrender/lltexture.h
+++ b/indra/llrender/lltexture.h
@@ -33,6 +33,8 @@
 #define LL_TEXTURE_H
 
 #include "llrefcount.h"
+#include "lltrace.h"
+
 class LLImageGL ;
 class LLTexUnit ;
 class LLFontGL ;
@@ -40,7 +42,7 @@ class LLFontGL ;
 //
 //this is an abstract class as the parent for the class LLGLTexture
 //
-class LLTexture : public virtual LLRefCount
+class LLTexture : public virtual LLRefCount, public LLTrace::MemTrackable<LLTexture>
 {
 	friend class LLTexUnit ;
 	friend class LLFontGL ;
@@ -49,7 +51,9 @@ protected:
 	virtual ~LLTexture();
 
 public:
-	LLTexture(){}
+	LLTexture()
+	:	LLTrace::MemTrackable<LLTexture>("LLTexture")
+	{}
 
 	//
 	//interfaces to access LLGLTexture
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index bc8235132e..24256c3193 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -284,7 +284,7 @@ S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const
 	return num_rapid_changes;
 }
 
-S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const LLTrace::TraceType<LLTrace::CountAccumulator>& stat, const F32Seconds time_period)
+S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const LLTrace::StatType<LLTrace::CountAccumulator>& stat, const F32Seconds time_period)
 {
 	F32Seconds	elapsed_time,
 				time_since_value_changed;
@@ -332,7 +332,7 @@ void LLStatBar::draw()
 	{
 	case STAT_COUNT:
 		{
-			const LLTrace::TraceType<LLTrace::CountAccumulator>& count_stat = *mStat.countStatp;
+			const LLTrace::StatType<LLTrace::CountAccumulator>& count_stat = *mStat.countStatp;
 
 			unit_label    = std::string(count_stat.getUnitLabel()) + "/s";
 			current       = last_frame_recording.getPerSec(count_stat);
@@ -344,7 +344,7 @@ void LLStatBar::draw()
 		break;
 	case STAT_EVENT:
 		{
-			const LLTrace::TraceType<LLTrace::EventAccumulator>& event_stat = *mStat.eventStatp;
+			const LLTrace::StatType<LLTrace::EventAccumulator>& event_stat = *mStat.eventStatp;
 
 			unit_label        = mUnitLabel.empty() ? event_stat.getUnitLabel() : mUnitLabel;
 			current           = last_frame_recording.getLastValue(event_stat);
@@ -356,7 +356,7 @@ void LLStatBar::draw()
 		break;
 	case STAT_SAMPLE:
 		{
-			const LLTrace::TraceType<LLTrace::SampleAccumulator>& sample_stat = *mStat.sampleStatp;
+			const LLTrace::StatType<LLTrace::SampleAccumulator>& sample_stat = *mStat.sampleStatp;
 
 			unit_label        = mUnitLabel.empty() ? sample_stat.getUnitLabel() : mUnitLabel;
 			current           = last_frame_recording.getLastValue(sample_stat);
@@ -379,7 +379,7 @@ void LLStatBar::draw()
 		break;
 	case STAT_MEM:
 		{
-			const LLTrace::TraceType<LLTrace::MemStatAccumulator>& mem_stat = *mStat.memStatp;
+			const LLTrace::StatType<LLTrace::MemAccumulator>& mem_stat = *mStat.memStatp;
 
 			unit_label        = mUnitLabel.empty() ? mem_stat.getUnitLabel() : mUnitLabel;
 			current           = last_frame_recording.getLastValue(mem_stat).value();
@@ -578,27 +578,27 @@ void LLStatBar::draw()
 void LLStatBar::setStat(const std::string& stat_name)
 {
 	using namespace LLTrace;
-	const TraceType<CountAccumulator>*		count_stat;
-	const TraceType<EventAccumulator>*		event_stat;
-	const TraceType<SampleAccumulator>*		sample_stat;
-	const TraceType<MemStatAccumulator>*	mem_stat;
+	const StatType<CountAccumulator>*		count_stat;
+	const StatType<EventAccumulator>*		event_stat;
+	const StatType<SampleAccumulator>*		sample_stat;
+	const StatType<MemAccumulator>*	mem_stat;
 
-	if ((count_stat = TraceType<CountAccumulator>::getInstance(stat_name)))
+	if ((count_stat = StatType<CountAccumulator>::getInstance(stat_name)))
 	{
 		mStat.countStatp = count_stat;
 		mStatType = STAT_COUNT;
 	}
-	else if ((event_stat = TraceType<EventAccumulator>::getInstance(stat_name)))
+	else if ((event_stat = StatType<EventAccumulator>::getInstance(stat_name)))
 	{
 		mStat.eventStatp = event_stat;
 		mStatType = STAT_EVENT;
 	}
-	else if ((sample_stat = TraceType<SampleAccumulator>::getInstance(stat_name)))
+	else if ((sample_stat = StatType<SampleAccumulator>::getInstance(stat_name)))
 	{
 		mStat.sampleStatp = sample_stat;
 		mStatType = STAT_SAMPLE;
 	}
-	else if ((mem_stat = TraceType<MemStatAccumulator>::getInstance(stat_name)))
+	else if ((mem_stat = StatType<MemAccumulator>::getInstance(stat_name)))
 	{
 		mStat.memStatp = mem_stat;
 		mStatType = STAT_MEM;
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index 5e9255b9eb..57e492bc80 100755
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -105,10 +105,10 @@ private:
 	union
 	{
 		void*														valid;
-		const LLTrace::TraceType<LLTrace::CountAccumulator>*		countStatp;
-		const LLTrace::TraceType<LLTrace::EventAccumulator>*		eventStatp;
-		const LLTrace::TraceType<LLTrace::SampleAccumulator>*		sampleStatp;
-		const LLTrace::TraceType<LLTrace::MemStatAccumulator>*		memStatp;
+		const LLTrace::StatType<LLTrace::CountAccumulator>*		countStatp;
+		const LLTrace::StatType<LLTrace::EventAccumulator>*		eventStatp;
+		const LLTrace::StatType<LLTrace::SampleAccumulator>*		sampleStatp;
+		const LLTrace::StatType<LLTrace::MemAccumulator>*		memStatp;
 	} mStat;
 
 	LLUIString   mLabel;
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index 38fe12d18b..f381e92a4d 100755
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -57,9 +57,9 @@ public:
 
 	struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
 	{
-		Alternative<LLTrace::TraceType<LLTrace::CountAccumulator>* >	count_stat_float;
-		Alternative<LLTrace::TraceType<LLTrace::EventAccumulator>* >	event_stat_float;
-		Alternative<LLTrace::TraceType<LLTrace::SampleAccumulator>* >	sample_stat_float;
+		Alternative<LLTrace::StatType<LLTrace::CountAccumulator>* >	count_stat_float;
+		Alternative<LLTrace::StatType<LLTrace::EventAccumulator>* >	event_stat_float;
+		Alternative<LLTrace::StatType<LLTrace::SampleAccumulator>* >	sample_stat_float;
 	};
 
 	struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -104,7 +104,7 @@ public:
 	/*virtual*/ void setValue(const LLSD& value);
 	
 private:
-	LLTrace::TraceType<LLTrace::CountAccumulator>*	mNewStatFloatp;
+	LLTrace::StatType<LLTrace::CountAccumulator>*	mNewStatFloatp;
 
 	BOOL mPerSec;
 
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 730c3b2ada..00382125a8 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1871,7 +1871,6 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
 	// when there are no segments, we return the end iterator, which must be checked by caller
 	if (mSegments.size() <= 1) { return mSegments.begin(); }
 
-	//FIXME: avoid operator new somehow (without running into refcount problems)
 	index_segment->setStart(index);
 	index_segment->setEnd(index);
 	segment_set_t::iterator it = mSegments.upper_bound(index_segment);
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 4b6c80b51a..5981153bd5 100755
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1047,7 +1047,7 @@ bool LLDrawable::isVisible() const
 }
 
 {
-		LLviewerOctreeGroup* group = mEntry->getGroup();
+		LLViewerOctreeGroup* group = mEntry->getGroup();
 		if (group && group->isVisible())
 		{
 			LLViewerOctreeEntryData::setVisible();
@@ -1073,7 +1073,7 @@ bool LLDrawable::isRecentlyVisible() const
 	return vis ;
 }
 
-void LLDrawable::setGroup(LLviewerOctreeGroup *groupp)
+void LLDrawable::setGroup(LLViewerOctreeGroup *groupp)
 	{
 	LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup();
     
diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h
index 067cee6838..a3461d4c01 100755
--- a/indra/newview/lldrawable.h
+++ b/indra/newview/lldrawable.h
@@ -176,7 +176,7 @@ public:
 
 	virtual void cleanupReferences();
 
-	void setGroup(LLviewerOctreeGroup* group);
+	void setGroup(LLViewerOctreeGroup* group);
 	void setRadius(const F32 radius);
 	F32 getRadius() const						{ return mRadius; }
 	F32 getVisibilityRadius() const;
diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h
index d287ae6eeb..f3f57c9a6b 100755
--- a/indra/newview/lldynamictexture.h
+++ b/indra/newview/lldynamictexture.h
@@ -38,12 +38,12 @@ class LLViewerDynamicTexture : public LLViewerTexture
 public:
 	void* operator new(size_t size)
 	{
-		return ll_aligned_malloc_16(size);
+		return LLTrace::MemTrackable<LLTexture>::aligned_new<16>(size);
 	}
 
-	void operator delete(void* ptr)
+	void operator delete(void* ptr, size_t size)
 	{
-		ll_aligned_free_16(ptr);
+		LLTrace::MemTrackable<LLTexture>::aligned_delete<16>(ptr, size);
 	}
 
 	enum
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index 25c87b54f8..40f4968801 100755
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -53,22 +53,11 @@ class LLDrawInfo;
 const F32 MIN_ALPHA_SIZE = 1024.f;
 const F32 MIN_TEX_ANIM_SIZE = 512.f;
 
-class LLFace
+class LLFace : public LLTrace::MemTrackableNonVirtual<LLFace, 16>
 {
 public:
-
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
-
 	LLFace(const LLFace& rhs)
+	:	LLTrace::MemTrackableNonVirtual<LLFace, 16>("LLFace")
 	{
 		*this = rhs;
 	}
@@ -96,7 +85,11 @@ public:
 	static void cacheFaceInVRAM(const LLVolumeFace& vf);
 
 public:
-	LLFace(LLDrawable* drawablep, LLViewerObject* objp)   { init(drawablep, objp); }
+	LLFace(LLDrawable* drawablep, LLViewerObject* objp)
+	:	LLTrace::MemTrackableNonVirtual<LLFace, 16>("LLFace")
+	{
+		init(drawablep, objp);
+	}
 	~LLFace()  { destroy(); }
 
 	const LLMatrix4& getWorldMatrix()	const	{ return mVObjp->getWorldMatrix(mXform); }
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index c1ebd1f435..db2936b1fd 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -546,7 +546,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 	os << '\n';
 
 
-	typedef TraceType<CountAccumulator> trace_count;
+	typedef StatType<CountAccumulator> trace_count;
 	for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances();
 		it != end_it;
 		++it)
@@ -579,7 +579,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 		}
 	}
 
-	typedef TraceType<EventAccumulator> trace_event;
+	typedef StatType<EventAccumulator> trace_event;
 
 	for (trace_event::instance_iter it = trace_event::beginInstances(), end_it = trace_event::endInstances();
 		it != end_it;
@@ -620,7 +620,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 		}
 	}
 
-	typedef TraceType<SampleAccumulator> trace_sample;
+	typedef StatType<SampleAccumulator> trace_sample;
 
 	for (trace_sample::instance_iter it = trace_sample::beginInstances(), end_it = trace_sample::endInstances();
 		it != end_it;
@@ -661,7 +661,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 		}
 	}
 
-	typedef TraceType<MemStatAccumulator> trace_mem;
+	typedef StatType<MemAccumulator> trace_mem;
 	for (trace_mem::instance_iter it = trace_mem::beginInstances(), end_it = trace_mem::endInstances();
 		it != end_it;
 		++it)
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 0fbe1578cf..045fcccad7 100755
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -483,7 +483,7 @@ void LLSpatialPartition::rebuildMesh(LLSpatialGroup* group)
 
 LLSpatialGroup* LLSpatialGroup::getParent()
 {
-	return (LLSpatialGroup*)LLviewerOctreeGroup::getParent();
+	return (LLSpatialGroup*)LLViewerOctreeGroup::getParent();
 	}
 
 BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree)
@@ -831,7 +831,7 @@ void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry*
 void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* entry)
 {
 	removeObject((LLDrawable*)entry->getDrawable(), TRUE);
-	LLviewerOctreeGroup::handleRemoval(node, entry);
+	LLViewerOctreeGroup::handleRemoval(node, entry);
 }
 
 void LLSpatialGroup::handleDestruction(const TreeNode* node)
@@ -1065,7 +1065,7 @@ class LLOctreeCull : public LLViewerOctreeCull
 public:
 	LLOctreeCull(LLCamera* camera) : LLViewerOctreeCull(camera) {}
 
-	virtual bool earlyFail(LLviewerOctreeGroup* base_group)
+	virtual bool earlyFail(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 		group->checkOcclusion();
@@ -1081,7 +1081,7 @@ public:
 		return false;
 	}
 	
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
 	{
 		S32 res = AABBInFrustumNoFarClipGroupBounds(group);
 		if (res != 0)
@@ -1091,7 +1091,7 @@ public:
 		return res;
 	}
 
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
 	{
 		S32 res = AABBInFrustumNoFarClipObjectBounds(group);
 		if (res != 0)
@@ -1101,7 +1101,7 @@ public:
 		return res;
 	}
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 		if (group->needsUpdate() ||
@@ -1119,12 +1119,12 @@ public:
 	LLOctreeCullNoFarClip(LLCamera* camera) 
 		: LLOctreeCull(camera) { }
 
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
 	{
 		return AABBInFrustumNoFarClipGroupBounds(group);
 	}
 
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
 	{
 		S32 res = AABBInFrustumNoFarClipObjectBounds(group);
 		return res;
@@ -1137,12 +1137,12 @@ public:
 	LLOctreeCullShadow(LLCamera* camera)
 		: LLOctreeCull(camera) { }
 
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
 	{
 		return AABBInFrustumGroupBounds(group);
 	}
 
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
 	{
 		return AABBInFrustumObjectBounds(group);
 	}
@@ -1154,7 +1154,7 @@ public:
 	LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max)
 		: LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { }
 
-	virtual bool earlyFail(LLviewerOctreeGroup* base_group)
+	virtual bool earlyFail(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 
@@ -1195,7 +1195,7 @@ public:
 		}
 	}
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 		
@@ -1231,7 +1231,7 @@ public:
 	LLOctreeCullDetectVisible(LLCamera* camera)
 		: LLOctreeCullShadow(camera), mResult(FALSE) { }
 
-	virtual bool earlyFail(LLviewerOctreeGroup* base_group)
+	virtual bool earlyFail(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 
@@ -1246,7 +1246,7 @@ public:
 		return false;
 	}
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		if (base_group->isVisible())
 		{
@@ -1263,10 +1263,10 @@ public:
 	LLOctreeSelect(LLCamera* camera, std::vector<LLDrawable*>* results)
 		: LLOctreeCull(camera), mResults(results) { }
 
-	virtual bool earlyFail(LLviewerOctreeGroup* group) { return false; }
-	virtual void preprocess(LLviewerOctreeGroup* group) { }
+	virtual bool earlyFail(LLViewerOctreeGroup* group) { return false; }
+	virtual void preprocess(LLViewerOctreeGroup* group) { }
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 		OctreeNode* branch = group->getOctreeNode();
@@ -3909,7 +3909,7 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, co
 LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, 
 					   LLViewerTexture* texture, LLVertexBuffer* buffer,
 					   BOOL fullbright, U8 bump, BOOL particle, F32 part_size)
-:
+:	LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16>("LLDrawInfo"),
 	mVertexBuffer(buffer),
 	mTexture(texture),
 	mTextureMatrix(NULL),
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 4026175a9a..fef6fdc2c2 100755
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -55,24 +55,14 @@ class LLViewerRegion;
 
 void pushVerts(LLFace* face, U32 mask);
 
-class LLDrawInfo : public LLRefCount 
+class LLDrawInfo : public LLRefCount, public LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16>
 {
 protected:
 	~LLDrawInfo();	
 	
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
-
 	LLDrawInfo(const LLDrawInfo& rhs)
+	:	LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16>("LLDrawInfo")
 	{
 		*this = rhs;
 	}
@@ -209,16 +199,6 @@ public:
 		*this = rhs;
 	}
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
 	{
 		LL_ERRS() << "Illegal operation!" << LL_ENDL;
@@ -262,7 +242,7 @@ public:
 
 	typedef enum
 	{
-		GEOM_DIRTY				= LLviewerOctreeGroup::INVALID_STATE,
+		GEOM_DIRTY				= LLViewerOctreeGroup::INVALID_STATE,
 		ALPHA_DIRTY				= (GEOM_DIRTY << 1),
 		IN_IMAGE_QUEUE			= (ALPHA_DIRTY << 1),
 		IMAGE_DIRTY				= (IN_IMAGE_QUEUE << 1),
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index e8eba43242..5bd0a95387 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -231,9 +231,10 @@ S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LL
 //class LLViewerOctreeEntry definitions
 //-----------------------------------------------------------------------------------
 LLViewerOctreeEntry::LLViewerOctreeEntry() 
-	: mGroup(NULL),
-	  mBinRadius(0.f),
-	  mBinIndex(-1)
+:	LLTrace::MemTrackable<LLViewerOctreeEntry, 16>("LLViewerOctreeEntry"),
+	mGroup(NULL),
+	mBinRadius(0.f),
+	mBinIndex(-1)
 {
 	mPositionGroup.clear();
 	mExtents[0].clear();
@@ -271,7 +272,7 @@ void LLViewerOctreeEntry::removeData(LLViewerOctreeEntryData* data)
 	
 	if(mGroup != NULL && !mData[LLDRAWABLE])
 	{
-		LLviewerOctreeGroup* group = mGroup;
+		LLViewerOctreeGroup* group = mGroup;
 		mGroup = NULL;
 		group->removeFromGroup(data);
 
@@ -285,7 +286,7 @@ void LLViewerOctreeEntry::nullGroup()
 	mGroup = NULL;
 }
 
-void LLViewerOctreeEntry::setGroup(LLviewerOctreeGroup* group)
+void LLViewerOctreeEntry::setGroup(LLViewerOctreeGroup* group)
 {
 	if(mGroup == group)
 	{
@@ -294,7 +295,7 @@ void LLViewerOctreeEntry::setGroup(LLviewerOctreeGroup* group)
 
 	if(mGroup)
 	{
-		LLviewerOctreeGroup* group = mGroup;
+		LLViewerOctreeGroup* group = mGroup;
 		mGroup = NULL;
 		group->removeFromGroup(this);
 
@@ -363,7 +364,7 @@ const LLVector4a* LLViewerOctreeEntryData::getSpatialExtents() const
 }
 
 //virtual
-void LLViewerOctreeEntryData::setGroup(LLviewerOctreeGroup* group)
+void LLViewerOctreeEntryData::setGroup(LLViewerOctreeGroup* group)
 {
 	mEntry->setGroup(group);
 }
@@ -375,7 +376,7 @@ void LLViewerOctreeEntryData::shift(const LLVector4a &shift_vector)
 	mEntry->mPositionGroup.add(shift_vector);
 }
 
-LLviewerOctreeGroup* LLViewerOctreeEntryData::getGroup()const        
+LLViewerOctreeGroup* LLViewerOctreeEntryData::getGroup()const        
 {
 	return mEntry.notNull() ? mEntry->mGroup : NULL;
 }
@@ -425,15 +426,16 @@ void LLViewerOctreeEntryData::setVisible() const
 }
 
 //-----------------------------------------------------------------------------------
-//class LLviewerOctreeGroup definitions
+//class LLViewerOctreeGroup definitions
 //-----------------------------------------------------------------------------------
 
-LLviewerOctreeGroup::~LLviewerOctreeGroup()
+LLViewerOctreeGroup::~LLViewerOctreeGroup()
 {
 	//empty here
 }
 
-LLviewerOctreeGroup::LLviewerOctreeGroup(OctreeNode* node) :
+LLViewerOctreeGroup::LLViewerOctreeGroup(OctreeNode* node)
+:	LLTrace::MemTrackable<LLViewerOctreeGroup, 16>("LLViewerOctreeGroup"),
 	mOctreeNode(node),
 	mState(CLEAN)
 {
@@ -448,7 +450,7 @@ LLviewerOctreeGroup::LLviewerOctreeGroup(OctreeNode* node) :
 	mOctreeNode->addListener(this);
 }
 
-bool LLviewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data) 
+bool LLViewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data) 
 { 
 	if(!data->getEntry())
 	{
@@ -457,12 +459,12 @@ bool LLviewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data)
 	return std::find(getDataBegin(), getDataEnd(), data->getEntry()) != getDataEnd(); 
 }
 
-bool LLviewerOctreeGroup::removeFromGroup(LLViewerOctreeEntryData* data)
+bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntryData* data)
 {
 	return removeFromGroup(data->getEntry());
 }
 
-bool LLviewerOctreeGroup::removeFromGroup(LLViewerOctreeEntry* entry)
+bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntry* entry)
 {
 	llassert(entry != NULL);
 	llassert(!entry->getGroup());
@@ -483,7 +485,7 @@ bool LLviewerOctreeGroup::removeFromGroup(LLViewerOctreeEntry* entry)
 }
 
 //virtual 
-void LLviewerOctreeGroup::unbound()
+void LLViewerOctreeGroup::unbound()
 {
 	if (isDirty())
 	{
@@ -498,7 +500,7 @@ void LLviewerOctreeGroup::unbound()
 		OctreeNode* parent = (OctreeNode*) mOctreeNode->getParent();
 		while (parent != NULL)
 		{
-			LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) parent->getListener(0);
+			LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) parent->getListener(0);
 			if (!group || group->isDirty())
 			{
 				return;
@@ -511,7 +513,7 @@ void LLviewerOctreeGroup::unbound()
 }
 	
 //virtual 
-void LLviewerOctreeGroup::rebound()
+void LLViewerOctreeGroup::rebound()
 {
 	if (!isDirty())
 	{	
@@ -520,7 +522,7 @@ void LLviewerOctreeGroup::rebound()
 	
 	if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0)
 	{
-		LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
+		LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
 		group->rebound();
 		
 		//copy single child's bounding box
@@ -541,7 +543,7 @@ void LLviewerOctreeGroup::rebound()
 	{
 		LLVector4a& newMin = mExtents[0];
 		LLVector4a& newMax = mExtents[1];
-		LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
+		LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
 		group->clearState(SKIP_FRUSTUM_CHECK);
 		group->rebound();
 		//initialize to first child
@@ -551,7 +553,7 @@ void LLviewerOctreeGroup::rebound()
 		//first, rebound children
 		for (U32 i = 1; i < mOctreeNode->getChildCount(); i++)
 		{
-			group = (LLviewerOctreeGroup*) mOctreeNode->getChild(i)->getListener(0);
+			group = (LLViewerOctreeGroup*) mOctreeNode->getChild(i)->getListener(0);
 			group->clearState(SKIP_FRUSTUM_CHECK);
 			group->rebound();
 			const LLVector4a& max = group->mExtents[1];
@@ -575,7 +577,7 @@ void LLviewerOctreeGroup::rebound()
 }
 
 //virtual 
-void LLviewerOctreeGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj)
+void LLViewerOctreeGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj)
 {
 	obj->setGroup(this);	
 	unbound();
@@ -583,7 +585,7 @@ void LLviewerOctreeGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEn
 }
 	
 //virtual 
-void LLviewerOctreeGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj)
+void LLViewerOctreeGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj)
 {
 	unbound();
 	setState(OBJECT_DIRTY);
@@ -592,7 +594,7 @@ void LLviewerOctreeGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntr
 }
 	
 //virtual 
-void LLviewerOctreeGroup::handleDestruction(const TreeNode* node)
+void LLViewerOctreeGroup::handleDestruction(const TreeNode* node)
 {
 	for (OctreeNode::element_iter i = mOctreeNode->getDataBegin(); i != mOctreeNode->getDataEnd(); ++i)
 	{
@@ -607,7 +609,7 @@ void LLviewerOctreeGroup::handleDestruction(const TreeNode* node)
 }
 	
 //virtual 
-void LLviewerOctreeGroup::handleStateChange(const TreeNode* node)
+void LLViewerOctreeGroup::handleStateChange(const TreeNode* node)
 {
 	//drop bounding box upon state change
 	if (mOctreeNode != node)
@@ -618,29 +620,29 @@ void LLviewerOctreeGroup::handleStateChange(const TreeNode* node)
 }
 	
 //virtual 
-void LLviewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
+void LLViewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
 {
 	if (child->getListenerCount() == 0)
 	{
-		new LLviewerOctreeGroup(child);
+		new LLViewerOctreeGroup(child);
 	}
 	else
 	{
-		OCT_ERRS << "LLviewerOctreeGroup redundancy detected." << LL_ENDL;
+		OCT_ERRS << "LLViewerOctreeGroup redundancy detected." << LL_ENDL;
 	}
 
 	unbound();
 	
-	((LLviewerOctreeGroup*)child->getListener(0))->unbound();
+	((LLViewerOctreeGroup*)child->getListener(0))->unbound();
 }
 	
 //virtual 
-void LLviewerOctreeGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNode* child)
+void LLViewerOctreeGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNode* child)
 {
 	unbound();
 }
 
-LLviewerOctreeGroup* LLviewerOctreeGroup::getParent()
+LLViewerOctreeGroup* LLViewerOctreeGroup::getParent()
 {
 	if (isDead())
 	{
@@ -656,14 +658,14 @@ LLviewerOctreeGroup* LLviewerOctreeGroup::getParent()
 
 	if (parent)
 	{
-		return (LLviewerOctreeGroup*) parent->getListener(0);
+		return (LLViewerOctreeGroup*) parent->getListener(0);
 	}
 
 	return NULL;
 }
 
 //virtual 
-bool LLviewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut)
+bool LLViewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut)
 {
 	const OctreeNode* node = mOctreeNode;
 
@@ -721,23 +723,23 @@ bool LLviewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4
 }
 
 //virtual 
-BOOL LLviewerOctreeGroup::isVisible() const
+BOOL LLViewerOctreeGroup::isVisible() const
 {
 	return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? TRUE : FALSE;
 }
 
 //virtual 
-BOOL LLviewerOctreeGroup::isRecentlyVisible() const 
+BOOL LLViewerOctreeGroup::isRecentlyVisible() const 
 {
 	return FALSE;
 }
 
-void LLviewerOctreeGroup::setVisible()
+void LLViewerOctreeGroup::setVisible()
 {
 	mVisible[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
 }
 
-void LLviewerOctreeGroup::checkStates()
+void LLViewerOctreeGroup::checkStates()
 {
 #if LL_OCTREE_PARANOIA_CHECK
 	//LLOctreeStateCheck checker;
@@ -837,7 +839,7 @@ public:
 
 
 LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part) : 
-	LLviewerOctreeGroup(node),
+	LLViewerOctreeGroup(node),
 	mSpatialPartition(part)
 {
 	part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod;
@@ -885,7 +887,7 @@ void LLOcclusionCullingGroup::handleChildAddition(const OctreeNode* parent, Octr
 
 	unbound();
 	
-	((LLviewerOctreeGroup*)child->getListener(0))->unbound();
+	((LLViewerOctreeGroup*)child->getListener(0))->unbound();
 }
 
 void LLOcclusionCullingGroup::releaseOcclusionQueryObjectNames()
@@ -1316,7 +1318,7 @@ BOOL LLViewerOctreePartition::isOcclusionEnabled()
 //-----------------------------------------------------------------------------------
 
 //virtual 
-bool LLViewerOctreeCull::earlyFail(LLviewerOctreeGroup* group)
+bool LLViewerOctreeCull::earlyFail(LLViewerOctreeGroup* group)
 {	
 	return false;
 }
@@ -1324,7 +1326,7 @@ bool LLViewerOctreeCull::earlyFail(LLviewerOctreeGroup* group)
 //virtual 
 void LLViewerOctreeCull::traverse(const OctreeNode* n)
 {
-	LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) n->getListener(0);
+	LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) n->getListener(0);
 
 	if (earlyFail(group))
 	{
@@ -1332,7 +1334,7 @@ void LLViewerOctreeCull::traverse(const OctreeNode* n)
 	}
 		
 	if (mRes == 2 || 
-		(mRes && group->hasState(LLviewerOctreeGroup::SKIP_FRUSTUM_CHECK)))
+		(mRes && group->hasState(LLViewerOctreeGroup::SKIP_FRUSTUM_CHECK)))
 	{	//fully in, just add everything
 		OctreeTraveler::traverse(n);
 	}
@@ -1351,17 +1353,17 @@ void LLViewerOctreeCull::traverse(const OctreeNode* n)
 	
 //------------------------------------------
 //agent space group culling
-S32 LLViewerOctreeCull::AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBSphereIntersectGroupExtents(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group)
 {
 	return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
 }
 
-S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1]);
 }
@@ -1369,17 +1371,17 @@ S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLviewerOctreeGroup* grou
 
 //------------------------------------------
 //agent space object set culling
-S32 LLViewerOctreeCull::AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group)
 {
 	return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
 }
 
-S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
 }
@@ -1387,17 +1389,17 @@ S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLviewerOctreeGroup* gro
 
 //------------------------------------------
 //local regional space group culling
-S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInRegionFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBInRegionFrustumGroupBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInRegionFrustum(group->mBounds[0], group->mBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLviewerOctreeGroup* group, const LLVector3& shift)
+S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift)
 {
 	return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
 }
@@ -1405,24 +1407,24 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLviewerOctr
 
 //------------------------------------------
 //local regional space object culling
-S32 LLViewerOctreeCull::AABBInRegionFrustumObjectBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInRegionFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group)
+S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group)
 {
 	return mCamera->AABBInRegionFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
 }
 
-S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLviewerOctreeGroup* group, const LLVector3& shift)
+S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift)
 {
 	return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
 }
 //------------------------------------------
 
 //virtual 
-bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLviewerOctreeGroup* group)
+bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group)
 {
 	if (branch->getElementCount() == 0) //no elements
 	{
@@ -1441,19 +1443,19 @@ bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLviewerOc
 }
 
 //virtual 
-void LLViewerOctreeCull::preprocess(LLviewerOctreeGroup* group)
+void LLViewerOctreeCull::preprocess(LLViewerOctreeGroup* group)
 {		
 }
 	
 //virtual 
-void LLViewerOctreeCull::processGroup(LLviewerOctreeGroup* group)
+void LLViewerOctreeCull::processGroup(LLViewerOctreeGroup* group)
 {
 }
 	
 //virtual 
 void LLViewerOctreeCull::visit(const OctreeNode* branch) 
 {	
-	LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) branch->getListener(0);
+	LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
 
 	preprocess(group);
 		
@@ -1475,12 +1477,12 @@ void LLViewerOctreeDebug::visit(const OctreeNode* branch)
 		LL_INFOS() << "Child " << i << " : " << (U32)branch->getChild(i) << LL_ENDL;
 	}
 #endif
-	LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) branch->getListener(0);
+	LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
 	processGroup(group);	
 }
 
 //virtual 
-void LLViewerOctreeDebug::processGroup(LLviewerOctreeGroup* group)
+void LLViewerOctreeDebug::processGroup(LLViewerOctreeGroup* group)
 {
 #if 0
 	const LLVector4a* vec4 = group->getBounds();
diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h
index 174af5e22f..1eaa1b931e 100644
--- a/indra/newview/llvieweroctree.h
+++ b/indra/newview/llvieweroctree.h
@@ -41,7 +41,7 @@
 
 class LLViewerRegion;
 class LLViewerOctreeEntryData;
-class LLviewerOctreeGroup;
+class LLViewerOctreeGroup;
 class LLViewerOctreeEntry;
 class LLViewerOctreePartition;
 
@@ -53,7 +53,7 @@ typedef LLOctreeTraveler<LLViewerOctreeEntry>	OctreeTraveler;
 
 #if LL_OCTREE_PARANOIA_CHECK
 #define assert_octree_valid(x) x->validate()
-#define assert_states_valid(x) ((LLviewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates()
+#define assert_states_valid(x) ((LLViewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates()
 #else
 #define assert_octree_valid(x)
 #define assert_states_valid(x)
@@ -71,7 +71,7 @@ S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVe
 
 //defines data needed for octree of an entry
 //LL_ALIGN_PREFIX(16)
-class LLViewerOctreeEntry : public LLRefCount
+class LLViewerOctreeEntry : public LLRefCount, public LLTrace::MemTrackable<LLViewerOctreeEntry, 16>
 {
 	friend class LLViewerOctreeEntryData;
 
@@ -90,7 +90,7 @@ public:
 	LLViewerOctreeEntry();
 	
 	void nullGroup(); //called by group handleDestruction() only
-	void setGroup(LLviewerOctreeGroup* group);
+	void setGroup(LLViewerOctreeGroup* group);
 	void removeData(LLViewerOctreeEntryData* data);
 
 	LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];}
@@ -100,28 +100,18 @@ public:
 
 	const LLVector4a* getSpatialExtents() const {return mExtents;} 
 	const LLVector4a& getPositionGroup() const  {return mPositionGroup;}	
-	LLviewerOctreeGroup* getGroup()const        {return mGroup;}
+	LLViewerOctreeGroup* getGroup()const        {return mGroup;}
 	
 	F32  getBinRadius() const                   {return mBinRadius;}
 	S32	 getBinIndex() const			        {return mBinIndex; }
 	void setBinIndex(S32 index) const	        {mBinIndex = index; }
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 private:
 	void addData(LLViewerOctreeEntryData* data);			
 
 private:
 	LLViewerOctreeEntryData*    mData[NUM_DATA_TYPE]; //do not use LLPointer here.
-	LLviewerOctreeGroup*        mGroup;
+	LLViewerOctreeGroup*        mGroup;
 
 	//aligned members
 	LL_ALIGN_16(LLVector4a		mExtents[2]);
@@ -153,7 +143,7 @@ public:
 
 	F32                  getBinRadius() const   {return mEntry->getBinRadius();}
 	const LLVector4a*    getSpatialExtents() const;
-	LLviewerOctreeGroup* getGroup()const;
+	LLViewerOctreeGroup* getGroup()const;
 	const LLVector4a&    getPositionGroup() const;
 	
 	void setBinRadius(F32 rad)  {mEntry->mBinRadius = rad;}
@@ -161,7 +151,7 @@ public:
 	void setSpatialExtents(const LLVector4a& min, const LLVector4a& max);
 	void setPositionGroup(const LLVector4a& pos);
 	
-	virtual void setGroup(LLviewerOctreeGroup* group);
+	virtual void setGroup(LLViewerOctreeGroup* group);
 	void         shift(const LLVector4a &shift_vector);
 
 	U32          getVisible() const {return mEntry ? mEntry->mVisible : 0;}
@@ -185,11 +175,12 @@ protected:
 
 //defines an octree group for an octree node, which contains multiple entries.
 //LL_ALIGN_PREFIX(16)
-class LLviewerOctreeGroup : public LLOctreeListener<LLViewerOctreeEntry>
+class LLViewerOctreeGroup
+:	public LLOctreeListener<LLViewerOctreeEntry>, public LLTrace::MemTrackable<LLViewerOctreeGroup, 16>
 {
 	friend class LLViewerOctreeCull;
 protected:
-	virtual ~LLviewerOctreeGroup();
+	virtual ~LLViewerOctreeGroup();
 
 public:	
 	enum
@@ -206,22 +197,13 @@ public:
 	typedef LLOctreeNode<LLViewerOctreeEntry>::element_iter element_iter;
 	typedef LLOctreeNode<LLViewerOctreeEntry>::element_list element_list;
 
-	LLviewerOctreeGroup(OctreeNode* node);
-	LLviewerOctreeGroup(const LLviewerOctreeGroup& rhs)
+	LLViewerOctreeGroup(OctreeNode* node);
+	LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs)
+	: LLTrace::MemTrackable<LLViewerOctreeGroup, 16>("LLViewerOctreeGroup")
 	{
 		*this = rhs;
 	}
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	bool removeFromGroup(LLViewerOctreeEntryData* data);
 	bool removeFromGroup(LLViewerOctreeEntry* entry);
 
@@ -250,7 +232,7 @@ public:
 	virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child);
 
 	OctreeNode*          getOctreeNode() {return mOctreeNode;}
-	LLviewerOctreeGroup* getParent();
+	LLViewerOctreeGroup* getParent();
 
 	const LLVector4a* getBounds() const        {return mBounds;}
 	const LLVector4a* getExtents() const       {return mExtents;}
@@ -285,7 +267,7 @@ public:
 
 //octree group which has capability to support occlusion culling
 //LL_ALIGN_PREFIX(16)
-class LLOcclusionCullingGroup : public LLviewerOctreeGroup
+class LLOcclusionCullingGroup : public LLViewerOctreeGroup
 {
 public:
 	typedef enum
@@ -310,7 +292,7 @@ protected:
 
 public:
 	LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part);
-	LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLviewerOctreeGroup(rhs)
+	LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs)
 	{
 		*this = rhs;
 	}	
@@ -379,35 +361,35 @@ public:
 	LLViewerOctreeCull(LLCamera* camera)
 		: mCamera(camera), mRes(0) { }
 
-	virtual bool earlyFail(LLviewerOctreeGroup* group);
+	virtual bool earlyFail(LLViewerOctreeGroup* group);
 	virtual void traverse(const OctreeNode* n);
 	
 	//agent space group cull
-	S32 AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group);	
-	S32 AABBSphereIntersectGroupExtents(const LLviewerOctreeGroup* group);
-	S32 AABBInFrustumGroupBounds(const LLviewerOctreeGroup* group);
+	S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);	
+	S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group);
+	S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group);
 
 	//agent space object set cull
-	S32 AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group);
-	S32 AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group);	
-	S32 AABBInFrustumObjectBounds(const LLviewerOctreeGroup* group);
+	S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
+	S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group);	
+	S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group);
 	
 	//local region space group cull
-	S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group);
-	S32 AABBInRegionFrustumGroupBounds(const LLviewerOctreeGroup* group);
-	S32 AABBRegionSphereIntersectGroupExtents(const LLviewerOctreeGroup* group, const LLVector3& shift);
+	S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
+	S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group);
+	S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
 
 	//local region space object set cull
-	S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group);
-	S32 AABBInRegionFrustumObjectBounds(const LLviewerOctreeGroup* group);
-	S32 AABBRegionSphereIntersectObjectExtents(const LLviewerOctreeGroup* group, const LLVector3& shift);	
+	S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
+	S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group);
+	S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);	
 	
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group) = 0;
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) = 0;
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0;
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0;
 
-	virtual bool checkObjects(const OctreeNode* branch, const LLviewerOctreeGroup* group);
-	virtual void preprocess(LLviewerOctreeGroup* group);
-	virtual void processGroup(LLviewerOctreeGroup* group);
+	virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group);
+	virtual void preprocess(LLViewerOctreeGroup* group);
+	virtual void processGroup(LLViewerOctreeGroup* group);
 	virtual void visit(const OctreeNode* branch);
 	
 protected:
@@ -419,7 +401,7 @@ protected:
 class LLViewerOctreeDebug : public OctreeTraveler
 {
 public:
-	virtual void processGroup(LLviewerOctreeGroup* group);
+	virtual void processGroup(LLViewerOctreeGroup* group);
 	virtual void visit(const OctreeNode* branch);
 
 public:
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 6e9f649d23..4b4de583d8 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -148,7 +148,7 @@ public:
 	LLVOCacheEntry::vocache_entry_map_t	  mCacheMap; //all cached entries
 	LLVOCacheEntry::vocache_entry_set_t   mActiveSet; //all active entries;
 	LLVOCacheEntry::vocache_entry_set_t   mWaitingSet; //entries waiting for LLDrawable to be generated.	
-	std::set< LLPointer<LLviewerOctreeGroup> >      mVisibleGroups; //visible groupa
+	std::set< LLPointer<LLViewerOctreeGroup> >      mVisibleGroups; //visible groupa
 	LLVOCachePartition*                   mVOCachePartition;
 	LLVOCacheEntry::vocache_entry_set_t   mVisibleEntries; //must-be-created visible entries wait for objects creation.	
 	LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation.
@@ -963,7 +963,7 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d
 	entry->setState(LLVOCacheEntry::INACTIVE);
 }
 
-bool LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group)
+bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group)
 {
 	if(mDead || group->isEmpty())
 	{
@@ -1110,17 +1110,17 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
 	}
 
 	//process visible groups
-	std::set< LLPointer<LLviewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
+	std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
 	for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
 	{
-		LLPointer<LLviewerOctreeGroup> group = *group_iter;
+		LLPointer<LLViewerOctreeGroup> group = *group_iter;
 		if(group->getNumRefs() < 3 || //group to be deleted
 			!group->getOctreeNode() || group->isEmpty()) //group empty
 		{
 			continue;
 		}
 
-		for (LLviewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+		for (LLViewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
 		{
 			if((*i)->hasVOCacheEntry())
 			{
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 79a992a4c1..4e2252b75b 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -68,7 +68,7 @@ class LLBBox;
 class LLSpatialGroup;
 class LLDrawable;
 class LLViewerRegionImpl;
-class LLviewerOctreeGroup;
+class LLViewerOctreeGroup;
 class LLVOCachePartition;
 
 class LLViewerRegion: public LLCapabilityProvider // implements this interface
@@ -230,7 +230,7 @@ public:
 	F32	getWidth() const						{ return mWidth; }
 
 	BOOL idleUpdate(F32 max_update_time);
-	bool addVisibleGroup(LLviewerOctreeGroup* group);
+	bool addVisibleGroup(LLViewerOctreeGroup* group);
 	void addVisibleCacheEntry(LLVOCacheEntry* entry);
 	void addActiveCacheEntry(LLVOCacheEntry* entry);
 	void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep);	
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index f300983f19..c81a9a0ad3 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -343,17 +343,17 @@ void update_statistics()
 	sample(LLStatViewer::DRAW_DISTANCE,   (F64)gSavedSettings.getF32("RenderFarClip"));
 	sample(LLStatViewer::CHAT_BUBBLES,    gSavedSettings.getBOOL("UseChatBubbles"));
 
-	typedef LLInstanceTracker<LLTrace::TraceType<LLTrace::TimeBlockAccumulator>, std::string> trace_type_t;
+	typedef LLInstanceTracker<LLTrace::StatType<LLTrace::TimeBlockAccumulator>, std::string> stat_type_t;
 
-	F64Seconds idle_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Idle"));
-	F64Seconds network_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Network"));
+	F64Seconds idle_secs = last_frame_recording.getSum(*stat_type_t::getInstance("Idle"));
+	F64Seconds network_secs = last_frame_recording.getSum(*stat_type_t::getInstance("Network"));
 
-	record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Frame")));
+	record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Frame")));
 	record(LLStatViewer::UPDATE_STACKTIME, idle_secs - network_secs);
 	record(LLStatViewer::NETWORK_STACKTIME, network_secs);
-	record(LLStatViewer::IMAGE_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Update Images")));
-	record(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Sort Draw State")));
-	record(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Render Geometry")));
+	record(LLStatViewer::IMAGE_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Update Images")));
+	record(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Sort Draw State")));
+	record(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Render Geometry")));
 		
 	LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
 	if (cdp)
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index b600d2a8f1..6800fe3785 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -97,12 +97,12 @@ public:
 public:
 	void* operator new(size_t size)
 	{
-		return ll_aligned_malloc_16(size);
+		return LLTrace::MemTrackable<LLViewerObject>::aligned_new<16>(size);
 	}
 
-	void operator delete(void* ptr)
+	void operator delete(void* ptr, size_t size)
 	{
-		ll_aligned_free_16(ptr);
+		LLTrace::MemTrackable<LLViewerObject>::aligned_delete<16>(ptr, size);
 	}
 
 	LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 9e9e2b61d7..c280988fd6 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -50,16 +50,6 @@ class LLVOAvatarSelf :
  **/
 
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 	virtual 				~LLVOAvatarSelf();
 	virtual void			markDead();
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index ada412be8c..3f01ffa3cd 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -495,7 +495,7 @@ void LLVOCacheGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* c
 
 	unbound();
 	
-	((LLviewerOctreeGroup*)child->getListener(0))->unbound();
+	((LLViewerOctreeGroup*)child->getListener(0))->unbound();
 }
 
 LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
@@ -542,7 +542,7 @@ public:
 		mUseObjectCacheOcclusion = use_object_cache_occlusion;
 	}
 
-	virtual bool earlyFail(LLviewerOctreeGroup* base_group)
+	virtual bool earlyFail(LLViewerOctreeGroup* base_group)
 	{
 		if( mUseObjectCacheOcclusion &&
 			base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
@@ -565,7 +565,7 @@ public:
 		return false;
 	}
 
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
 	{
 #if 1
 		S32 res = AABBInRegionFrustumGroupBounds(group);
@@ -579,7 +579,7 @@ public:
 		return res;
 	}
 
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
 	{
 #if 1
 		S32 res = AABBInRegionFrustumObjectBounds(group);
@@ -593,7 +593,7 @@ public:
 		return res;
 	}
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		if( !mUseObjectCacheOcclusion ||
 			!base_group->getOctreeNode()->getParent())
@@ -647,19 +647,19 @@ public:
 		mSphereRadius = back_sphere_radius;
 	}
 
-	virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
 	{			
 		const LLVector4a* exts = group->getExtents();
 		return backSphereCheck(exts[0], exts[1]);
 	}
 
-	virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
+	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
 	{
 		const LLVector4a* exts = group->getObjectExtents();
 		return backSphereCheck(exts[0], exts[1]);
 	}
 
-	virtual void processGroup(LLviewerOctreeGroup* base_group)
+	virtual void processGroup(LLViewerOctreeGroup* base_group)
 	{
 		mRegionp->addVisibleGroup(base_group);
 		return;
@@ -721,7 +721,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
 		return 0;
 	}
 
-	((LLviewerOctreeGroup*)mOctree->getListener(0))->rebound();
+	((LLViewerOctreeGroup*)mOctree->getListener(0))->rebound();
 
 	if(LLViewerCamera::sCurCameraID >= LLViewerCamera::CAMERA_WATER0)
 	{
@@ -779,7 +779,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
 	return 1;
 }
 
-void LLVOCachePartition::addOccluders(LLviewerOctreeGroup* gp)
+void LLVOCachePartition::addOccluders(LLViewerOctreeGroup* gp)
 {
 	LLVOCacheGroup* group = (LLVOCacheGroup*)gp;
 
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index b58bb3d499..eef364dd5d 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -180,7 +180,7 @@ public:
 	void addEntry(LLViewerOctreeEntry* entry);
 	void removeEntry(LLViewerOctreeEntry* entry);
 	/*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion);
-	void addOccluders(LLviewerOctreeGroup* gp);
+	void addOccluders(LLViewerOctreeGroup* gp);
 	void resetOccluders();
 	void processOccluders(LLCamera* camera);
 	void removeOccluder(LLVOCacheGroup* group);
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index b2399123be..6c776907f5 100755
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -125,12 +125,27 @@
 				 <stat_bar name="LLViewerObject"
                     label="Viewer Objects"
                     stat="LLViewerObject"/>
-					<stat_bar name="LLVOCacheEntry"
+				 <stat_bar name="LLViewerOctreeGroup"
+									 label="Octree Group Data"
+									 stat="LLViewerOctreeGroup"/>
+				 <stat_bar name="LLViewerOctreeEntry"
+									 label="Octree Data"
+									 stat="LLViewerOctreeEntry"/>
+				 <stat_bar name="LLVOCacheEntry"
                     label="Viewer Object Cache"
                     stat="LLVOCacheEntry"/>
 				 <stat_bar name="LLDrawable"
                     label="Drawables"
                     stat="LLDrawable"/>
+         <stat_bar name="LLFace"
+                     label="Face Data"
+                     stat="LLFace"/>
+          <stat_bar name="LLDrawInfo"
+                     label="Draw Info"
+                     stat="LLDrawInfo"/>
+          <stat_bar name="LLTexture"
+                     label="Texture Data"
+                     stat="LLTexture"/>
 				 <stat_bar name="LLImage"
                     label="Image Data"
                     stat="LLImage"/>
-- 
cgit v1.2.3