diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index c6b02df939d8b8e873545824f54b0ed061430d5f..3fe7470d06427ff66044eb78b719bafd984d8662 100755
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -27,9 +27,7 @@
 #include "linden_common.h"
 
 
-//#if MEM_TRACK_MEM
 #include "llthread.h"
-//#endif
 
 #if defined(LL_WINDOWS)
 # include <psapi.h>
@@ -421,141 +419,6 @@ U32 LLMemory::getWorkingSetSize()
 
 #endif
 
-//--------------------------------------------------------------------------------------------------
-#if MEM_TRACK_MEM
-#include "llframetimer.h"
-
-//static 
-LLMemTracker* LLMemTracker::sInstance = NULL ;
-
-LLMemTracker::LLMemTracker()
-{
-	mLastAllocatedMem = LLMemory::getWorkingSetSize() ;
-	mCapacity = 128 ;	
-	mCurIndex = 0 ;
-	mCounter = 0 ;
-	mDrawnIndex = 0 ;
-	mPaused = FALSE ;
-
-	mMutexp = new LLMutex() ;
-	mStringBuffer = new char*[128] ;
-	mStringBuffer[0] = new char[mCapacity * 128] ;
-	for(S32 i = 1 ; i < mCapacity ; i++)
-	{
-		mStringBuffer[i] = mStringBuffer[i-1] + 128 ;
-	}
-}
-
-LLMemTracker::~LLMemTracker()
-{
-	delete[] mStringBuffer[0] ;
-	delete[] mStringBuffer;
-	delete mMutexp ;
-}
-
-//static 
-LLMemTracker* LLMemTracker::getInstance()
-{
-	if(!sInstance)
-	{
-		sInstance = new LLMemTracker() ;
-	}
-	return sInstance ;
-}
-
-//static 
-void LLMemTracker::release() 
-{
-	if(sInstance)
-	{
-		delete sInstance ;
-		sInstance = NULL ;
-	}
-}
-
-//static
-void LLMemTracker::track(const char* function, const int line)
-{
-	static const S32 MIN_ALLOCATION = 0 ; //1KB
-
-	if(mPaused)
-	{
-		return ;
-	}
-
-	U32 allocated_mem = LLMemory::getWorkingSetSize() ;
-
-	LLMutexLock lock(mMutexp) ;
-
-	S32 delta_mem = allocated_mem - mLastAllocatedMem ;
-	mLastAllocatedMem = allocated_mem ;
-
-	if(delta_mem <= 0)
-	{
-		return ; //occupied memory does not grow
-	}
-
-	if(delta_mem < MIN_ALLOCATION)
-	{
-		return ;
-	}
-		
-	char* buffer = mStringBuffer[mCurIndex++] ;
-	F32 time = (F32)LLFrameTimer::getElapsedSeconds() ;
-	S32 hours = (S32)(time / (60*60));
-	S32 mins = (S32)((time - hours*(60*60)) / 60);
-	S32 secs = (S32)((time - hours*(60*60) - mins*60));
-	strcpy(buffer, function) ;
-	sprintf(buffer + strlen(function), " line: %d DeltaMem: %d (bytes) Time: %d:%02d:%02d", line, delta_mem, hours,mins,secs) ;
-
-	if(mCounter < mCapacity)
-	{
-		mCounter++ ;
-	}
-	if(mCurIndex >= mCapacity)
-	{
-		mCurIndex = 0 ;		
-	}
-}
-
-
-//static 
-void LLMemTracker::preDraw(BOOL pause) 
-{
-	mMutexp->lock() ;
-
-	mPaused = pause ;
-	mDrawnIndex = mCurIndex - 1;
-	mNumOfDrawn = 0 ;
-}
-	
-//static 
-void LLMemTracker::postDraw() 
-{
-	mMutexp->unlock() ;
-}
-
-//static 
-const char* LLMemTracker::getNextLine() 
-{
-	if(mNumOfDrawn >= mCounter)
-	{
-		return NULL ;
-	}
-	mNumOfDrawn++;
-
-	if(mDrawnIndex < 0)
-	{
-		mDrawnIndex = mCapacity - 1 ;
-	}
-
-	return mStringBuffer[mDrawnIndex--] ;
-}
-
-#endif //MEM_TRACK_MEM
-//--------------------------------------------------------------------------------------------------
-
-
 //--------------------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------------------
 //minimum slot size and minimal slot size interval
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 95500753e46cc140ce20d7a72a1700d15db29072..a24d97576fb0c4f62c7b77e69765a721e88b1b8a 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -184,51 +184,6 @@ class LL_COMMON_API LLMemory
 	static BOOL sEnableMemoryFailurePrevention;
 };
 
-//----------------------------------------------------------------------------
-#if MEM_TRACK_MEM
-class LLMutex ;
-class LL_COMMON_API LLMemTracker
-{
-private:
-	LLMemTracker() ;
-	~LLMemTracker() ;
-
-public:
-	static void release() ;
-	static LLMemTracker* getInstance() ;
-
-	void track(const char* function, const int line) ;
-	void preDraw(BOOL pause) ;
-	void postDraw() ;
-	const char* getNextLine() ;
-
-private:
-	static LLMemTracker* sInstance ;
-	
-	char**     mStringBuffer ;
-	S32        mCapacity ;
-	U32        mLastAllocatedMem ;
-	S32        mCurIndex ;
-	S32        mCounter;
-	S32        mDrawnIndex;
-	S32        mNumOfDrawn;
-	BOOL       mPaused;
-	LLMutex*   mMutexp ;
-};
-
-#define MEM_TRACK_RELEASE LLMemTracker::release() ;
-#define MEM_TRACK         LLMemTracker::getInstance()->track(__FUNCTION__, __LINE__) ;
-
-#else // MEM_TRACK_MEM
-
-#define MEM_TRACK_RELEASE
-#define MEM_TRACK
-
-#endif // MEM_TRACK_MEM
-
-//----------------------------------------------------------------------------
-
-
 //
 //class LLPrivateMemoryPool defines a private memory pool for an application to use, so the application does not
 //need to access the heap directly fro each memory allocation. Throught this, the allocation speed is faster, 
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 166a4eb26d2bd5d80f09f99e0d6060f85f27405f..e0f53fb9c42b4aa9a5dc65a453cac09c030c83b3 100755
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -39,6 +39,39 @@
 #include <sched.h>
 #endif
 
+
+#ifdef LL_WINDOWS
+const DWORD MS_VC_EXCEPTION=0x406D1388;
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+	DWORD dwType; // Must be 0x1000.
+	const char* szName; // Pointer to name (in user addr space).
+	DWORD dwThreadID; // Thread ID (-1=caller thread).
+	DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+void SetThreadName( DWORD dwThreadID, const char* threadName)
+{
+	THREADNAME_INFO info;
+	info.dwType = 0x1000;
+	info.szName = threadName;
+	info.dwThreadID = dwThreadID;
+	info.dwFlags = 0;
+
+	__try
+	{
+		RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (DWORD*)&info );
+	}
+	__except(EXCEPTION_CONTINUE_EXECUTION)
+	{
+	}
+}
+#endif
+
+
 //----------------------------------------------------------------------------
 // Usage:
 // void run_func(LLThread* thread)
@@ -93,6 +126,11 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
 {
 	LLThread *threadp = (LLThread *)datap;
 
+#ifdef LL_WINDOWS
+	SetThreadName(-1, threadp->mName.c_str());
+#endif
+
+
 	LLTrace::ThreadRecorder thread_recorder(*LLTrace::get_master_thread_recorder());
 
 #if !LL_DARWIN
@@ -224,6 +262,7 @@ void LLThread::start()
 		llwarns << "failed to start thread " << mName << llendl;
 		ll_apr_warn_status(status);
 	}
+
 }
 
 //============================================================================
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 2c45923aac7edf824125320a3e7a653ff76f03eb..2c84b1596acf06df2d174b93b5894bbd4ab053ff 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -61,6 +61,7 @@ class TraceBase
 	virtual const char* getUnitLabel();
 
 	const std::string& getName() const { return mName; }
+	const std::string& getDescription() const { return mDescription; }
 
 protected:
 	const std::string	mName;
@@ -169,7 +170,7 @@ class CountStatHandle
 	typedef TraceType<CountAccumulator> trace_t;
 
 	CountStatHandle(const char* name, const char* description = NULL) 
-	:	trace_t(name)
+	:	trace_t(name, description)
 	{}
 
 	/*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); }
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index fac6347ff91e32eb7754680e5c1f5ccd73271de2..a2f9f4c0906d073f624fbe97f728d6e84a19afc5 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -37,7 +37,6 @@
 
 namespace LLTrace
 {
-
 	template<typename ACCUMULATOR>
 	class AccumulatorBuffer : public LLRefCount
 	{
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index f1388e7935536c93e0af0629a92d59dbacdca198..875c3710687041cf8b49487b02ce7db08a2c3161 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -38,10 +38,13 @@ namespace LLTrace
 // Recording
 ///////////////////////////////////////////////////////////////////////
 
-Recording::Recording() 
-:	mElapsedSeconds(0)
+Recording::Recording(EPlayState state) 
+:	mElapsedSeconds(0),
+	mInHandOff(false)
+
 {
 	mBuffers = new AccumulatorBufferGroup();
+	setPlayState(state);
 }
 
 Recording::Recording( const Recording& other )
@@ -101,7 +104,8 @@ void Recording::handleStart()
 {
 	mSamplingTimer.reset();
 	mBuffers.setStayUnique(true);
-	LLTrace::get_thread_recorder()->activate(mBuffers.write());
+	LLTrace::get_thread_recorder()->activate(mBuffers.write(), mInHandOff);
+	mInHandOff = false;
 }
 
 void Recording::handleStop()
@@ -113,6 +117,7 @@ void Recording::handleStop()
 
 void Recording::handleSplitTo(Recording& other)
 {
+	other.mInHandOff = true;
 	mBuffers.write()->handOffTo(*other.mBuffers.write());
 }
 
@@ -485,6 +490,8 @@ void PeriodicRecording::handleStop()
 
 void PeriodicRecording::handleReset()
 {
+	getCurRecording().stop();
+
 	if (mAutoResize)
 	{
 		mRecordingPeriods.clear();
@@ -500,6 +507,7 @@ void PeriodicRecording::handleReset()
 		}
 	}
 	mCurPeriod = 0;
+	mNumPeriods = 0;
 	getCurRecording().setPlayState(getPlayState());
 }
 
@@ -719,7 +727,6 @@ void LLStopWatchControlsMixinCommon::start()
 		handleStart();
 		break;
 	case STARTED:
-		handleReset();
 		break;
 	default:
 		llassert(false);
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 7b0970ffdf597aecb873ddc0349f2f63d6286f28..31616a52cce9103d709c8739a84fb9d853ab823a 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -124,11 +124,32 @@ namespace LLTrace
 	template<typename T>
 	class EventStatHandle;
 
+	template<typename T>
+	struct RelatedTypes
+	{
+		typedef F64 fractional_t;
+		typedef T	sum_t;
+	};
+
+	template<typename T, typename UNIT_T>
+	struct RelatedTypes<LLUnit<T, UNIT_T> >
+	{
+		typedef LLUnit<typename RelatedTypes<T>::fractional_t, UNIT_T> fractional_t;
+		typedef LLUnit<typename RelatedTypes<T>::sum_t, UNIT_T> sum_t;
+	};
+
+	template<>
+	struct RelatedTypes<bool>
+	{
+		typedef F64 fractional_t;
+		typedef U32 sum_t;
+	};
+
 	class Recording 
 	:	public LLStopWatchControlsMixin<Recording>
 	{
 	public:
-		Recording();
+		Recording(EPlayState state = LLStopWatchControlsMixinCommon::STOPPED);
 
 		Recording(const Recording& other);
 		~Recording();
@@ -172,16 +193,16 @@ namespace LLTrace
 		// CountStatHandle accessors
 		F64 getSum(const TraceType<CountAccumulator>& stat);
 		template <typename T>
-		T getSum(const CountStatHandle<T>& stat)
+		typename RelatedTypes<T>::sum_t getSum(const CountStatHandle<T>& stat)
 		{
-			return (T)getSum(static_cast<const TraceType<CountAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const TraceType<CountAccumulator>&> (stat));
 		}
 
 		F64 getPerSec(const TraceType<CountAccumulator>& stat);
 		template <typename T>
-		T getPerSec(const CountStatHandle<T>& stat)
+		typename RelatedTypes<T>::fractional_t getPerSec(const CountStatHandle<T>& stat)
 		{
-			return (T)getPerSec(static_cast<const TraceType<CountAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getPerSec(static_cast<const TraceType<CountAccumulator>&> (stat));
 		}
 
 		U32 getSampleCount(const TraceType<CountAccumulator>& stat);
@@ -197,9 +218,9 @@ namespace LLTrace
 
 		F64 getMean(const TraceType<SampleAccumulator>& stat);
 		template <typename T>
-		T getMean(SampleStatHandle<T>& stat)
+		typename RelatedTypes<T>::fractional_t getMean(SampleStatHandle<T>& stat)
 		{
-			return (T)getMean(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const TraceType<SampleAccumulator>&> (stat));
 		}
 
 		F64 getMax(const TraceType<SampleAccumulator>& stat);
@@ -211,9 +232,9 @@ namespace LLTrace
 
 		F64 getStandardDeviation(const TraceType<SampleAccumulator>& stat);
 		template <typename T>
-		T getStandardDeviation(const SampleStatHandle<T>& stat)
+		typename RelatedTypes<T>::fractional_t getStandardDeviation(const SampleStatHandle<T>& stat)
 		{
-			return (T)getStandardDeviation(static_cast<const TraceType<SampleAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const TraceType<SampleAccumulator>&> (stat));
 		}
 
 		F64 getLastValue(const TraceType<SampleAccumulator>& stat);
@@ -228,9 +249,9 @@ namespace LLTrace
 		// EventStatHandle accessors
 		F64 getSum(const TraceType<EventAccumulator>& stat);
 		template <typename T>
-		T getSum(const EventStatHandle<T>& stat)
+		typename RelatedTypes<T>::sum_t getSum(const EventStatHandle<T>& stat)
 		{
-			return (T)getSum(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const TraceType<EventAccumulator>&> (stat));
 		}
 
 		F64 getMin(const TraceType<EventAccumulator>& stat);
@@ -249,16 +270,16 @@ namespace LLTrace
 
 		F64 getMean(const TraceType<EventAccumulator>& stat);
 		template <typename T>
-		T getMean(EventStatHandle<T>& stat)
+		typename RelatedTypes<T>::fractional_t getMean(EventStatHandle<T>& stat)
 		{
-			return (T)getMean(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const TraceType<EventAccumulator>&> (stat));
 		}
 
 		F64 getStandardDeviation(const TraceType<EventAccumulator>& stat);
 		template <typename T>
-		T getStandardDeviation(const EventStatHandle<T>& stat)
+		typename RelatedTypes<T>::fractional_t getStandardDeviation(const EventStatHandle<T>& stat)
 		{
-			return (T)getStandardDeviation(static_cast<const TraceType<EventAccumulator>&> (stat));
+			return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const TraceType<EventAccumulator>&> (stat));
 		}
 
 		F64 getLastValue(const TraceType<EventAccumulator>& stat);
@@ -284,9 +305,11 @@ namespace LLTrace
 		// returns data for current thread
 		class ThreadRecorder* getThreadRecorder(); 
 
-		LLTimer				mSamplingTimer;
-		LLUnit<F64, LLUnits::Seconds>			mElapsedSeconds;
+		LLTimer											mSamplingTimer;
+		LLUnit<F64, LLUnits::Seconds>					mElapsedSeconds;
 		LLCopyOnWritePointer<AccumulatorBufferGroup>	mBuffers;
+		bool											mInHandOff;
+
 	};
 
 	class LL_COMMON_API PeriodicRecording
@@ -310,11 +333,15 @@ namespace LLTrace
 		const Recording& getPrevRecording(U32 offset) const;
 		Recording snapshotCurRecording() const;
 
+		//
+		// PERIODIC MIN
+		//
+
 		// catch all for stats that have a defined sum
 		template <typename T>
 		typename T::value_t getPeriodMin(const TraceType<T>& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			typename T::value_t min_val = std::numeric_limits<typename T::value_t>::max();
@@ -326,6 +353,12 @@ namespace LLTrace
 			return min_val;
 		}
 
+		template<typename T>
+		T getPeriodMin(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return T(getPeriodMin(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+		}
+
 		F64 getPeriodMin(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
 		template<typename T>
 		T getPeriodMin(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
@@ -341,9 +374,9 @@ namespace LLTrace
 		}
 
 		template <typename T>
-		F64 getPeriodMinPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			F64 min_val = std::numeric_limits<F64>::max();
@@ -352,14 +385,24 @@ namespace LLTrace
 				S32 index = (mCurPeriod + total_periods - i) % total_periods;
 				min_val = llmin(min_val, mRecordingPeriods[index].getPerSec(stat));
 			}
-			return min_val;
+			return (typename RelatedTypes<typename T::value_t>::fractional_t) min_val;
+		}
+
+		template<typename T>
+		typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
 		}
 
+		//
+		// PERIODIC MAX
+		//
+
 		// catch all for stats that have a defined sum
 		template <typename T>
 		typename T::value_t getPeriodMax(const TraceType<T>& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			typename T::value_t max_val = std::numeric_limits<typename T::value_t>::min();
@@ -371,6 +414,12 @@ namespace LLTrace
 			return max_val;
 		}
 
+		template<typename T>
+		T getPeriodMax(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return T(getPeriodMax(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+		}
+
 		F64 getPeriodMax(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
 		template<typename T>
 		T getPeriodMax(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
@@ -386,9 +435,9 @@ namespace LLTrace
 		}
 
 		template <typename T>
-		F64 getPeriodMaxPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
+		typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			F64 max_val = std::numeric_limits<F64>::min();
@@ -397,14 +446,24 @@ namespace LLTrace
 				S32 index = (mCurPeriod + total_periods - i) % total_periods;
 				max_val = llmax(max_val, mRecordingPeriods[index].getPerSec(stat));
 			}
-			return max_val;
+			return (typename RelatedTypes<typename T::value_t>::fractional_t)max_val;
+		}
+
+		template<typename T>
+		typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
 		}
 
+		//
+		// PERIODIC MEAN
+		//
+
 		// catch all for stats that have a defined sum
 		template <typename T>
 		typename T::mean_t getPeriodMean(const TraceType<T >& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			typename T::mean_t mean = 0;
@@ -422,24 +481,29 @@ namespace LLTrace
 			return mean;
 		}
 
+		template<typename T>
+		typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
+		}
 		F64 getPeriodMean(const TraceType<SampleAccumulator>& stat, size_t num_periods = U32_MAX);
 		template<typename T> 
-		T getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = U32_MAX)
 		{
-			return T(getPeriodMean(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<SampleAccumulator>&>(stat), num_periods));
 		}
 
 		F64 getPeriodMean(const TraceType<EventAccumulator>& stat, size_t num_periods = U32_MAX);
 		template<typename T>
-		T getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = U32_MAX)
 		{
-			return T(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
+			return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods));
 		}
 
 		template <typename T>
-		typename T::mean_t getPeriodMeanPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
+		typename RelatedTypes<typename T::mean_t>::fractional_t getPeriodMeanPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX)
 		{
-			size_t total_periods = mRecordingPeriods.size();
+			size_t total_periods = mNumPeriods;
 			num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
 
 			typename T::mean_t mean = 0;
@@ -454,7 +518,13 @@ namespace LLTrace
 				}
 			}
 			mean = mean / num_periods;
-			return mean;
+			return (typename RelatedTypes<typename T::mean_t>::fractional_t)mean;
+		}
+
+		template<typename T>
+		typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, size_t num_periods = U32_MAX)
+		{
+			return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const TraceType<CountAccumulator>&>(stat), num_periods));
 		}
 
 	private:
@@ -504,11 +574,10 @@ namespace LLTrace
 		ExtendablePeriodicRecording();
 		void extend();
 
-		PeriodicRecording& getAcceptedRecording()				{ return mAcceptedRecording; }
-		const PeriodicRecording& getAcceptedRecording() const	{return mAcceptedRecording;}
+		PeriodicRecording& getResults()				{ return mAcceptedRecording; }
+		const PeriodicRecording& getResults() const	{return mAcceptedRecording;}
 		
-		PeriodicRecording& getPotentialRecording()				{ return mPotentialRecording; }
-		const PeriodicRecording& getPotentialRecording() const	{return mPotentialRecording;}
+		void nextPeriod() { mPotentialRecording.nextPeriod(); }
 
 	private:
 		// implementation for LLStopWatchControlsMixin
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 7ac0e7515464013a15bff78730379f79934366f0..e20d8b63de9f9c9980793e9c5bd9ce53217bc8de 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -120,13 +120,17 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index )
 }
 
 
-void ThreadRecorder::activate( AccumulatorBufferGroup* recording )
+void ThreadRecorder::activate( AccumulatorBufferGroup* recording, bool from_handoff )
 {
 	ActiveRecording* active_recording = new ActiveRecording(recording);
 	if (!mActiveRecordings.empty())
 	{
 		AccumulatorBufferGroup& prev_active_recording = mActiveRecordings.back()->mPartialRecording;
 		prev_active_recording.sync();
+		if (!from_handoff)
+		{
+			TimeBlock::updateTimes();
+		}
 		prev_active_recording.handOffTo(active_recording->mPartialRecording);
 	}
 	mActiveRecordings.push_back(active_recording);
@@ -240,6 +244,7 @@ void ThreadRecorder::pushToParent()
 	{ LLMutexLock lock(&mSharedRecordingMutex);	
 		LLTrace::get_thread_recorder()->bringUpToDate(&mThreadRecordingBuffers);
 		mSharedRecordingBuffers.append(mThreadRecordingBuffers);
+		mThreadRecordingBuffers.reset();
 	}
 }
 	
diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h
index 535f8552008536f65f0346aa90ecbd3456d3983a..c40228785e0c3b7794f5f1068c656a3acd9538e0 100644
--- a/indra/llcommon/lltracethreadrecorder.h
+++ b/indra/llcommon/lltracethreadrecorder.h
@@ -47,7 +47,7 @@ namespace LLTrace
 
 		~ThreadRecorder();
 
-		void activate(AccumulatorBufferGroup* recording);
+		void activate(AccumulatorBufferGroup* recording, bool from_handoff = false);
 		void deactivate(AccumulatorBufferGroup* recording);
 		active_recording_list_t::reverse_iterator bringUpToDate(AccumulatorBufferGroup* recording);
 
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index c9bbed5574d889746b63c96c68bbdba7f745a668..79465715cfbc353e53b29cb4910f76620a2bed76 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -571,6 +571,11 @@ LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, * 1000);
 LL_DECLARE_BASE_UNIT(Radians, "rad");
 LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 0.01745329251994);
 
+LL_DECLARE_BASE_UNIT(Percent, "%");
+LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100);
+
+LL_DECLARE_BASE_UNIT(Triangles, "tris");
+LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, * 1000);
 
 } // namespace LLUnits
 
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index b93f89d674fce1c4a916d36ff199842e0256ce0f..cad2461e9ca3bd7544a0f3b6dfa190a06dd231ee 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -75,6 +75,8 @@ const F32	OO_SQRT2	= 0.7071067811865475244008443621049f;
 const F32	DEG_TO_RAD	= 0.017453292519943295769236907684886f;
 const F32	RAD_TO_DEG	= 57.295779513082320876798154814105f;
 const F32	F_APPROXIMATELY_ZERO = 0.00001f;
+const F32	F_LN10		= 2.3025850929940456840179914546844f;
+const F32	OO_LN10		= 0.43429448190325182765112891891661;
 const F32	F_LN2		= 0.69314718056f;
 const F32	OO_LN2		= 1.4426950408889634073599246810019f;
 
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index 1722b48f4407eb0dc5b69e5769882933e1e1c333..f7f81e74bdafaaf3114a43baaca15ed23a940f84 100755
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -34,7 +34,7 @@
 #include "llthread.h"
 #include <iterator>
 
-#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked());
+#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED() llassert(!mMutexp || mMutexp->isSelfLocked())
 
 /** 
  * LLSegment
@@ -287,7 +287,7 @@ LLChannelDescriptors LLBufferArray::nextChannel()
 //mMutexp should be locked before calling this.
 S32 LLBufferArray::capacity() const
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 
 	S32 total = 0;
 	const_buffer_iterator_t iter = mBuffers.begin();
@@ -315,7 +315,7 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
 //mMutexp should be locked before calling this.
 bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 
 	std::vector<LLSegment> segments;
 	if(copyIntoBuffers(channel, src, len, segments))
@@ -350,7 +350,7 @@ bool LLBufferArray::insertAfter(
 //mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 
 	segment_iterator_t end = mSegments.end();
 	segment_iterator_t it = getSegment(address);
@@ -382,14 +382,14 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
 //mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::beginSegment()
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	return mSegments.begin();
 }
 
 //mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::endSegment()
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	return mSegments.end();
 }
 
@@ -398,7 +398,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
 	U8* address,
 	LLSegment& segment)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	segment_iterator_t rv = mSegments.begin();
 	segment_iterator_t end = mSegments.end();
 	if(!address)
@@ -447,7 +447,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
 //mMutexp should be locked before calling this.
 LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	segment_iterator_t end = mSegments.end();
 	if(!address)
 	{
@@ -469,7 +469,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
 LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment(
 	U8* address) const
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	const_segment_iterator_t end = mSegments.end();
 	if(!address)
 	{
@@ -624,7 +624,7 @@ U8* LLBufferArray::seek(
 	U8* start,
 	S32 delta) const
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	const_segment_iterator_t it;
 	const_segment_iterator_t end = mSegments.end();
 	U8* rv = start;
@@ -792,7 +792,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
 	S32 channel,
 	S32 len)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	// start at the end of the buffers, because it is the most likely
 	// to have free space.
 	LLSegment segment;
@@ -830,7 +830,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
 //mMutexp should be locked before calling this.
 bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 
 	// Find out which buffer contains the segment, and if it is found,
 	// ask it to reclaim the memory.
@@ -862,7 +862,7 @@ bool LLBufferArray::copyIntoBuffers(
 	S32 len,
 	std::vector<LLSegment>& segments)
 {
-	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+	ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
 	if(!src || !len) return false;
 	S32 copied = 0;
 	LLSegment segment;
diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp
index 06f8e72c9cce15024ccebf55157442a930199049..6b1e3ce66951b5056f17dc31da053bb581cc741b 100755
--- a/indra/llui/llcontainerview.cpp
+++ b/indra/llui/llcontainerview.cpp
@@ -167,7 +167,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent)
 	//LLView *childp;
 
 	// These will be used for the children
-	left = 4;
+	left = 10;
 	top = getRect().getHeight() - 4;
 	right = width - 2;
 	bottom = top;
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index fd88565de47abee36d227c6eb6c9d4fabe91a311..a0a14f461036d8dcf3f9957e31d1c0a65496da06 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -37,32 +37,156 @@
 #include "lluictrlfactory.h"
 #include "lltracerecording.h"
 #include "llcriticaldamp.h"
+#include "lltooltip.h"
+#include "lllocalcliprect.h"
+#include <iostream>
+
+F32 calc_tick_value(F32 min, F32 max)
+{
+	F32 range = max - min;
+	const S32 DIVISORS[] = {6, 8, 10, 4, 5};
+	// try storing 
+	S32 best_decimal_digit_count = S32_MAX;
+	S32 best_divisor = 10;
+	for (U32 divisor_idx = 0; divisor_idx < LL_ARRAY_SIZE(DIVISORS); divisor_idx++)
+	{
+		S32 divisor = DIVISORS[divisor_idx];
+		F32 possible_tick_value = range / divisor;
+		S32 num_whole_digits = llceil(logf(min + possible_tick_value) * OO_LN10);
+		for (S32 digit_count = -(num_whole_digits - 1); digit_count < 6; digit_count++)
+		{
+			F32 test_tick_value = min + (possible_tick_value * pow(10.0, digit_count));
+
+			if (is_approx_equal((F32)(S32)test_tick_value, test_tick_value))
+			{
+				if (digit_count < best_decimal_digit_count)
+				{
+					best_decimal_digit_count = digit_count;
+					best_divisor = divisor;
+				}
+				break;
+			}
+		}
+	}
+
+	return is_approx_equal(range, 0.f) ? 0.f : range / best_divisor;
+}
+
+void calc_auto_scale_range(F32& min, F32& max, F32& tick)
+{
+	min = llmin(0.f, min, max);
+	max = llmax(0.f, min, max);
+
+	const F32 RANGES[] = {0.f, 1.f,   1.5f, 2.f, 3.f, 5.f, 10.f};
+	const F32 TICKS[]  = {0.f, 0.25f, 0.5f, 1.f, 1.f, 1.f, 2.f };
+
+	const S32 num_digits_max = is_approx_equal(fabs(max), 0.f)
+							? S32_MIN + 1
+							: llceil(logf(fabs(max)) * OO_LN10);
+	const S32 num_digits_min = is_approx_equal(fabs(min), 0.f)
+							? S32_MIN + 1
+							: llceil(logf(fabs(min)) * OO_LN10);
+
+	const S32 num_digits = llmax(num_digits_max, num_digits_min);
+	const F32 power_of_10 = pow(10.0, num_digits - 1);
+	const F32 starting_max = power_of_10 * ((max < 0.f) ? -1 : 1);
+	const F32 starting_min = power_of_10 * ((min < 0.f) ? -1 : 1);
+
+	F32 cur_max = starting_max;
+	F32 cur_min = starting_min;
+	F32 out_max = max;
+	F32 out_min = min;
+
+	F32 cur_tick_min = 0.f;
+	F32 cur_tick_max = 0.f;
+
+	for (S32 range_idx = 0; range_idx < LL_ARRAY_SIZE(RANGES); range_idx++)
+	{
+		cur_max = starting_max * RANGES[range_idx];
+		cur_min = starting_min * RANGES[range_idx];
+
+		if (min > 0.f && cur_min <= min)
+		{
+			out_min = cur_min;
+			cur_tick_min = TICKS[range_idx];
+		}
+		if (max < 0.f && cur_max >= max)
+		{
+			out_max = cur_max;
+			cur_tick_max = TICKS[range_idx];
+		}
+	}
+
+	cur_max = starting_max;
+	cur_min = starting_min;
+	for (S32 range_idx = LL_ARRAY_SIZE(RANGES) - 1; range_idx >= 0; range_idx--)
+	{
+		cur_max = starting_max * RANGES[range_idx];
+		cur_min = starting_min * RANGES[range_idx];
+
+		if (min < 0.f && cur_min <= min)
+		{
+			out_min = cur_min;
+			cur_tick_min = TICKS[range_idx];
+		}
+		if (max > 0.f && cur_max >= max)
+		{
+			out_max = cur_max;
+			cur_tick_max = TICKS[range_idx];
+		}	
+	}
+
+	tick = power_of_10 * llmax(cur_tick_min, cur_tick_max);
+	min = out_min;
+	max = out_max;
+}
 
 ///////////////////////////////////////////////////////////////////////////////////
 
 LLStatBar::LLStatBar(const Params& p)
-	: LLView(p),
-	  mLabel(p.label),
-	  mUnitLabel(p.unit_label),
-	  mMinBar(p.bar_min),
-	  mMaxBar(p.bar_max),
-	  mCurMaxBar(p.bar_max),
-	  mTickSpacing(p.tick_spacing),
-	  mPrecision(p.precision),
-	  mUpdatesPerSec(p.update_rate),
-	  mUnitScale(p.unit_scale),
-	  mNumFrames(p.num_frames),
-	  mMaxHeight(p.max_height),
-	  mPerSec(p.show_per_sec),
-	  mDisplayBar(p.show_bar),
-	  mDisplayHistory(p.show_history),
-	  mDisplayMean(p.show_mean),
-	  mOrientation(p.orientation),
-	  mScaleRange(p.scale_range)
+:	LLView(p),
+	mLabel(p.label),
+	mUnitLabel(p.unit_label),
+	mMinBar(llmin(p.bar_min, p.bar_max)),
+	mMaxBar(llmax(p.bar_max, p.bar_min)),
+	mCurMaxBar(p.bar_max),
+	mDecimalDigits(p.decimal_digits),
+	mNumFrames(p.num_frames),
+	mMaxHeight(p.max_height),
+	mPerSec(p.show_per_sec),
+	mDisplayBar(p.show_bar),
+	mDisplayHistory(p.show_history),
+	mOrientation(p.orientation),
+	mAutoScaleMax(!p.bar_max.isProvided()),
+	mAutoScaleMin(!p.bar_min.isProvided()),
+	mTickValue(p.tick_spacing)
 {
+	// tick value will be automatically calculated later
+	if (!p.tick_spacing.isProvided() && p.bar_min.isProvided() && p.bar_max.isProvided())
+	{
+		mTickValue = calc_tick_value(mMinBar, mMaxBar);
+	}
+
 	setStat(p.stat);
 }
 
+BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask)
+{
+	if (mCountFloatp)
+	{
+		LLToolTipMgr::instance().show(LLToolTip::Params().message(mCountFloatp->getDescription()).sticky_rect(calcScreenRect()));
+	}
+	else if ( mEventFloatp)
+	{
+		LLToolTipMgr::instance().show(LLToolTip::Params().message(mEventFloatp->getDescription()).sticky_rect(calcScreenRect()));
+	}
+	else if (mSampleFloatp)
+	{
+		LLToolTipMgr::instance().show(LLToolTip::Params().message(mSampleFloatp->getDescription()).sticky_rect(calcScreenRect()));
+	}
+	return TRUE;
+}
+
 BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
 {
 	BOOL handled = LLView::handleMouseDown(x, y, mask);
@@ -96,19 +220,22 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
 
 void LLStatBar::draw()
 {
-	F32 current = 0.f, 
-		min     = 0.f, 
-		max     = 0.f,
-		mean    = 0.f;
+	F32 current = 0, 
+		min     = 0, 
+		max     = 0,
+		mean    = 0;
 
+	LLLocalClipRect _(getLocalRect());
 	LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
 
+	std::string unit_label;
 	if (mCountFloatp)
 	{
 		LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); 
-
+		unit_label = mUnitLabel.empty() ? mCountFloatp->getUnitLabel() : mUnitLabel;
 		if (mPerSec)
 		{
+			unit_label += "/s";
 			current = last_frame_recording.getPerSec(*mCountFloatp);
 			min     = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
 			max     = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
@@ -125,6 +252,7 @@ void LLStatBar::draw()
 	else if (mEventFloatp)
 	{
 		LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
+		unit_label = mUnitLabel.empty() ? mEventFloatp->getUnitLabel() : mUnitLabel;
 
 		current = last_frame_recording.getMean(*mEventFloatp);
 		min     = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames);
@@ -134,31 +262,14 @@ void LLStatBar::draw()
 	else if (mSampleFloatp)
 	{
 		LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
+		unit_label = mUnitLabel.empty() ? mSampleFloatp->getUnitLabel() : mUnitLabel;
 
-		current = last_frame_recording.getLastValue(*mSampleFloatp);
+		current = last_frame_recording.getMean(*mSampleFloatp);
 		min     = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames);
 		max     = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames);
 		mean    = frame_recording.getPeriodMean(*mSampleFloatp, mNumFrames);
 	}
 
-	current *= mUnitScale;
-	min     *= mUnitScale;
-	max     *= mUnitScale;
-	mean    *= mUnitScale;
-
-	if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
-	{
-		if (mDisplayMean)
-		{
-			mValue = mean;
-		}
-		else
-		{
-			mValue = current;
-		}
-		mUpdateTimer.reset();
-	}
-
 	S32 bar_top, bar_left, bar_right, bar_bottom;
 	if (mOrientation == HORIZONTAL)
 	{
@@ -177,41 +288,50 @@ void LLStatBar::draw()
 	const S32 tick_length = 4;
 	const S32 tick_width = 1;
 
-	if (mScaleRange && min < max)
+	if ((mAutoScaleMax && max >= mCurMaxBar)|| (mAutoScaleMin && min <= mCurMinBar))
 	{
-		F32 cur_max = mTickSpacing;
-		while(max > cur_max && mMaxBar > cur_max)
+		F32 range_min = mAutoScaleMin ? llmin(mMinBar, min) : mMinBar;
+		F32 range_max = mAutoScaleMax ? llmax(mMaxBar, max) : mMaxBar;
+		F32 tick_value = 0.f;
+		calc_auto_scale_range(range_min, range_max, tick_value);
+		if (mAutoScaleMin) { mMinBar = range_min; }
+		if (mAutoScaleMax) { mMaxBar = range_max; }
+		if (mAutoScaleMin && mAutoScaleMax)
 		{
-			cur_max += mTickSpacing;
+			mTickValue = tick_value;
+		}
+		else
+		{
+			mTickValue = calc_tick_value(mMinBar, mMaxBar);
 		}
-		mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f);
+	}
+
+	mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, mMaxBar, 0.05f);
+	mCurMinBar = LLSmoothInterpolation::lerp(mCurMinBar, mMinBar, 0.05f);
+
+	F32 value_scale;
+	if (mCurMaxBar == mCurMinBar)
+	{
+		value_scale = 0.f;
 	}
 	else
 	{
-		mCurMaxBar = mMaxBar;
+		value_scale = (mOrientation == HORIZONTAL) 
+					? (bar_top - bar_bottom)/(mCurMaxBar - mCurMinBar)
+					: (bar_right - bar_left)/(mCurMaxBar - mCurMinBar);
 	}
 
-	F32 value_scale = (mOrientation == HORIZONTAL) 
-					? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar)
-					: (bar_right - bar_left)/(mCurMaxBar - mMinBar);
-
 	LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
 											 LLFontGL::LEFT, LLFontGL::TOP);
-
-	std::string value_format;
-	std::string value_str;
-	if (!mUnitLabel.empty())
-	{
-		value_format = llformat( "%%.%df%%s", mPrecision);
-		value_str = llformat( value_format.c_str(), mValue, mUnitLabel.c_str());
-	}
-	else
+	
+	S32 decimal_digits = mDecimalDigits;
+	if (is_approx_equal((F32)(S32)mean, mean))
 	{
-		value_format = llformat( "%%.%df", mPrecision);
-		value_str = llformat( value_format.c_str(), mValue);
+		decimal_digits = 0;
 	}
+	std::string value_str = llformat("%10.*f %s", decimal_digits, mean, unit_label.c_str());
 
-	// Draw the value.
+	// Draw the current value.
 	if (mOrientation == HORIZONTAL)
 	{
 		LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(), 
@@ -225,58 +345,73 @@ void LLStatBar::draw()
 			LLFontGL::RIGHT, LLFontGL::TOP);
 	}
 
-	value_format = llformat( "%%.%df", mPrecision);
 	if (mDisplayBar && (mCountFloatp || mEventFloatp || mSampleFloatp))
 	{
-		std::string tick_label;
-
 		// Draw the tick marks.
 		LLGLSUIDefault gls_ui;
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		S32 last_tick = 0;
 		S32 last_label = 0;
 		const S32 MIN_TICK_SPACING  = mOrientation == HORIZONTAL ? 20 : 30;
-		const S32 MIN_LABEL_SPACING = mOrientation == HORIZONTAL ? 40 : 60;
-		for (F32 tick_value = mMinBar + mTickSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
+		const S32 MIN_LABEL_SPACING = mOrientation == HORIZONTAL ? 30 : 60;
+		// start counting from actual min, not current, animating min, so that ticks don't float between numbers
+		// ensure ticks always hit 0
+		if (mTickValue > 0.f)
 		{
-			const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
-			const S32 end = begin + tick_width;
-			if (begin - last_tick < MIN_TICK_SPACING)
-			{
-				continue;
-			}
-			last_tick = begin;
-
-			tick_label = llformat( value_format.c_str(), tick_value);
-
-			if (mOrientation == HORIZONTAL)
+			F32 start = mCurMinBar < 0.f
+				? llceil(-mCurMinBar / mTickValue) * -mTickValue
+				: 0.f;
+			for (F32 tick_value = start; ;tick_value += mTickValue)
 			{
-				if (begin - last_label > MIN_LABEL_SPACING)
+				const S32 begin = llfloor((tick_value - mCurMinBar)*value_scale);
+				const S32 end = begin + tick_width;
+				if (begin - last_tick < MIN_TICK_SPACING)
 				{
-					gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
-					LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin,
-						LLColor4(1.f, 1.f, 1.f, 0.5f),
-						LLFontGL::LEFT, LLFontGL::VCENTER);
-					last_label = begin;
+					continue;
 				}
-				else
+				last_tick = begin;
+
+				S32 decimal_digits = mDecimalDigits;
+				if (is_approx_equal((F32)(S32)tick_value, tick_value))
 				{
-					gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f));
+					decimal_digits = 0;
 				}
-			}
-			else
-			{
-				if (begin - last_label > MIN_LABEL_SPACING)
+				std::string tick_string = llformat("%10.*f", decimal_digits, tick_value);
+
+				if (mOrientation == HORIZONTAL)
 				{
-					gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
-					LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length,
-						LLColor4(1.f, 1.f, 1.f, 0.5f),
-						LLFontGL::RIGHT, LLFontGL::TOP);
-					last_label = begin;
+					if (begin - last_label > MIN_LABEL_SPACING)
+					{
+						gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
+						LLFontGL::getFontMonospace()->renderUTF8(tick_string, 0, bar_right, begin,
+							LLColor4(1.f, 1.f, 1.f, 0.5f),
+							LLFontGL::LEFT, LLFontGL::VCENTER);
+						last_label = begin;
+					}
+					else
+					{
+						gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f));
+					}
 				}
 				else
 				{
-					gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length/2, LLColor4(1.f, 1.f, 1.f, 0.1f));
+					if (begin - last_label > MIN_LABEL_SPACING)
+					{
+						gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
+						LLFontGL::getFontMonospace()->renderUTF8(tick_string, 0, begin - 1, bar_bottom - tick_length,
+							LLColor4(1.f, 1.f, 1.f, 0.5f),
+							LLFontGL::RIGHT, LLFontGL::TOP);
+						last_label = begin;
+					}
+					else
+					{
+						gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length/2, LLColor4(1.f, 1.f, 1.f, 0.1f));
+					}
+				}
+				// always draw one tick value past end, so we can see part of the text, if possible
+				if (tick_value > mCurMaxBar)
+				{
+					break;
 				}
 			}
 		}
@@ -291,7 +426,7 @@ void LLStatBar::draw()
 		}
 
 		// draw min and max
-		S32 begin = (S32) ((min - mMinBar) * value_scale);
+		S32 begin = (S32) ((min - mCurMinBar) * value_scale);
 
 		if (begin < 0)
 		{
@@ -299,7 +434,7 @@ void LLStatBar::draw()
 			llwarns << "Min:" << min << llendl;
 		}
 
-		S32 end = (S32) ((max - mMinBar) * value_scale);
+		S32 end = (S32) ((max - mCurMinBar) * value_scale);
 		if (mOrientation == HORIZONTAL)
 		{
 			gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 0.25f));
@@ -316,8 +451,7 @@ void LLStatBar::draw()
 		if (mDisplayHistory && (mCountFloatp || mEventFloatp || mSampleFloatp))
 		{
 			const S32 num_values = frame_recording.getNumRecordedPeriods() - 1;
-			F32 begin = 0;
-			F32 end = 0;
+			F32 value = 0;
 			S32 i;
 			gGL.color4f( 1.f, 0.f, 0.f, 1.f );
 			gGL.begin( LLRender::QUADS );
@@ -327,74 +461,49 @@ void LLStatBar::draw()
 			{
 				F32 offset = ((F32)i / (F32)mNumFrames) * span;
 				LLTrace::Recording& recording = frame_recording.getPrevRecording(i);
-				if (mPerSec)
+
+				if (mCountFloatp)
 				{
-					if (mCountFloatp)
-					{
-						begin       = ((recording.getPerSec(*mCountFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getPerSec(*mCountFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mCountFloatp);
-					}
-					else if (mEventFloatp)
-					{
-						//rate isn't defined for measurement stats, so use mean
-						begin       = ((recording.getMean(*mEventFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getMean(*mEventFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mEventFloatp);
-					}
-					else if (mSampleFloatp)
-					{
-						//rate isn't defined for sample stats, so use mean
-						begin       = ((recording.getMean(*mSampleFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getMean(*mSampleFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mSampleFloatp);
-					}
+					value       = mPerSec 
+									? recording.getPerSec(*mCountFloatp) 
+									: recording.getSum(*mCountFloatp);
+					num_samples = recording.getSampleCount(*mCountFloatp);
 				}
-				else
+				else if (mEventFloatp)
 				{
-					if (mCountFloatp)
-					{
-						begin       = ((recording.getSum(*mCountFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getSum(*mCountFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mCountFloatp);
-					}
-					else if (mEventFloatp)
-					{
-						begin       = ((recording.getMean(*mEventFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getMean(*mEventFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mEventFloatp);
-					}
-					else if (mSampleFloatp)
-					{
-						begin       = ((recording.getMean(*mSampleFloatp)  - mMinBar) * value_scale);
-						end         = ((recording.getMean(*mSampleFloatp)  - mMinBar) * value_scale) + 1;
-						num_samples = recording.getSampleCount(*mSampleFloatp);
-					}
- 				}
+					value       = recording.getMean(*mEventFloatp);
+					num_samples = recording.getSampleCount(*mEventFloatp);
+				}
+				else if (mSampleFloatp)
+				{
+					value       = recording.getMean(*mSampleFloatp);
+					num_samples = recording.getSampleCount(*mSampleFloatp);
+				}
 				
 				if (!num_samples) continue;
 
+				F32 begin = (value  - mCurMinBar) * value_scale;
 				if (mOrientation == HORIZONTAL)
 				{
-					gGL.vertex2f((F32)bar_right - offset, end);
+					gGL.vertex2f((F32)bar_right - offset, begin + 1);
 					gGL.vertex2f((F32)bar_right - offset, begin);
-					gGL.vertex2f((F32)bar_right - offset - 1.f, begin);
-					gGL.vertex2f((F32)bar_right - offset - 1.f, end);
+					gGL.vertex2f((F32)bar_right - offset - 1, begin);
+					gGL.vertex2f((F32)bar_right - offset - 1, begin + 1);
 				}
 				else
 				{
-					gGL.vertex2f(begin, (F32)bar_bottom+offset+1.f);
-					gGL.vertex2f(begin, (F32)bar_bottom+offset);
-					gGL.vertex2f(end, (F32)bar_bottom+offset);
-					gGL.vertex2f(end, (F32)bar_bottom+offset+1.f);
+					gGL.vertex2f(begin, (F32)bar_bottom + offset + 1);
+					gGL.vertex2f(begin, (F32)bar_bottom + offset);
+					gGL.vertex2f(begin + 1, (F32)bar_bottom + offset);
+					gGL.vertex2f(begin + 1, (F32)bar_bottom + offset + 1 );
 				}
 			}
 			gGL.end();
 		}
 		else
 		{
-			S32 begin = (S32) ((current - mMinBar) * value_scale) - 1;
-			S32 end = (S32) ((current - mMinBar) * value_scale) + 1;
+			S32 begin = (S32) ((current - mCurMinBar) * value_scale) - 1;
+			S32 end = (S32) ((current - mCurMinBar) * value_scale) + 1;
 			// draw current
 			if (mOrientation == HORIZONTAL)
 			{
@@ -408,8 +517,8 @@ void LLStatBar::draw()
 
 		// draw mean bar
 		{
-			const S32 begin = (S32) ((mean - mMinBar) * value_scale) - 1;
-			const S32 end = (S32) ((mean - mMinBar) * value_scale) + 1;
+			const S32 begin = (S32) ((mean - mCurMinBar) * value_scale) - 1;
+			const S32 end = (S32) ((mean - mCurMinBar) * value_scale) + 1;
 			if (mOrientation == HORIZONTAL)
 			{
 				gl_rect_2d(bar_left - 2, begin, bar_right + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f));
@@ -432,11 +541,11 @@ void LLStatBar::setStat(const std::string& stat_name)
 }
 
 
-void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing)
+void LLStatBar::setRange(F32 bar_min, F32 bar_max)
 {
-	mMinBar			= bar_min;
-	mMaxBar			= bar_max;
-	mTickSpacing	= tick_spacing;
+	mMinBar		= llmin(bar_min, bar_max);
+	mMaxBar		= llmax(bar_min, bar_max);
+	mTickValue	= calc_tick_value(mMinBar, mMaxBar);
 }
 
 LLRect LLStatBar::getRequiredRect()
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index 3daec297bb52b06c784f3549b8a75ac9c46ca0f1..fc925b1a74a1e4c663573815b055e4f548507852 100755
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -42,16 +42,13 @@ class LLStatBar : public LLView
 
 		Optional<F32>			bar_min,
 								bar_max,
-								tick_spacing,
-								update_rate,
-								unit_scale;
+								tick_spacing;
 
-		Optional<U32>			precision;
+		Optional<U32>			decimal_digits;
 
 		Optional<bool>			show_per_sec,
 								show_bar,
 								show_history,
-								show_mean,
 								scale_range;
 
 		Optional<S32>			num_frames,
@@ -60,23 +57,20 @@ class LLStatBar : public LLView
 		Optional<EOrientation>	orientation;
 
 		Params()
-			: label("label"),
-			  unit_label("unit_label"),
-			  bar_min("bar_min", 0.0f),
-			  bar_max("bar_max", 50.0f),
-			  tick_spacing("tick_spacing", 10.0f),
-			  precision("precision", 0),
-			  update_rate("update_rate", 5.0f),
-			  unit_scale("unit_scale", 1.f),
-			  show_per_sec("show_per_sec", true),
-			  show_bar("show_bar", true),
-			  show_history("show_history", false),
-			  show_mean("show_mean", true),
-			  scale_range("scale_range", true),
-			  num_frames("num_frames", 300),
-			  max_height("max_height", 200),
-			  stat("stat"),
-			  orientation("orientation", VERTICAL)
+		:	label("label"),
+			unit_label("unit_label"),
+			bar_min("bar_min", 0.f),
+			bar_max("bar_max", 0.f),
+			tick_spacing("tick_spacing", 0.f),
+			decimal_digits("decimal_digits", 3),
+			show_per_sec("show_per_sec", true),
+			show_bar("show_bar", false),
+			show_history("show_history", false),
+			scale_range("scale_range", true),
+			num_frames("num_frames", 200),
+			max_height("max_height", 100),
+			stat("stat"),
+			orientation("orientation", VERTICAL)
 		{
 			changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
 		}
@@ -85,40 +79,38 @@ class LLStatBar : public LLView
 
 	virtual void draw();
 	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+	virtual BOOL handleHover(S32 x, S32 y, MASK mask);
 
 	void setStat(const std::string& stat_name);
 
-	void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing);
+	void setRange(F32 bar_min, F32 bar_max);
 	void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
 	
 	/*virtual*/ LLRect getRequiredRect();	// Return the height of this object, given the set options.
 
 private:
-	F32          mMinBar;
-	F32          mMaxBar;
-	F32			 mCurMaxBar;
-	F32          mTickSpacing;
-	F32          mLabelSpacing;
-	U32          mPrecision;
-	F32          mUpdatesPerSec;
-	F32          mUnitScale;
+	F32          mMinBar,
+				 mMaxBar,
+				 mCurMaxBar,
+				 mCurMinBar,
+				 mLabelSpacing;
+	F32			 mTickValue;
+	U32          mDecimalDigits;
 	S32			 mNumFrames;
 	S32			 mMaxHeight;
-	bool         mPerSec;				// Use the per sec stats.
-	bool         mDisplayBar;			// Display the bar graph.
-	bool         mDisplayHistory;
-	bool         mDisplayMean;			// If true, display mean, if false, display current value
-	bool		 mScaleRange;
+	bool         mPerSec,				// Use the per sec stats.
+				 mDisplayBar,			// Display the bar graph.
+				 mDisplayHistory,
+				 mAutoScaleMax,
+				 mAutoScaleMin;
 	EOrientation mOrientation;
 
-	LLTrace::TraceType<LLTrace::CountAccumulator>*			mCountFloatp;
-	LLTrace::TraceType<LLTrace::EventAccumulator>*			mEventFloatp;
-	LLTrace::TraceType<LLTrace::SampleAccumulator>*			mSampleFloatp;
+	LLTrace::TraceType<LLTrace::CountAccumulator>*		mCountFloatp;
+	LLTrace::TraceType<LLTrace::EventAccumulator>*		mEventFloatp;
+	LLTrace::TraceType<LLTrace::SampleAccumulator>*		mSampleFloatp;
 
-	LLFrameTimer mUpdateTimer;
 	LLUIString   mLabel;
 	std::string  mUnitLabel;
-	F32          mValue;
 };
 
 #endif
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index f52a3b332305c313686831d6fedb40413c20c13c..782d26fccb40f16925540086e4ece29ff2389d22 100755
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -476,6 +476,9 @@ void LLToolTipMgr::show(const std::string& msg)
 
 void LLToolTipMgr::show(const LLToolTip::Params& params)
 {
+	if (!params.styled_message.isProvided() 
+		&& (!params.message.isProvided() || params.message().empty())) return;
+
 	// fill in default tooltip params from tool_tip.xml
 	LLToolTip::Params params_with_defaults(params);
 	params_with_defaults.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLToolTip>());
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e77f793a4386223ff08d7e61da986a1ccfbe7e81..47492aaa3182873d72f8892e7d7c4d63382b9336 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1294,6 +1294,7 @@ bool LLAppViewer::mainLoop()
 	{
 		LLFastTimer _(FTM_FRAME);
 		LLTrace::TimeBlock::processTimes();
+		llassert(LLStatViewer::FPS.getPrimaryAccumulator()->getSampleCount() <= 1);
 		LLTrace::get_frame_recording().nextPeriod();
 		LLTrace::TimeBlock::logStats();
 
@@ -2070,8 +2071,6 @@ bool LLAppViewer::cleanup()
 
 	ll_close_fail_log();
 
-	MEM_TRACK_RELEASE
-
     llinfos << "Goodbye!" << llendflush;
 
 	// return 0;
@@ -2099,11 +2098,7 @@ void watchdog_killer_callback()
 
 bool LLAppViewer::initThreads()
 {
-#if MEM_TRACK_MEM
-	static const bool enable_threads = false;
-#else
 	static const bool enable_threads = true;
-#endif
 
 	LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
 
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index 1264f05d770090b252984bfc0f81c4cd3ddfeba4..63dd59b020ae6bf7fb983a44ea10f8ed17491c88 100755
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -55,7 +55,6 @@ static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
 LLDebugView::LLDebugView(const LLDebugView::Params& p)
 :	LLView(p),
 	mFastTimerView(NULL),
-	mMemoryView(NULL),
 	mDebugConsolep(NULL),
 	mFloaterSnapRegion(NULL)
 {}
diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h
index 5aec77ad6275fdff32f8406bf60b393b5ea9c159..a6490c876c03893c1a5a2c6486a594a98950dc38 100755
--- a/indra/newview/lldebugview.h
+++ b/indra/newview/lldebugview.h
@@ -36,7 +36,6 @@
 class LLButton;
 class LLStatusPanel;
 class LLFastTimerView;
-class LLMemoryView;
 class LLConsole;
 class LLTextureView;
 class LLFloaterStats;
@@ -61,7 +60,6 @@ class LLDebugView : public LLView
 	void setStatsVisible(BOOL visible);
 	
 	LLFastTimerView* mFastTimerView;
-	LLMemoryView*	 mMemoryView;
 	LLConsole*		 mDebugConsolep;
 	LLView*			 mFloaterSnapRegion;
 };
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index b71ab4c53bc73d3276f6c9fc71a3f94ec543d057..adcecbbb7a647a53141a37cacc09c7bee721ac7c 100755
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -85,7 +85,7 @@ void LLFloaterJoystick::draw()
 			if (llabs(value) > maxbar)
 			{
 				F32 range = llabs(value);
-				mAxisStatsBar[i]->setRange(-range, range, range * 0.25f);
+				mAxisStatsBar[i]->setRange(-range, range);
 			}
 		}
 	}
@@ -106,7 +106,7 @@ BOOL LLFloaterJoystick::postBuild()
 		if (mAxisStatsBar[i])
 		{
 			mAxisStatsBar[i]->setStat(stat_name);
-			mAxisStatsBar[i]->setRange(-range, range, range * 0.25f);
+			mAxisStatsBar[i]->setRange(-range, range);
 		}
 	}
 	
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 35b63c54803fde1765942cd98b507c7cf9962daa..b42118a0c17d187789154dd806f4ead02e285456 100755
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -784,7 +784,7 @@ void LLFloaterReporter::takeScreenshot()
 	image_in_list->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER);
 	
 	// the texture picker then uses that texture
-	LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot");
+	LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot");
 	if (texture)
 	{
 		texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid);
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 342b45863a4b0bdb40aba580d7294f757fe9a441..eec4a703a193e0cb4e00ed1bb2fff49c8bd7ab69 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -256,7 +256,7 @@ void LLSceneMonitor::unfreezeScene()
 
 void LLSceneMonitor::capture()
 {
-	static U32 last_capture_time = 0;
+	static U32 last_capture_frame = 0;
 	static LLCachedControl<bool> monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled");
 	static LLCachedControl<F32>  scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
 	static LLFrameTimer timer;	
@@ -268,11 +268,11 @@ void LLSceneMonitor::capture()
 		if(mEnabled)
 		{
 			unfreezeScene();
+			reset();
 			force_capture = true;
 		}
 		else
 		{
-			reset();
 			freezeScene();
 		}
 
@@ -280,8 +280,8 @@ void LLSceneMonitor::capture()
 	}
 
 	if (mEnabled 
-		&&	(mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f
-		|| mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f))
+		&& (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f
+			|| mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f))
 	{
 		reset();
 		freezeScene();
@@ -290,9 +290,10 @@ void LLSceneMonitor::capture()
 
 	if((timer.getElapsedTimeF32() > scene_load_sample_time() 
 			|| force_capture)
+		&& mDiffState == WAITING_FOR_NEXT_DIFF
 		&& mEnabled
 		&& LLGLSLShader::sNoFixedFunction
-		&& last_capture_time != gFrameCount)
+		&& last_capture_frame != gFrameCount)
 	{
 		force_capture = false;
 
@@ -301,7 +302,7 @@ void LLSceneMonitor::capture()
 
 		timer.reset();
 
-		last_capture_time = gFrameCount;
+		last_capture_frame = gFrameCount;
 
 		LLRenderTarget& cur_target = getCaptureTarget();
 
@@ -465,7 +466,11 @@ void LLSceneMonitor::fetchQueryResult()
 {
 	LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF);
 
-	if(mDiffState == WAIT_ON_RESULT)
+	// also throttle timing here, to avoid going below sample time due to phasing with frame capture
+	static LLCachedControl<F32>  scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
+	static LLFrameTimer timer;	
+
+	if(mDiffState == WAIT_ON_RESULT && timer.getElapsedTimeF32() > scene_load_sample_time)
 	{
 		mDiffState = WAITING_FOR_NEXT_DIFF;
 
@@ -479,7 +484,7 @@ void LLSceneMonitor::fetchQueryResult()
 			mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face)
 
 			LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL;
-			record(sFramePixelDiff, mDiffResult);
+			record(sFramePixelDiff, sqrtf(mDiffResult));
 
 			static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold");
 			if(mDiffResult > diff_threshold())
@@ -488,7 +493,7 @@ void LLSceneMonitor::fetchQueryResult()
 			}
 			else
 			{
-				mSceneLoadRecording.getPotentialRecording().nextPeriod();
+				mSceneLoadRecording.nextPeriod();
 			}
 		}
 	}
@@ -506,7 +511,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 
 	os << std::setprecision(10);
 
-	PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording();
+	PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults();
 	const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
 
 	LLUnit<F64, LLUnits::Seconds> frame_time;
@@ -519,6 +524,15 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
 	}
 	os << '\n';
 
+	os << "Sample period(s)";
+	for (S32 frame = 1; frame <= frame_count; frame++)
+	{
+		frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
+		os << ", " << frame_time.value();
+	}
+	os << '\n';
+
+
 	typedef TraceType<CountAccumulator> trace_count;
 	for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances();
 		it != end_it;
@@ -697,7 +711,7 @@ void LLSceneMonitorView::draw()
 	LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
 	lines++;
 
-	num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getAcceptedRecording().getDuration().value());
+	num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getResults().getDuration().value());
 	LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
 	lines++;
 
diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h
index 9717310da4d7677e564588076ec8925fbaa5c060..7088d529d6ec4d13e5ab3d9f5ff662244c8167e7 100644
--- a/indra/newview/llscenemonitor.h
+++ b/indra/newview/llscenemonitor.h
@@ -62,7 +62,7 @@ class LLSceneMonitor : public LLSingleton<LLSceneMonitor>
 	
 	const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;}
 	void dumpToFile(std::string file_name);
-	bool hasResults() const { return mSceneLoadRecording.getAcceptedRecording().getDuration() != 0;}
+	bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != 0;}
 
 private:
 	void freezeScene();
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index f3406d9f8da063ee75965dd43f02dc8992c1b641..b385d5cdfae25f45378e6fa53799a2b8987d59f2 100755
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -198,7 +198,7 @@ BOOL LLStatusBar::postBuild()
 	sgp.rect(r);
 	sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
 	sgp.mouse_opaque(false);
-	sgp.stat.count_stat_float(&LLStatViewer::KBIT);
+	sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED);
 	sgp.units("Kbps");
 	sgp.precision(0);
 	mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index ad79042ef161a86839c5ca83954f71b2301ea844..15ca7bed928ddb0b2e9fe4bf1de07468e783314b 100755
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -227,8 +227,4 @@ class LLTextureCtrl
 	S32						 	mLabelWidth;
 };
 
-// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp
-// and class to LLTexturePicker
-#define LLTexturePicker LLTextureCtrl
-
 #endif  // LL_LLTEXTURECTRL_H
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 0390649a1ce90baa84e461c3bacd6fd98acb375c..d85247c4ecce12d1f407374b9f3ea09703c8010d 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -64,9 +64,9 @@
 #include "bufferarray.h"
 #include "bufferstream.h"
 
-bool LLTextureFetchDebugger::sDebuggerEnabled = false ;
-LLTrace::SampleStatHandle<> LLTextureFetch::sCacheHitRate("texture_cache_hits");
-LLTrace::SampleStatHandle<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
+bool LLTextureFetchDebugger::sDebuggerEnabled = false;
+LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > LLTextureFetch::sCacheHitRate("texture_cache_hits");
+LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
 
 
 //////////////////////////////////////////////////////////////////////////////
@@ -1251,7 +1251,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			LL_DEBUGS("Texture") << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize()
 								 << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight())
 								 << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
-			sample(LLTextureFetch::sCacheHitRate, 100.f);
+			record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1));
 		}
 		else
 		{
@@ -1269,7 +1269,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			}
 			
 			// fall through
-			sample(LLTextureFetch::sCacheHitRate, 0.f);
+			record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0));
 		}
 	}
 
@@ -1483,7 +1483,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			mGetReason.clear();
 			LL_DEBUGS("Texture") << "HTTP GET: " << mID << " Offset: " << mRequestedOffset
 								 << " Bytes: " << mRequestedSize
-								 << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
+								 << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth().value() << "/" << mFetcher->mMaxBandwidth
 								 << LL_ENDL;
 
 			// Will call callbackHttpGet when curl request completes
@@ -2762,10 +2762,10 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
 			discard_level = worker->mDecodedDiscard;
 			raw = worker->mRawImage;
 			aux = worker->mAuxImage;
-			F32 cache_read_time = worker->mCacheReadTime;
+			LLUnit<F32, LLUnits::Seconds> cache_read_time = worker->mCacheReadTime;
 			if (cache_read_time != 0.f)
 			{
-				sample(sCacheReadLatency, cache_read_time * 1000.f);
+				record(sCacheReadLatency, cache_read_time);
 			}
 			res = true;
 			LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;
@@ -2891,7 +2891,7 @@ S32 LLTextureFetch::update(F32 max_time_ms)
 		mNetworkQueueMutex.lock();										// +Mfnq
 		mMaxBandwidth = band_width;
 
-		add(LLStatViewer::TEXTURE_KBIT, mHTTPTextureBits);
+		add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits);
 		mHTTPTextureBits = 0;
 
 		mNetworkQueueMutex.unlock();									// -Mfnq
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 7fc58e230cdbb6c42e504cb62c2190ef2bf91c33..38272b40dc3367c460b2e8e7af1cc01308efc806 100755
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -107,10 +107,10 @@ class LLTextureFetch : public LLWorkerThread
 	bool receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data);
 
     // Threads:  T* (but not safe)
-	void setTextureBandwidth(F32 bandwidth) { mTextureBandwidth = bandwidth; }
+	void setTextureBandwidth(LLUnit<F32, LLUnits::Kibibits> bandwidth) { mTextureBandwidth = bandwidth; }
 	
     // Threads:  T* (but not safe)
-	F32 getTextureBandwidth() { return mTextureBandwidth; }
+	LLUnit<F32, LLUnits::Kibibits> getTextureBandwidth() { return mTextureBandwidth; }
 	
     // Threads:  T*
 	BOOL isFromLocalCache(const LLUUID& id);
@@ -309,8 +309,8 @@ class LLTextureFetch : public LLWorkerThread
 	LLMutex mQueueMutex;        //to protect mRequestMap and mCommands only
 	LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue.
 
-	static LLTrace::SampleStatHandle<> sCacheHitRate;
-	static LLTrace::SampleStatHandle<> sCacheReadLatency;
+	static LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate;
+	static LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > sCacheReadLatency;
 
 	LLTextureCache* mTextureCache;
 	LLImageDecodeThread* mImageDecodeThread;
@@ -325,8 +325,8 @@ class LLTextureFetch : public LLWorkerThread
 	queue_t mHTTPTextureQueue;											// Mfnq
 	typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t;
 	cancel_queue_t mCancelQueue;										// Mfnq
-	F32 mTextureBandwidth;												// <none>
-	F32 mMaxBandwidth;													// Mfnq
+	LLUnit<F32, LLUnits::Kibibits> mTextureBandwidth;					// <none>
+	LLUnit<F32, LLUnits::Kibibits> mMaxBandwidth;						// Mfnq
 	LLTextureInfo mTextureInfo;
 
 	// XXX possible delete
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 72ed3d448553091680b6e544ab5b6a59f0dda53f..20e8a522cd89fd5579cff7928225cd7070c3a432 100755
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -586,8 +586,8 @@ void LLGLTexMemBar::draw()
 
 
 	left = 550;
-	F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth();
-	F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
+	LLUnit<F32, LLUnits::Kibibits> bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth();
+	LLUnit<F32, LLUnits::Kibibits> max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
 	color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color;
 	color[VALPHA] = text_color[VALPHA];
 	text = llformat("BW:%.0f/%.0f",bandwidth, max_bandwidth);
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index 80412c215f785716e6cdf21bfcfe5e77742ac152..5f11a2b5196d0d4b25f298d5525556963ec8d06b 100755
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -153,29 +153,29 @@ namespace LLViewerAssetStatsFF
 		};
 
 		if (at < 0 || at >= LLViewerAssetType::AT_COUNT)
-{
+		{
 			return EVACOtherGet;
-}
+		}
 		EViewerAssetCategories ret(asset_to_bin_map[at]);
 		if (EVACTextureTempHTTPGet == ret)
 		{
 			// Indexed with [is_temp][with_http]
 			static const EViewerAssetCategories texture_bin_map[2][2] =
-{
-	{
+			{
+				{
 					EVACTextureNonTempUDPGet,
-						EVACTextureNonTempHTTPGet,
+					EVACTextureNonTempHTTPGet,
 				},
 				{
 					EVACTextureTempUDPGet,
-						EVACTextureTempHTTPGet,
-	}
+					EVACTextureTempHTTPGet,
+				}
 			};
 	
 			ret = texture_bin_map[is_temp][with_http];
 		}
 		return ret;
-}
+	}
 
 	static LLTrace::CountStatHandle<> sEnqueueAssetRequestsTempTextureHTTP   ("enqueuedassetrequeststemptexturehttp", 
 																	"Number of temporary texture asset http requests enqueued"),
@@ -384,50 +384,50 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
 									.resp_min(rec.getMin(*sResponse[EVACTextureTempHTTPGet]).value())
 									.resp_max(rec.getMax(*sResponse[EVACTextureTempHTTPGet]).value())
 									.resp_mean(rec.getMean(*sResponse[EVACTextureTempHTTPGet]).value());
-}
+		}
 		if (!compact_output
 			|| rec.getSum(*sEnqueued[EVACTextureTempUDPGet]) 
 			|| rec.getSum(*sDequeued[EVACTextureTempUDPGet])
 			|| rec.getSum(*sResponse[EVACTextureTempUDPGet]).value())
-{
+		{
 			r.get_texture_temp_udp	.enqueued((S32)rec.getSum(*sEnqueued[EVACTextureTempUDPGet]))
 									.dequeued((S32)rec.getSum(*sDequeued[EVACTextureTempUDPGet]))
 									.resp_count((S32)rec.getSum(*sResponse[EVACTextureTempUDPGet]).value())
 									.resp_min(rec.getMin(*sResponse[EVACTextureTempUDPGet]).value())
 									.resp_max(rec.getMax(*sResponse[EVACTextureTempUDPGet]).value())
 									.resp_mean(rec.getMean(*sResponse[EVACTextureTempUDPGet]).value());
-}
+		}
 		if (!compact_output
 			|| rec.getSum(*sEnqueued[EVACTextureNonTempHTTPGet]) 
 			|| rec.getSum(*sDequeued[EVACTextureNonTempHTTPGet])
 			|| rec.getSum(*sResponse[EVACTextureNonTempHTTPGet]).value())
-{
+		{
 			r.get_texture_non_temp_http	.enqueued((S32)rec.getSum(*sEnqueued[EVACTextureNonTempHTTPGet]))
 										.dequeued((S32)rec.getSum(*sDequeued[EVACTextureNonTempHTTPGet]))
 										.resp_count((S32)rec.getSum(*sResponse[EVACTextureNonTempHTTPGet]).value())
 										.resp_min(rec.getMin(*sResponse[EVACTextureNonTempHTTPGet]).value())
 										.resp_max(rec.getMax(*sResponse[EVACTextureNonTempHTTPGet]).value())
 										.resp_mean(rec.getMean(*sResponse[EVACTextureNonTempHTTPGet]).value());
-}
+		}
 
 		if (!compact_output
 			|| rec.getSum(*sEnqueued[EVACTextureNonTempUDPGet]) 
 			|| rec.getSum(*sDequeued[EVACTextureNonTempUDPGet])
 			|| rec.getSum(*sResponse[EVACTextureNonTempUDPGet]).value())
-{
+		{
 			r.get_texture_non_temp_udp	.enqueued((S32)rec.getSum(*sEnqueued[EVACTextureNonTempUDPGet]))
 										.dequeued((S32)rec.getSum(*sDequeued[EVACTextureNonTempUDPGet]))
 										.resp_count((S32)rec.getSum(*sResponse[EVACTextureNonTempUDPGet]).value())
 										.resp_min(rec.getMin(*sResponse[EVACTextureNonTempUDPGet]).value())
 										.resp_max(rec.getMax(*sResponse[EVACTextureNonTempUDPGet]).value())
 										.resp_mean(rec.getMean(*sResponse[EVACTextureNonTempUDPGet]).value());
-}
+		}
 
 		if (!compact_output
 			|| rec.getSum(*sEnqueued[EVACWearableUDPGet]) 
 			|| rec.getSum(*sDequeued[EVACWearableUDPGet])
 			|| rec.getSum(*sResponse[EVACWearableUDPGet]).value())
-{
+		{
 			r.get_wearable_udp	.enqueued((S32)rec.getSum(*sEnqueued[EVACWearableUDPGet]))
 								.dequeued((S32)rec.getSum(*sDequeued[EVACWearableUDPGet]))
 								.resp_count((S32)rec.getSum(*sResponse[EVACWearableUDPGet]).value())
@@ -478,16 +478,16 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
 		S32 fps = (S32)rec.getLastValue(LLStatViewer::FPS_SAMPLE);
 		if (!compact_output || fps != 0)
 		{
-			r.fps.count(fps);
-			r.fps.min(rec.getMin(LLStatViewer::FPS_SAMPLE));
-			r.fps.max(rec.getMax(LLStatViewer::FPS_SAMPLE));
-			r.fps.mean(rec.getMean(LLStatViewer::FPS_SAMPLE));
+			r.fps	.count(fps)
+					.min(rec.getMin(LLStatViewer::FPS_SAMPLE))
+					.max(rec.getMax(LLStatViewer::FPS_SAMPLE))
+					.mean(rec.getMean(LLStatViewer::FPS_SAMPLE));
 		}
 		U32 grid_x(0), grid_y(0);
 		grid_from_region_handle(it->first, &grid_x, &grid_y);
-		r.grid_x(grid_x);
-		r.grid_y(grid_y);
-		r.duration(LLUnit<F64, LLUnits::Microseconds>(rec.getDuration()).value());
+		r	.grid_x(grid_x)
+			.grid_y(grid_y)
+			.duration(LLUnit<F64, LLUnits::Microseconds>(rec.getDuration()).value());
 	}
 
 	stats.duration(mCurRecording ? LLUnit<F64, LLUnits::Microseconds>(mCurRecording->getDuration()).value() : 0.0);
@@ -526,6 +526,7 @@ void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
 {
 	const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
 
+	llinfos << "enqueue " << int(eac) << llendl;
 	add(*sEnqueued[int(eac)], 1);
 }
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index fb199ba8791722c7b6d311f6f563dc4e11e7280a..9f67aad2975c890a6eb17f3141d05cf92e0d26d9 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -475,14 +475,12 @@ void init_menus()
 	gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
 	gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
 
-#if !MEM_TRACK_MEM
 	// Don't display the Memory console menu if the feature is turned off
 	LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
 	if (memoryMenu)
 	{
 		memoryMenu->setVisible(FALSE);
 	}
-#endif
 
 	gMenuBarView->createJumpKeys();
 
@@ -528,12 +526,6 @@ class LLAdvancedToggleConsole : public view_listener_t
 			toggle_visibility( (void*)gSceneView);
 		}
 
-#if MEM_TRACK_MEM
-		else if ("memory view" == console_type)
-		{
-			toggle_visibility( (void*)gDebugView->mMemoryView );
-		}
-#endif
 		return true;
 	}
 };
@@ -559,12 +551,6 @@ class LLAdvancedCheckConsole : public view_listener_t
 		{
 			new_value = get_visibility( (void*) gSceneView);
 		}
-#if MEM_TRACK_MEM
-		else if ("memory view" == console_type)
-		{
-			new_value = get_visibility( (void*)gDebugView->mMemoryView );
-		}
-#endif
 		
 		return new_value;
 	}
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index b215869a3eef6389e6fa5b7c03db6a0c6495b02b..8299c846638de1f9832eafb8d2f3db81d412f3b1 100755
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -95,12 +95,10 @@ extern LLPipeline	gPipeline;
 U32						LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
 std::map<U64, U32>		LLViewerObjectList::sIPAndPortToIndex;
 std::map<U64, LLUUID>	LLViewerObjectList::sIndexAndLocalIDToUUID;
-LLTrace::SampleStatHandle<>	LLViewerObjectList::sCacheHitRate("object_cache_hits");
+LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> >	LLViewerObjectList::sCacheHitRate("object_cache_hits");
 
 LLViewerObjectList::LLViewerObjectList()
 {
-	mNumVisCulled = 0;
-	mNumSizeCulled = 0;
 	mCurLazyUpdateIndex = 0;
 	mCurBin = 0;
 	mNumDeadObjects = 0;
@@ -358,7 +356,7 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
 		}
 		justCreated = true;
 		mNumNewObjects++;
-		sample(sCacheHitRate, 100.f);
+		sample(sCacheHitRate, LLUnits::Percent::fromValue(100.f));
 	}
 
 	if (objectp->isDead())
@@ -1091,9 +1089,6 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	fetchObjectCosts();
 	fetchPhysicsFlags();
 
-	mNumSizeCulled = 0;
-	mNumVisCulled = 0;
-
 	// update max computed render cost
 	LLVOVolume::updateRenderComplexity();
 
@@ -1155,8 +1150,6 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 
 	sample(LLStatViewer::NUM_OBJECTS, mObjects.size());
 	sample(LLStatViewer::NUM_ACTIVE_OBJECTS, idle_count);
-	sample(LLStatViewer::NUM_SIZE_CULLED, mNumSizeCulled);
-	sample(LLStatViewer::NUM_VIS_CULLED, mNumVisCulled);
 }
 
 void LLViewerObjectList::fetchObjectCosts()
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 464554245e5f55f5c23abdbcf634f5effdf008f9..741c7c7db961a54acfdcd271106ddb468ab91ff2 100755
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -170,8 +170,6 @@ class LLViewerObjectList
 
 	// Statistics data (see also LLViewerStats)
 	S32 mNumNewObjects;
-	S32 mNumSizeCulled;
-	S32 mNumVisCulled;
 
 	// if we paused in the last frame
 	// used to discount stats from this frame
@@ -198,7 +196,7 @@ class LLViewerObjectList
 	std::vector<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects
 	S32 mNumOrphans;
 
-	static LLTrace::SampleStatHandle<> sCacheHitRate;
+	static LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate;
 
 	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
 
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 244c150b29adbb24f72e9cfe5765a0a716e77d9c..69a6c00a8fd3e2f8cfdbf18e5f4cec84ac12db1f 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -64,15 +64,14 @@
 namespace LLStatViewer
 {
 
-LLTrace::CountStatHandle<>	FPS("framesrendered"),
-							PACKETS_IN("packetsinstat"),
-							PACKETS_LOST("packetsloststat"),
-							PACKETS_OUT("packetsoutstat"),
-							TEXTURE_PACKETS("texturepacketsstat"),
-							TRIANGLES_DRAWN("trianglesdrawnstat"),
+LLTrace::CountStatHandle<>	FPS("FPS", "Frames rendered"),
+							PACKETS_IN("Packets In", "Packets received"),
+							PACKETS_LOST("packetsloststat", "Packets lost"),
+							PACKETS_OUT("packetsoutstat", "Packets sent"),
+							TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
 							CHAT_COUNT("chatcount", "Chat messages sent"),
 							IM_COUNT("imcount", "IMs sent"),
-							OBJECT_CREATE("objectcreate"),
+							OBJECT_CREATE("objectcreate", "Number of objects created"),
 							OBJECT_REZ("objectrez", "Object rez count"),
 							LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"),
 							LSL_SAVES("lslsaves", "Number of times user has saved a script"),
@@ -86,34 +85,38 @@ LLTrace::CountStatHandle<>	FPS("framesrendered"),
 							EDIT_TEXTURE("edittexture", "Changes to textures on objects"),
 							KILLED("killed", "Number of times killed"),
 							FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"),
-							TEX_BAKES("texbakes"),
-							TEX_REBAKES("texrebakes"),
-							NUM_NEW_OBJECTS("numnewobjectsstat");
-LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibits> >	KBIT("kbitstat"),
-															LAYERS_KBIT("layerskbitstat"),
-															OBJECT_KBIT("objectkbitstat"),
-															ASSET_KBIT("assetkbitstat"),
-															TEXTURE_KBIT("texturekbitstat"),
-															ACTUAL_IN_KBIT("actualinkbitstat"),
-															ACTUAL_OUT_KBIT("actualoutkbitstat");
-
-LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> >	SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"),
-															SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"),
-															LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%");
-
-SimMeasurement<>			SIM_TIME_DILATION("simtimedilation", "", LL_SIM_STAT_TIME_DILATION),
-							SIM_FPS("simfps", "", LL_SIM_STAT_FPS),
-							SIM_PHYSICS_FPS("simphysicsfps", "", LL_SIM_STAT_PHYSFPS),
+							TEX_BAKES("texbakes", "Number of times avatar textures have been baked"),
+							TEX_REBAKES("texrebakes", "Number of times avatar textures have been forced to rebake"),
+							NUM_NEW_OBJECTS("numnewobjectsstat", "Number of objects in scene that were not previously in cache");
+
+LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > 
+							TRIANGLES_DRAWN("trianglesdrawnstat");
+
+LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibytes> >	
+							ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"),
+							LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"),
+							OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"),
+							ASSET_UDP_DATA_RECEIVED("assetudpdatareceived", "Network data received for assets (animations, sounds) over UDP message system"),
+							TEXTURE_NETWORK_DATA_RECEIVED("texturedatareceived", "Network data received for textures"),
+							MESSAGE_SYSTEM_DATA_IN("messagedatain", "Incoming message system network data"),
+							MESSAGE_SYSTEM_DATA_OUT("messagedataout", "Outgoing message system network data");
+
+LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> >	
+							SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"),
+							SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"),
+							LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%");
+
+SimMeasurement<>			SIM_TIME_DILATION("simtimedilation", "Simulator time scale", LL_SIM_STAT_TIME_DILATION),
+							SIM_FPS("simfps", "Simulator framerate", LL_SIM_STAT_FPS),
+							SIM_PHYSICS_FPS("simphysicsfps", "Simulator physics framerate", LL_SIM_STAT_PHYSFPS),
 							SIM_AGENT_UPS("simagentups", "", LL_SIM_STAT_AGENTUPS),
 							SIM_SCRIPT_EPS("simscripteps", "", LL_SIM_STAT_SCRIPT_EPS),
 							SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps", "", LL_SIM_STAT_SKIPPEDAISILSTEPS_PS),
-							SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS),
-							SIM_MAIN_AGENTS("simmainagents", "", LL_SIM_STAT_NUMAGENTMAIN),
-							SIM_CHILD_AGENTS("simchildagents", "", LL_SIM_STAT_NUMAGENTCHILD),
+							SIM_MAIN_AGENTS("simmainagents", "Number of avatars in current region", LL_SIM_STAT_NUMAGENTMAIN),
+							SIM_CHILD_AGENTS("simchildagents", "Number of avatars in neighboring regions", LL_SIM_STAT_NUMAGENTCHILD),
 							SIM_OBJECTS("simobjects", "", LL_SIM_STAT_NUMTASKS),
-							SIM_ACTIVE_OBJECTS("simactiveobjects", "", LL_SIM_STAT_NUMTASKSACTIVE),
-							SIM_ACTIVE_SCRIPTS("simactivescripts", "", LL_SIM_STAT_NUMSCRIPTSACTIVE),
-							SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
+							SIM_ACTIVE_OBJECTS("simactiveobjects", "Number of scripted and/or mocing objects", LL_SIM_STAT_NUMTASKSACTIVE),
+							SIM_ACTIVE_SCRIPTS("simactivescripts", "Number of scripted objects", LL_SIM_STAT_NUMSCRIPTSACTIVE),
 							SIM_IN_PACKETS_PER_SEC("siminpps", "", LL_SIM_STAT_INPPS),
 							SIM_OUT_PACKETS_PER_SEC("simoutpps", "", LL_SIM_STAT_OUTPPS),
 							SIM_PENDING_DOWNLOADS("simpendingdownloads", "", LL_SIM_STAT_PENDING_DOWNLOADS),
@@ -122,24 +125,29 @@ SimMeasurement<>			SIM_TIME_DILATION("simtimedilation", "", LL_SIM_STAT_TIME_DIL
 							SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS),
 							SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS);
 
+SimMeasurement<LLUnit<F64, LLUnits::Percent> >	
+							SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
+							SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS);
+
 LLTrace::SampleStatHandle<>	FPS_SAMPLE("fpssample"),
 							NUM_IMAGES("numimagesstat"),
 							NUM_RAW_IMAGES("numrawimagesstat"),
 							NUM_OBJECTS("numobjectsstat"),
 							NUM_ACTIVE_OBJECTS("numactiveobjectsstat"),
-							NUM_SIZE_CULLED("numsizeculledstat"),
-							NUM_VIS_CULLED("numvisculledstat"),
 							ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"),
 							LIGHTING_DETAIL("lightingdetail", "Lighting Detail"),
 							VISIBLE_AVATARS("visibleavatars", "Visible Avatars"),
 							SHADER_OBJECTS("shaderobjects", "Object Shaders"),
 							DRAW_DISTANCE("drawdistance", "Draw Distance"),
 							PENDING_VFS_OPERATIONS("vfspendingoperations"),
-							PACKETS_LOST_PERCENT("packetslostpercentstat"),
 							WINDOW_WIDTH("windowwidth", "Window width"),
 							WINDOW_HEIGHT("windowheight", "Window height");
-	
-static LLTrace::SampleStatHandle<S64> CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled");
+
+LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > 
+							PACKETS_LOST_PERCENT("packetslostpercentstat");
+
+static LLTrace::SampleStatHandle<bool> 
+							CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled");
 
 LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Megabytes> >	GL_TEX_MEM("gltexmemstat"),
 															GL_BOUND_MEM("glboundmemstat"),
@@ -150,38 +158,38 @@ LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Kibibytes> >	DELTA_BANDWIDTH("del
 
 	
 SimMeasurement<LLUnit<F64, LLUnits::Milliseconds> >	SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS),
-										SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
-										SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
-										SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
-										SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
-										SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
-										SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
-										SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
-										SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
-										SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
-										SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
-										SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
-										SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
-										SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
+													SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
+													SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
+													SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
+													SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
+													SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
+													SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
+													SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
+													SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
+													SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
+													SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
+													SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
+													SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
+													SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
 	
-SimMeasurement<LLUnit<F64, LLUnits::Bytes> >	SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES),
-												SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
+SimMeasurement<LLUnit<F64, LLUnits::Kilobytes> >	SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES);
+SimMeasurement<LLUnit<F64, LLUnits::Megabytes> >	SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
 
 LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Milliseconds> >	FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"),
-													FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
-													SIM_PING("simpingstat");
+																FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
+																SIM_PING("simpingstat");
 
 LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections");
 
 LLTrace::EventStatHandle<>	LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load");
 	
 LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> >	REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"),
-												FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
-												UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
-												NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
-												IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
-												REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
-												RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
+																FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
+																UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
+																NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
+																IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
+																REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
+																RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
 	
 LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> >	AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"),
 															TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"),
@@ -189,20 +197,16 @@ LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> >	AVATAR_EDIT_TIME("avata
 															FPS_10_TIME("fps10time", "Seconds below 10 FPS"),
 															FPS_8_TIME("fps8time", "Seconds below 8 FPS"),
 															FPS_2_TIME("fps2time", "Seconds below 2 FPS");
-
-
 }
 
 LLViewerStats::LLViewerStats() 
 :	mLastTimeDiff(0.0)
 {
 	mRecording.start();
-	LLTrace::get_frame_recording().start();
 }
 
 LLViewerStats::~LLViewerStats()
-{
-}
+{}
 
 void LLViewerStats::resetStats()
 {
@@ -363,10 +367,10 @@ void update_statistics()
 	add(LLStatViewer::FPS, 1);
 
 	F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
-	add(LLStatViewer::LAYERS_KBIT, LLUnit<F64, LLUnits::Bits>(layer_bits));
-	add(LLStatViewer::OBJECT_KBIT, gObjectData);
+	add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, LLUnit<F64, LLUnits::Bits>(layer_bits));
+	add(LLStatViewer::OBJECT_NETWORK_DATA_RECEIVED, gObjectData);
 	sample(LLStatViewer::PENDING_VFS_OPERATIONS, LLVFile::getVFSThread()->getPending());
-	add(LLStatViewer::ASSET_KBIT, LLUnit<F64, LLUnits::Bits>(gTransferManager.getTransferBitsIn(LLTCT_ASSET)));
+	add(LLStatViewer::ASSET_UDP_DATA_RECEIVED, LLUnit<F64, LLUnits::Bits>(gTransferManager.getTransferBitsIn(LLTCT_ASSET)));
 	gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
 
 	if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
@@ -378,17 +382,7 @@ void update_statistics()
 		gTextureTimer.unpause();
 	}
 	
-	{
-		static F32 visible_avatar_frames = 0.f;
-		static F32 avg_visible_avatars = 0;
-		F32 visible_avatars = (F32)LLVOAvatar::sNumVisibleAvatars;
-		if (visible_avatars > 0.f)
-		{
-			visible_avatar_frames = 1.f;
-			avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames;
-		}
-		sample(LLStatViewer::VISIBLE_AVATARS, (F64)avg_visible_avatars);
-	}
+	sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars);
 	LLWorld::getInstance()->updateNetStats();
 	LLWorld::getInstance()->requestCacheMisses();
 	
@@ -403,7 +397,7 @@ void update_statistics()
 		static LLFrameTimer texture_stats_timer;
 		if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
 		{
-			gTotalTextureData = LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_KBIT);
+			gTotalTextureData = LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED);
 			texture_stats_timer.reset();
 		}
 	}
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 879f0067b9e9e3459dae9f52098e5400d1ed6fe8..3b7079ae4bdb657c259999c68bdd536a6e986b54 100755
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -72,7 +72,6 @@ extern LLTrace::CountStatHandle<>			FPS,
 											PACKETS_LOST,
 											PACKETS_OUT,
 											TEXTURE_PACKETS,
-											TRIANGLES_DRAWN,
 											CHAT_COUNT,
 											IM_COUNT,
 											OBJECT_CREATE,
@@ -93,14 +92,15 @@ extern LLTrace::CountStatHandle<>			FPS,
 											TEX_REBAKES,
 											NUM_NEW_OBJECTS;
 
+extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN;
 
-extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibits> >	KBIT,
-																	LAYERS_KBIT,
-																	OBJECT_KBIT,
-																	ASSET_KBIT,
-																	TEXTURE_KBIT,
-																	ACTUAL_IN_KBIT,
-																	ACTUAL_OUT_KBIT;
+extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibytes> >	ACTIVE_MESSAGE_DATA_RECEIVED,
+																	LAYERS_NETWORK_DATA_RECEIVED,
+																	OBJECT_NETWORK_DATA_RECEIVED,
+																	ASSET_UDP_DATA_RECEIVED,
+																	TEXTURE_NETWORK_DATA_RECEIVED,
+																	MESSAGE_SYSTEM_DATA_IN,
+																	MESSAGE_SYSTEM_DATA_OUT;
 
 extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> >		SIM_20_FPS_TIME,
 																	SIM_PHYSICS_20_FPS_TIME,
@@ -112,13 +112,11 @@ extern SimMeasurement<>						SIM_TIME_DILATION,
 											SIM_AGENT_UPS,
 											SIM_SCRIPT_EPS,
 											SIM_SKIPPED_SILHOUETTE,
-											SIM_SKIPPED_CHARACTERS_PERCENTAGE,
 											SIM_MAIN_AGENTS,
 											SIM_CHILD_AGENTS,
 											SIM_OBJECTS,
 											SIM_ACTIVE_OBJECTS,
 											SIM_ACTIVE_SCRIPTS,
-											SIM_PERCENTAGE_SCRIPTS_RUN,
 											SIM_IN_PACKETS_PER_SEC,
 											SIM_OUT_PACKETS_PER_SEC,
 											SIM_PENDING_DOWNLOADS,
@@ -127,23 +125,25 @@ extern SimMeasurement<>						SIM_TIME_DILATION,
 											SIM_PHYSICS_PINNED_TASKS,
 											SIM_PHYSICS_LOD_TASKS;
 
+extern SimMeasurement<LLUnit<F64, LLUnits::Percent> >	SIM_PERCENTAGE_SCRIPTS_RUN,
+														SIM_SKIPPED_CHARACTERS_PERCENTAGE;
+
 extern LLTrace::SampleStatHandle<>		FPS_SAMPLE,
 										NUM_IMAGES,
 										NUM_RAW_IMAGES,
 										NUM_OBJECTS,
 										NUM_ACTIVE_OBJECTS,
-										NUM_SIZE_CULLED,
-										NUM_VIS_CULLED,
 										ENABLE_VBO,
 										LIGHTING_DETAIL,
 										VISIBLE_AVATARS,
 										SHADER_OBJECTS,
 										DRAW_DISTANCE,
 										PENDING_VFS_OPERATIONS,
-										PACKETS_LOST_PERCENT,
 										WINDOW_WIDTH,
 										WINDOW_HEIGHT;
 
+extern LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > PACKETS_LOST_PERCENT;
+
 extern LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Megabytes> >	GL_TEX_MEM,
 																	GL_BOUND_MEM,
 																	RAW_MEM,
@@ -165,8 +165,8 @@ extern SimMeasurement<LLUnit<F64, LLUnits::Milliseconds> >	SIM_FRAME_TIME,
 															SIM_SLEEP_TIME,
 															SIM_PUMP_IO_TIME;
 
-extern SimMeasurement<LLUnit<F64, LLUnits::Bytes> >	SIM_UNACKED_BYTES,
-													SIM_PHYSICS_MEM;
+extern SimMeasurement<LLUnit<F64, LLUnits::Kilobytes> >	SIM_UNACKED_BYTES;
+extern SimMeasurement<LLUnit<F64, LLUnits::Megabytes> >	SIM_PHYSICS_MEM;
 
 
 extern LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Milliseconds> >	FRAMETIME_JITTER,
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 431a3b330cf9014dc272db14d187bc3f66ab11cb..dfd7ac983d41865096887f217a23a89325701a8a 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -663,7 +663,7 @@ void LLViewerTextureList::updateImages(F32 max_time)
 	}
 	cleared = FALSE;
 
-	LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_KBIT));
+	LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED));
 
 	{
 		using namespace LLStatViewer;
@@ -1374,7 +1374,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 	{
 		received_size = msg->getReceiveSize() ;		
 	}
-	add(LLStatViewer::TEXTURE_KBIT, LLUnit<F64, LLUnits::Bytes>(received_size));
+	add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, LLUnit<F64, LLUnits::Bytes>(received_size));
 	add(LLStatViewer::TEXTURE_PACKETS, 1);
 	
 	U8 codec;
@@ -1448,7 +1448,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d
 		received_size = msg->getReceiveSize() ;		
 	}
 
-	add(LLStatViewer::TEXTURE_KBIT, LLUnit<F64, LLUnits::Bytes>(received_size));
+	add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, LLUnit<F64, LLUnits::Bytes>(received_size));
 	add(LLStatViewer::TEXTURE_PACKETS, 1);
 	
 	//llprintline("Start decode, image header...");
diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp
index 34f2c8f6e6f6052b6d26b42e0c2efaffc693aedd..b8de5871ea2720a741066b039851c0f315fe07fa 100755
--- a/indra/newview/llviewerthrottle.cpp
+++ b/indra/newview/llviewerthrottle.cpp
@@ -48,8 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f;
 const F32 MIN_BANDWIDTH = 50.f;
 const F32 MAX_BANDWIDTH = 3000.f;
 const F32 STEP_FRACTIONAL = 0.1f;
-const F32 TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s
-const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s
+const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s
+const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s
 const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds
 
 LLViewerThrottle gViewerThrottle;
@@ -304,7 +304,7 @@ void LLViewerThrottle::updateDynamicThrottle()
 	}
 	mUpdateTimer.reset();
 
-	F32 mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
+	LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
 	if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
 	{
 		if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 85e4e6bc086a6a0c7522c4b5da5c97f98de6738e..10e354f2e3b527cf80c1fd3dff3b38c56d39f60d 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -215,6 +215,7 @@
 // Globals
 //
 void render_ui(F32 zoom_factor = 1.f, int subfield = 0);
+void swap();
 
 extern BOOL gDebugClicks;
 extern BOOL gDisplaySwapBuffers;
@@ -4405,6 +4406,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 					// Required for showing the GUI in snapshots and performing bloom composite overlay
 					// Call even if show_ui is FALSE
 					render_ui(scale_factor, subfield);
+					swap();
 				}
 				
 				for (U32 out_y = 0; out_y < read_height ; out_y++)
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index a95adbf4426d1affdbd9784381ea7c198c93d3bb..3dfe4c5e5f96d9ddfd58d015a74047fcbcd785b9 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -711,7 +711,7 @@ void LLWorld::renderPropertyLines()
 
 void LLWorld::updateNetStats()
 {
-	F32 bits = 0.f;
+	LLUnit<F64, LLUnits::Bits> bits = 0.f;
 	U32 packets = 0;
 
 	for (region_list_t::iterator iter = mActiveRegionList.begin();
@@ -729,23 +729,22 @@ void LLWorld::updateNetStats()
 	S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut;
 	S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost;
 
-	S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();
-	S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits();
+	LLUnit<F64, LLUnits::Bits> actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();
+	LLUnit<F64, LLUnits::Bits> actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits();
 
-	add(LLStatViewer::ACTUAL_IN_KBIT, LLUnit<F64, LLUnits::Bits>(actual_in_bits));
-	add(LLStatViewer::ACTUAL_OUT_KBIT, LLUnit<F64, LLUnits::Bits>(actual_out_bits));
-	add(LLStatViewer::KBIT, LLUnit<F64, LLUnits::Bits>(bits));
+	add(LLStatViewer::MESSAGE_SYSTEM_DATA_IN, actual_in_bits);
+	add(LLStatViewer::MESSAGE_SYSTEM_DATA_OUT, actual_out_bits);
+	add(LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED, bits);
 	add(LLStatViewer::PACKETS_IN, packets_in);
 	add(LLStatViewer::PACKETS_OUT, packets_out);
 	add(LLStatViewer::PACKETS_LOST, packets_lost);
 	if (packets_in)
 	{
-		F32 packet_loss = 100.f * ((F32)packets_lost/(F32)packets_in);
-		sample(LLStatViewer::PACKETS_LOST_PERCENT, packet_loss);
+		sample(LLStatViewer::PACKETS_LOST_PERCENT, LLUnits::Ratio::fromValue((F32)packets_lost/(F32)packets_in));
 	}
 
-	mLastPacketsIn = gMessageSystem->mPacketsIn;
-	mLastPacketsOut = gMessageSystem->mPacketsOut;
+	mLastPacketsIn   = gMessageSystem->mPacketsIn;
+	mLastPacketsOut  = gMessageSystem->mPacketsOut;
 	mLastPacketsLost = gMessageSystem->mDroppedPackets;
 }
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c2f5b9b86105c3e06840169cbd206771f876dd14..76ecd84e11e87ea5086fdce56a297de851eedd38 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4686,7 +4686,7 @@ void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type)
 	}
 
 	record(sStatBatchSize, count);
-	add(LLStatViewer::TRIANGLES_DRAWN, count);
+	add(LLStatViewer::TRIANGLES_DRAWN, LLUnits::Triangles::fromValue(count));
 
 	if (LLPipeline::sRenderFrameTest)
 	{
diff --git a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
index 246e8bb256f22d420a93699931d9522d1c17f45a..71ff961c59fa61b18da75514f1afd8d39680e254 100644
--- a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
@@ -45,10 +45,10 @@
                   unit_scale="100"
                   precision="0"/>
         <stat_bar name="bandwidth"
-                  label="Bandwidth"
+                  label="UDP Data Received"
                   orientation="horizontal"
                   unit_label="kbps"
-                  stat="kbitstat"
+                  stat="activemessagedatareceived"
                   bar_max="5000"
                   tick_spacing="500"
                   precision="0"/>
@@ -159,55 +159,55 @@
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="objectkbitstat"
+			    <stat_bar name="objectdatareceived"
                     label="Objects"
                     orientation="horizontal"
-                    stat="objectkbitstat"
+                    stat="objectdatareceived"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="texturekbitstat"
+			    <stat_bar name="texturedatareceived"
                     label="Texture"
                     orientation="horizontal"
-                    stat="texturekbitstat"
+                    stat="texturedatareceived"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="assetkbitstat"
+			    <stat_bar name="assetudpdatareceived"
                     label="Asset"
                     orientation="horizontal"
-                    stat="assetkbitstat"
+                    stat="assetudpdatareceived"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="layerskbitstat"
+			    <stat_bar name="layersdatareceived"
                     label="Layers"
                     orientation="horizontal"
-                    stat="layerskbitstat"
+                    stat="layersdatareceived"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="actualinkbitstat"
+			    <stat_bar name="messagedatain"
                     label="Actual In"
                     orientation="horizontal"
-                    stat="actualinkbitstat"
+                    stat="messagedatain"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
                     show_bar="false"/>
-			    <stat_bar name="actualoutkbitstat"
+			    <stat_bar name="messagedataout"
                     label="Actual Out"
                     orientation="horizontal"
-                    stat="actualoutkbitstat"
+                    stat="messagedataout"
                     unit_label="kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index 0493f487d45359533ec0eeb7555b66d7e50528ef..ba43c24ad38ebc66adb51b4805f57ea280d1f220 100755
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -1,838 +1,343 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<floater
- legacy_header_height="18"
- can_resize="true"
- height="400"
- layout="topleft"
- name="Statistics"
- help_topic="statistics"
- save_rect="true"
- save_visibility="true"
- title="STATISTICS"
- width="260">
-    <scroll_container
-     follows="top|left|bottom|right"
-     height="380"
-     layout="topleft"
-     left="0"
-     name="statistics_scroll"
-     reserve_scroll_corner="true"
-     top="20"
-     width="260">
-      <container_view
-       follows="top|left|bottom|right"
-       height="378"
-       layout="topleft"
-       left="2"
-       name="statistics_view"
-       top="20"
-       width="245" >
-        <!--Basic Section-->
-		  <stat_view
-			 name="basic"
-			 label="Basic"
-       follows="left|top|right"
-			 show_label="true"
-			 setting="OpenDebugStatBasic">
-			<stat_bar
-			   name="fps"
-			   label="FPS"
-			   unit_label="fps"
-			   stat="framesrendered"
-			   bar_min="0"
-			   bar_max="60"
-			   tick_spacing="6"
-			   precision="1"
-			   show_bar="true"
-			   show_history="true">
-			</stat_bar>
-			<stat_bar
-			   name="bandwidth"
-			   label="Bandwidth"
-			   unit_label="kbps"
-			   stat="kbitstat"
-			   bar_min="0"
-			   bar_max="5000"
-			   tick_spacing="500"
-				 precision="0"
-			   show_bar="true"
-			   show_history="false">
-			</stat_bar>
-			<stat_bar
-			   name="packet_loss"
-			   label="Packet Loss"
-			   unit_label=" %"
-			   stat="packetslostpercentstat"
-			   bar_min="0"
-			   bar_max="5"
-			   tick_spacing="0.5"
-			   precision="3"
-			   show_bar="false"
-			   show_mean="true">
-			</stat_bar>
-			<stat_bar
-			   name="ping"
-			   label="Ping Sim"
-			   unit_label="msec"
-			   stat="simpingstat"
-			   bar_min="0"
-			   bar_max="5000"
-			   tick_spacing="500"
-				 precision="0"
-			   show_bar="false"
-			   show_mean="false">
-			</stat_bar>
-		  </stat_view>
-          <!--Advanced Section-->
-      <stat_view
-			 name="advanced"
-			 label="Advanced"
-       follows="left|top|right"       
-			 show_label="true"
-			 setting="OpenDebugStatAdvanced">
-			<stat_view
-			   name="render"
-			   label="Render"
-         follows="left|top|right"
-			   show_label="true"
-			   setting="OpenDebugStatRender">
-			  <stat_bar
-				 name="ktrisframe"
-				 label="KTris Drawn per Frame"
-				 unit_label="/fr"
-				 stat="trianglesdrawnstat"
-         unit_scale="0.001"
-				 bar_min="0"
-				 bar_max="10000"
-				 tick_spacing="1000"
-				 precision="0"
-				 show_per_sec="false"
-         show_bar="false">
-        </stat_bar>
-			  <stat_bar
-				 name="ktrissec"
-				 label="KTris Drawn per Sec"
-				 unit_label="/sec"
-         unit_scale="0.001"
-				 stat="trianglesdrawnstat"
-				 bar_min="0"
-				 bar_max="200000"
-				 tick_spacing="25000"
-				 precision="0"
-         show_bar="false">
-        </stat_bar>
-			  <stat_bar
-				 name="objs"
-				 label="Total Objects"
-				 unit_label=""
-				 stat="numobjectsstat"
-				 bar_min="0"
-				 bar_max="50000"
-				 tick_spacing="5000"
-				 precision="0"
-				 show_bar="false">
-			  </stat_bar>
-			  <stat_bar
-				 name="newobjs"
-				 label="New Objects"
-				 unit_label="/sec"
-				 stat="numnewobjectsstat"
-				 bar_min="0"
-				 bar_max="2000"
-				 tick_spacing="200"
-				 show_bar="false">
-			  </stat_bar>
-       <stat_bar
-				 name="object_cache_hits"
-				 label="Object Cache Hit Rate"
-				 stat="object_cache_hits"
-				 bar_min="0"
-				 bar_max="100"
-         unit_label="%"
-				 tick_spacing="20"
-				 show_history="true"
-				 show_bar="false">
-        </stat_bar>
-			</stat_view>
-        <!--Texture Stats-->
-			<stat_view
-			   name="texture"
-			   label="Texture"
-         follows="left|top|right"
-			   show_label="true">
-			  <stat_bar
-				 name="texture_cache_hits"
-				 label="Cache Hit Rate"
-				 stat="texture_cache_hits"
-				 bar_min="0.f"
-				 bar_max="100.f"
-         unit_label="%"
-				 tick_spacing="20"
-				 show_history="true"
-				 show_bar="false">
-        </stat_bar>
-        <stat_bar
-				 name="texture_cache_read_latency"
-				 label="Cache Read Latency"
-         unit_label="msec"
-				 stat="texture_cache_read_latency"
-				 bar_min="0.f"
-				 bar_max="1000.f"
-				 tick_spacing="100"
-				 show_history="true"
-				 show_bar="false">
-        </stat_bar>
-        <stat_bar
-				 name="numimagesstat"
-				 label="Count"
-				 stat="numimagesstat" 
-				 bar_min="0.f"
-				 bar_max="8000.f" 
-				 tick_spacing="2000.f"
-				 show_bar="false">
-			  </stat_bar>
-
-			  <stat_bar
-				 name="numrawimagesstat"
-				 label="Raw Count"
-				 stat="numrawimagesstat"
-				 bar_min="0.f"
-				 bar_max="8000.f" 
-				 tick_spacing="2000.f"
-				 show_bar="false">
-			  </stat_bar>
-
-			  <stat_bar
-				 name="gltexmemstat"
-				 label="GL Mem"
-				 stat="gltexmemstat"
-         unit_label="MB"
-         unit_scale="0.000001"
-				 bar_min="0.f"
-				 bar_max="400.f" 
-				 tick_spacing="100.f"
-				 precision="1"
-         show_bar="false">
-        </stat_bar>
-
-			  <stat_bar
-				 name="formattedmemstat"
-				 label="Formatted Mem"
-				 stat="formattedmemstat"
-         unit_label="MB"
-         unit_scale="0.000001"
-				 bar_min="0.f"
-				 bar_max="400.f" 
-				 tick_spacing="100.f"
-				 precision="3"
-         show_bar="false">
-        </stat_bar>
-
-			  <stat_bar
-				 name="rawmemstat"
-				 label="Raw Mem"
-         unit_label="MB"
-         unit_scale="0.000001"
-				 stat="rawmemstat"
-				 bar_min="0.f"
-				 bar_max="400.f" 
-				 tick_spacing="100.f"
-				 precision="3"
-         show_bar="false">
-        </stat_bar>
-
-			  <stat_bar
-				 name="glboundmemstat"
-				 label="Bound Mem"
-				 stat="glboundmemstat"
-         unit_label="MB"
-         unit_scale="0.000001"
-				 bar_min="0.f"
-				 bar_max="400.f" 
-				 tick_spacing="100.f"
-				 precision="3"
-         show_bar="false">
-        </stat_bar>
-			</stat_view>
-        <!--Network Stats-->
-			<stat_view
-			   name="network"
-			   label="Network"
-         follows="left|top|right"
-			   show_label="true"
-			   setting="OpenDebugStatNet">
-			  <stat_bar
-				 name="packetsinstat"
-				 label="Packets In"
-				 stat="packetsinstat"
-				 unit_label="/sec" 
-         bar_min="0.f"
-				 bar_max="1024.f" 
-				 tick_spacing="128.f"
-				 precision="1"
-				 show_bar="false">
-			  </stat_bar>
-
-			  <stat_bar
-				 name="packetsoutstat"
-				 label="Packets Out"
-				 stat="packetsoutstat"
-				 unit_label="/sec"  
-         bar_min="0.f"
-				 bar_max="1024.f" 
-				 tick_spacing="128.f"
-				 precision="1"
-				 show_bar="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="objectkbitstat"
-				 label="Objects"
-				 stat="objectkbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="texturekbitstat"
-				 label="Texture"
-				 stat="texturekbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="assetkbitstat"
-				 label="Asset"
-				 stat="assetkbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="layerskbitstat"
-				 label="Layers"
-				 stat="layerskbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="actualinkbitstat"
-				 label="Actual In"
-				 stat="actualinkbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false"
-				 show_history="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="actualoutkbitstat"
-				 label="Actual Out"
-				 stat="actualoutkbitstat"
-         unit_label="kbps"
-         bar_min="0.f"
-         bar_max="1024.f"
-         tick_spacing="128.f"
-         precision="1"
-				 show_bar="false"
-				 show_history="false">
-			  </stat_bar>
-
-			  <stat_bar
-				 name="vfspendingoperations"
-				 label="VFS Pending Operations"
-				 stat="vfspendingoperations"
-				 unit_label=" Ops."
-				 show_bar="false" >
-			  </stat_bar>
-			</stat_view>
-		  </stat_view>
-        <!--Sim Stats-->
-		  <stat_view
-			 name="sim"
-			 label="Simulator"
-       follows="left|top|right"
-			 show_label="true"
-			 setting="OpenDebugStatSim">
-			<stat_bar
-			   name="simtimedilation"
-			   label="Time Dilation"
-			   stat="simtimedilation"
-			   precision="3"
-			   bar_min="0.f"
-			   bar_max="1.f" 
-			   tick_spacing="0.16666f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simfps"
-			   label="Sim FPS"
-			   stat="simfps"
-			   precision="1"
-			   bar_min="0.f"
-			   bar_max="45.f" 
-			   tick_spacing="7.5f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simphysicsfps"
-			   label="Physics FPS"
-			   stat="simphysicsfps"
-			   precision="1"
-			   bar_min="0.f"
-			   bar_max="45.f" 
-			   tick_spacing="7.5.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_view
-			   name="physicsdetail"
-			   label="Physics Details"
-         follows="left|top|right"
-			   show_label="true">
-			  <stat_bar
-				 name="physicspinnedtasks"
-				 label="Pinned Objects"
-				 stat="physicspinnedtasks"
-				 precision="0" 
-				 bar_min="0.f"
-				 bar_max="500.f" 
-				 tick_spacing="50.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="physicslodtasks"
-				 label="Low LOD Objects"
-				 stat="physicslodtasks"
-				 precision="0"
-				 bar_min="0.f"
-				 bar_max="500.f" 
-				 tick_spacing="50.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="physicsmemoryallocated"
-				 label="Memory Allocated"
-				 stat="physicsmemoryallocated"
-				 unit_label="MB"
-				 precision="1"
-				 bar_min="0.f"
-				 bar_max="1024.f" 
-				 tick_spacing="128.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-		  </stat_view>
-
-			<stat_bar
-			   name="simagentups"
-			   label="Agent Updates/Sec"
-			   stat="simagentups"
-			   precision="1"
-			   bar_min="0.f"
-			   bar_max="100.f" 
-			   tick_spacing="25.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simmainagents"
-			   label="Main Agents"
-			   stat="simmainagents"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="80.f" 
-			   tick_spacing="10.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simchildagents"
-			   label="Child Agents"
-			   stat="simchildagents"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="40.f" 
-			   tick_spacing="5.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simobjects"
-			   label="Objects"
-			   stat="simobjects"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="30000.f" 
-			   tick_spacing="5000.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simactiveobjects"
-			   label="Active Objects"
-			   stat="simactiveobjects"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="5000.f" 
-			   tick_spacing="750.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simactivescripts"
-			   label="Active Scripts"
-			   stat="simactivescripts"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="15000.f" 
-			   tick_spacing="1875.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-        <stat_bar
-            name="simpctscriptsrun"
-            label="Scripts Run"
-            unit_label=" %"
-            stat="simpctscriptsrun"
-            bar_min="0"
-            bar_max="100"
-            tick_spacing="10"
-            precision="3"
-            show_bar="false"
-            show_mean="true">
-        </stat_bar>
-
-			<stat_bar
-			   name="simscripteps"
-			   label="Script Events"
-			   stat="simscripteps"
-			   unit_label="eps"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="5000.f" 
-			   tick_spacing="750.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-        <stat_view
-            name="simpathfinding"
-            label="Pathfinding"
-            follows="left|top|right"
-            show_label="true">
-          <stat_bar
-              name="simsimaistepmsec"
-              label="  AI Step Time"
-              stat="simsimaistepmsec"
-              unit_label="ms"
-              precision="3"
-              bar_min="0.f"
-              bar_max="40.f"
-              tick_spacing="10.f"
-              show_bar="false"
-              show_mean="false" >
-          </stat_bar>
-          <stat_bar
-              name="simsimskippedsilhouettesteps"
-              label="  Skipped Silhouette Steps"
-              stat="simsimskippedsilhouettesteps"
-              unit_label="/sec"
-              precision="0"
-              bar_min="0"
-              bar_max="45"
-              tick_spacing="4"
-              show_bar="false">
-          </stat_bar>
-          <stat_bar
-              name="simsimpctsteppedcharacters"
-              label="  Characters Updated"
-              unit_label=" %"
-              stat="simsimpctsteppedcharacters"
-              bar_min="0"
-              bar_max="100"
-              tick_spacing="10"
-              precision="1"
-              show_bar="false"
-              show_mean="true">
-          </stat_bar>
+<floater legacy_header_height="18"
+         can_resize="true"
+         height="400"
+         layout="topleft"
+         name="Statistics"
+         help_topic="statistics"
+         save_rect="true"
+         save_visibility="true"
+         title="STATISTICS"
+         width="260">
+  <scroll_container follows="all"
+                    height="380"
+                    layout="topleft"
+                    left="0"
+                    name="statistics_scroll"
+                    reserve_scroll_corner="true"
+                    top="20"
+                    width="260">
+    <container_view follows="all"
+                    height="378"
+                    layout="topleft"
+                    left="2"
+                    name="statistics_view"
+                    top="20"
+                    width="245" >
+     <stat_view name="basic"
+                 label="Basic"
+                 follows="left|top|right"
+                 show_label="true"
+                 show_bar="true"
+                 setting="OpenDebugStatBasic">
+        <stat_bar name="fps"
+                  label="FPS"
+                  unit_label="frames"
+                  stat="FPS"
+                  decimal_digits="1"
+                  show_bar="true"
+                  show_history="true"/>
+       <stat_bar name="bandwidth"
+                  label="UDP Data Received"
+                  stat="activemessagedatareceived"
+                  show_bar="true"/>
+        <stat_bar name="packet_loss"
+                  label="Packet Loss"
+                  stat="packetslostpercentstat"
+                  decimal_digits="3"/>
+        <stat_bar name="ping"
+                  label="Ping Sim"
+                  stat="simpingstat"/>
+      </stat_view>
+
+     <stat_view name="advanced"
+                 label="Advanced"
+                 follows="left|top|right"
+                 show_bar="true"
+                 show_label="true"
+                 setting="OpenDebugStatAdvanced">
+        <stat_view name="render"
+                   label="Render"
+                   follows="left|top|right"
+                   show_bar="true"
+                   show_label="true"
+                   setting="OpenDebugStatRender">
+          <stat_bar name="ktrisframe"
+                    label="KTris per Frame"
+                    unit_label="ktris/fr"
+                    stat="trianglesdrawnstat"
+                    show_per_sec="false"/>
+          <stat_bar name="ktrissec"
+                    label="KTris per Sec"
+                    stat="trianglesdrawnstat"/>
+          <stat_bar name="objs"
+                    label="Total Objects"
+                    stat="numobjectsstat"/>
+          <stat_bar name="newobjs"
+                    label="New Objects"
+                    stat="numnewobjectsstat"
+                    bar_max="2000"/>
+          <stat_bar name="object_cache_hits"
+                    label="Object Cache Hit Rate"
+                    stat="object_cache_hits"
+                    bar_max="100"
+                    show_history="true"/>
         </stat_view>
-
-			<stat_bar
-			   name="siminpps"
-			   label="Packets In"
-			   stat="siminpps"
-			   unit_label="pps"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="2000.f" 
-			   tick_spacing="250.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simoutpps"
-			   label="Packets Out"
-			   stat="simoutpps"
-			   unit_label="pps" 
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="2000.f" 
-			   tick_spacing="250.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simpendingdownloads"
-			   label="Pending Downloads"
-			   stat="simpendingdownloads"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="800.f" 
-			   tick_spacing="100.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simpendinguploads"
-			   label="Pending Uploads"
-			   stat="simpendinguploads"
-			   precision="0"
-			   bar_min="0.f"
-			   bar_max="100.f" 
-			   tick_spacing="25.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_bar
-			   name="simtotalunackedbytes"
-			   label="Total Unacked Bytes"
-			   stat="simtotalunackedbytes"
-			   unit_label="kb"
-			   precision="1"
-			   bar_min="0.f"
-			   bar_max="100000.f" 
-			   tick_spacing="25000.f"
-			   show_bar="false"
-			   show_mean="false" >
-			</stat_bar>
-
-			<stat_view
-			   name="simperf"
-			   label="Time (ms)"
-         follows="left|top|right"
-			   show_label="true">
-			  <stat_bar
-				 name="simframemsec"
-				 label="Total Frame Time"
-				 stat="simframemsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simnetmsec"
-				 label="Net Time"
-				 stat="simnetmsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simsimphysicsmsec"
-				 label="Physics Time"
-				 stat="simsimphysicsmsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simsimothermsec"
-				 label="Simulation Time"
-				 stat="simsimothermsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simagentmsec"
-				 label="Agent Time"
-				 stat="simagentmsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simimagesmsec"
-				 label="Images Time"
-				 stat="simimagesmsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-			  <stat_bar
-				 name="simscriptmsec"
-				 label="Script Time"
-				 stat="simscriptmsec"
-				 unit_label="ms"
-				 precision="3"
-				 bar_min="0.f"
-				 bar_max="40.f" 
-				 tick_spacing="10.f"
-				 show_bar="false"
-				 show_mean="false" >
-			  </stat_bar>
-
-        <stat_bar
-         name="simsparemsec"
-         label="Spare Time"
-         stat="simsparemsec"
-         unit_label="ms"
-         precision="3"
-         bar_min="0.f"
-         bar_max="40.f"
-         tick_spacing="10.f"
-         show_bar="false"
-         show_mean="false" >
-        </stat_bar>
-        <!--2nd level time blocks under 'Details' second-->
-          <stat_view
- 			     name="timedetails"
-			     label="Time Details (ms)"
-           follows="left|top|right"
-			     show_label="true">
-            <stat_bar
-             name="simsimphysicsstepmsec"
-             label="  Physics Step"
-             stat="simsimphysicsstepmsec"
-             unit_label="ms"
-             precision="3"
-             bar_min="0.f"
-             bar_max="40.f"
-             tick_spacing="10.f"
-             show_bar="false"
-             show_mean="false" >
-            </stat_bar>
-            <stat_bar
-             name="simsimphysicsshapeupdatemsec"
-             label="  Update Phys Shapes"
-             stat="simsimphysicsshapeupdatemsec"
-             unit_label="ms"
-             precision="3"
-             bar_min="0.f"
-             bar_max="40.f"
-             tick_spacing="10.f"
-             show_bar="false"
-             show_mean="false" >
-            </stat_bar>
-            <stat_bar
-             name="simsimphysicsothermsec"
-             label="  Physics Other"
-             stat="simsimphysicsothermsec"
-             unit_label="ms"
-             precision="3"
-             bar_min="0.f"
-             bar_max="40.f"
-             tick_spacing="10.f"
-             show_bar="false"
-             show_mean="false" >
-            </stat_bar>
-            <stat_bar
-             name="simsleepmsec"
-             label="  Sleep Time"
-             stat="simsleepmsec"
-             unit_label="ms"
-             precision="3"
-             bar_min="0.f"
-             bar_max="40.f"
-             tick_spacing="10.f"
-             show_bar="false"
-             show_mean="false" >
-            </stat_bar>
-            <stat_bar
-             name="simpumpiomsec"
-             label="  Pump IO"
-             stat="simpumpiomsec"
-             unit_label="ms"
-             precision="3"
-             bar_min="0.f"
-             bar_max="40.f"
-             tick_spacing="10.f"
-             show_bar="false"
-             show_mean="false" >
-            </stat_bar>
-			</stat_view>
-			</stat_view>
-		  </stat_view>
-		</container_view>
-    </scroll_container>
+        <stat_view name="texture"
+                   label="Texture"
+                   follows="left|top|right"
+                   show_bar="true"
+                   show_label="true">
+          <stat_bar name="texture_cache_hits"
+                    label="Cache Hit Rate"
+                    stat="texture_cache_hits"
+                    bar_max="100"
+                    show_history="true"/>
+          <stat_bar name="texture_cache_read_latency"
+                    label="Cache Read Latency"
+                    stat="texture_cache_read_latency"
+                    show_history="true"/>
+          <stat_bar name="numimagesstat"
+                    label="Count"
+                    stat="numimagesstat"/>
+          <stat_bar name="numrawimagesstat"
+                    label="Raw Count"
+                    stat="numrawimagesstat"/>
+          <stat_bar name="gltexmemstat"
+                    label="GL Mem"
+                    stat="gltexmemstat"
+                    decimal_digits="1"/>
+          <stat_bar name="formattedmemstat"
+                    label="Formatted Mem"
+                    stat="formattedmemstat"
+                    decimal_digits="3"/>
+          <stat_bar name="rawmemstat"
+                    label="Raw Mem"
+                    stat="rawmemstat"
+                    decimal_digits="3"/>
+          <stat_bar name="glboundmemstat"
+                    label="Bound Mem"
+                    stat="glboundmemstat"
+                    decimal_digits="3"/>
+        </stat_view>
+        
+        <stat_view name="network"
+                   label="Network"
+                   follows="left|top|right"
+                   show_bar="true"         
+                   show_label="true"
+                   setting="OpenDebugStatNet">
+          <stat_bar name="packetsinstat"
+                    label="Packets In"
+                    stat="Packets In"
+                    decimal_digits="1"/>
+          <stat_bar name="packetsoutstat"
+                    label="Packets Out"
+                    stat="packetsoutstat"
+                    decimal_digits="1"/>
+          <stat_bar name="objectdatareceived"
+                    label="Objects"
+                    stat="objectdatareceived"
+                    decimal_digits="1"/>
+          <stat_bar name="texturedatareceived"
+                    label="Texture"
+                    stat="texturedatareceived"
+                    decimal_digits="1"/>
+          <stat_bar name="assetudpdatareceived"
+                    label="Asset"
+                    stat="assetudpdatareceived"
+                    decimal_digits="1"/>
+          <stat_bar name="layersdatareceived"
+                    label="Layers"
+                    stat="layersdatareceived"
+                    decimal_digits="1"/>
+          <stat_bar name="messagedatain"
+                    label="Actual In"
+                    stat="messagedatain"
+                    decimal_digits="1"/>
+          <stat_bar name="messagedataout"
+                    label="Actual Out"
+                    stat="messagedataout"
+                    decimal_digits="1"
+                    show_history="false"/>
+          <stat_bar name="vfspendingoperations"
+                    label="VFS Pending Operations"
+                    stat="vfspendingoperations"
+                    unit_label="Ops."/>
+        </stat_view>
+      </stat_view>
+
+      <stat_view name="sim"
+                 label="Simulator"
+                 follows="left|top|right"
+                 show_bar="true"       
+                 show_label="true"
+                 setting="OpenDebugStatSim">
+        <stat_bar name="simtimedilation"
+                  label="Time Dilation"
+                  stat="simtimedilation"
+                  decimal_digits="3"
+                  bar_max="1" />
+        <stat_bar name="simfps"
+                  label="Sim FPS"
+                  stat="simfps"
+                  decimal_digits="1"
+                  bar_max="45" />
+        <stat_bar name="simphysicsfps"
+                  label="Physics FPS"
+                  stat="simphysicsfps"
+                  decimal_digits="1"
+                  bar_max="45" />
+        <stat_view name="physicsdetail"
+                   label="Physics Details"
+                   follows="left|top|right"
+                   show_bar="true"         
+                   show_label="true">
+          <stat_bar name="physicspinnedtasks"
+                    label="Pinned Objects"
+                    stat="physicspinnedtasks"/>
+          <stat_bar name="physicslodtasks"
+                    label="Low LOD Objects"
+                    stat="physicslodtasks"/>
+          <stat_bar name="physicsmemoryallocated"
+                    label="Memory Allocated"
+                    stat="physicsmemoryallocated"
+                    decimal_digits="1"/>
+        </stat_view>
+        <stat_bar name="simagentups"
+                  label="Agent Updates/Sec"
+                  stat="simagentups"
+                  decimal_digits="1"/>
+        <stat_bar name="simmainagents"
+                  label="Main Agents"
+                  stat="simmainagents"
+                  bar_max="80"/>
+        <stat_bar name="simchildagents"
+                  label="Child Agents"
+                  stat="simchildagents"/>
+        <stat_bar name="simobjects"
+                  label="Objects"
+                  stat="simobjects"
+                  bar_max="30000" />
+        <stat_bar name="simactiveobjects"
+                  label="Active Objects"
+                  stat="simactiveobjects"
+                  bar_max="5000"/>
+        <stat_bar name="simactivescripts"
+                  label="Active Scripts"
+                  stat="simactivescripts"
+                  bar_max="15000"/>
+        <stat_bar name="simpctscriptsrun"
+                  label="Scripts Run"
+                  stat="simpctscriptsrun"
+                  bar_max="100"
+                  decimal_digits="3"/>
+        <stat_bar name="simscripteps"
+                  label="Script Events"
+                  stat="simscripteps"
+                  unit_label="eps"/>
+        <stat_view name="simpathfinding"
+                   label="Pathfinding"
+                   follows="left|top|right"
+                   show_bar="true"        
+                   show_label="true">
+          <stat_bar name="simsimaistepmsec"
+                    label="AI Step Time"
+                    stat="simsimaistepmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simsimskippedsilhouettesteps"
+                    label="Skipped Silhouette Steps"
+                    stat="simsimskippedsilhouettesteps"
+                    unit_label="/sec"
+                    bar_max="45"/>
+          <stat_bar name="simsimpctsteppedcharacters"
+                    stat="simsimpctsteppedcharacters"
+                    bar_max="100"
+                    decimal_digits="1"/>
+        </stat_view>
+        <stat_bar name="siminpps"
+                  label="Packets In"
+                  stat="siminpps"
+                  unit_label="pkt/sec"/>
+        <stat_bar name="simoutpps"
+                  label="Packets Out"
+                  stat="simoutpps"
+                  unit_label="pkt/sec"/>
+        <stat_bar name="simpendingdownloads"
+                  label="Pending Downloads"
+                  stat="simpendingdownloads"/>
+        <stat_bar name="simpendinguploads"
+                  label="Pending Uploads"
+                  stat="simpendinguploads"/>
+        <stat_bar name="simtotalunackedbytes"
+                  label="Total Unacked Bytes"
+                  stat="simtotalunackedbytes"
+                  decimal_digits="1"/>
+        <stat_view name="simperf"
+                   label="Time"
+                   follows="left|top|right"
+                   show_bar="true"
+                   show_label="true">
+          <stat_bar name="simframemsec"
+                    label="Total Frame Time"
+                    stat="simframemsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simnetmsec"
+                    label="Net Time"
+                    stat="simnetmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simsimphysicsmsec"
+                    label="Physics Time"
+                    stat="simsimphysicsmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simsimothermsec"
+                    label="Simulation Time"
+                    stat="simsimothermsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simagentmsec"
+                    label="Agent Time"
+                    stat="simagentmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simimagesmsec"
+                    label="Images Time"
+                    stat="simimagesmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simscriptmsec"
+                    label="Script Time"
+                    stat="simscriptmsec"
+                    decimal_digits="3"/>
+          <stat_bar name="simsparemsec"
+                    label="Spare Time"
+                    stat="simsparemsec"
+                    decimal_digits="3"/>
+          <stat_view name="timedetails"
+                     label="Time Details"
+                     follows="left|top|right"
+                     show_bar="true"
+                     show_label="true">
+            <stat_bar name="simsimphysicsstepmsec"
+                      label="Physics Step"
+                      stat="simsimphysicsstepmsec"
+                      decimal_digits="3"/>
+            <stat_bar name="simsimphysicsshapeupdatemsec"
+                      label="Update Phys Shapes"
+                      stat="simsimphysicsshapeupdatemsec"
+                      decimal_digits="3"/>
+            <stat_bar name="simsimphysicsothermsec"
+                      label="Physics Other"
+                      stat="simsimphysicsothermsec"
+                      decimal_digits="3"/>
+            <stat_bar name="simsleepmsec"
+                      label="Sleep Time"
+                      stat="simsleepmsec"
+                      decimal_digits="3"/>
+            <stat_bar name="simpumpiomsec"
+                      label="Pump IO"
+                      stat="simpumpiomsec"
+                      decimal_digits="3"/>
+          </stat_view>
+        </stat_view>
+      </stat_view>
+    </container_view>
+  </scroll_container>
 </floater>