diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index 5cf5ae3c12326ff54e4dfe0b47cdfefb6433a015..2c91e10404bee59d63f00a287b3febd29dfc6570 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -42,25 +42,25 @@ LLStat::stat_map_t LLStat::sStatList;
 LLTimer LLStat::sTimer;
 LLFrameTimer LLStat::sFrameTimer;
 
-void LLStat::init()
+void LLStat::reset()
 {
-	llassert(mNumBins > 0);
 	mNumValues = 0;
 	mLastValue = 0.f;
-	mLastTime = 0.f;
-	mCurBin = (mNumBins-1);
+	delete[] mBins;
+	mBins      = new ValueEntry[mNumBins];
+	mCurBin = mNumBins-1;
 	mNextBin = 0;
-	mBins      = new F32[mNumBins];
-	mBeginTime = new F64[mNumBins];
-	mTime      = new F64[mNumBins];
-	mDT        = new F32[mNumBins];
-	for (U32 i = 0; i < mNumBins; i++)
-	{
-		mBins[i]      = 0.f;
-		mBeginTime[i] = 0.0;
-		mTime[i]      = 0.0;
-		mDT[i]        = 0.f;
-	}
+}
+
+LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer)
+:	mUseFrameTimer(use_frame_timer),
+	mNumBins(num_bins),
+	mName(name)
+{
+	llassert(mNumBins > 0);
+	mLastTime  = 0.f;
+
+	reset();
 
 	if (!mName.empty())
 	{
@@ -71,27 +71,9 @@ void LLStat::init()
 	}
 }
 
-LLStat::LLStat(const U32 num_bins, const BOOL use_frame_timer)
-	: mUseFrameTimer(use_frame_timer),
-	  mNumBins(num_bins)
-{
-	init();
-}
-
-LLStat::LLStat(std::string name, U32 num_bins, BOOL use_frame_timer)
-:	mUseFrameTimer(use_frame_timer),
-	mNumBins(num_bins),
-	mName(name)
-{
-	init();
-}
-
 LLStat::~LLStat()
 {
 	delete[] mBins;
-	delete[] mBeginTime;
-	delete[] mTime;
-	delete[] mDT;
 
 	if (!mName.empty())
 	{
@@ -103,76 +85,15 @@ LLStat::~LLStat()
 	}
 }
 
-void LLStat::reset()
-{
-	U32 i;
-
-	mNumValues = 0;
-	mLastValue = 0.f;
-	mCurBin = (mNumBins-1);
-	delete[] mBins;
-	delete[] mBeginTime;
-	delete[] mTime;
-	delete[] mDT;
-	mBins      = new F32[mNumBins];
-	mBeginTime = new F64[mNumBins];
-	mTime      = new F64[mNumBins];
-	mDT        = new F32[mNumBins];
-	for (i = 0; i < mNumBins; i++)
-	{
-		mBins[i]      = 0.f;
-		mBeginTime[i] = 0.0;
-		mTime[i]      = 0.0;
-		mDT[i]        = 0.f;
-	}
-}
-
-void LLStat::setBeginTime(const F64 time)
-{
-	mBeginTime[mNextBin] = time;
-}
-
-void LLStat::addValueTime(const F64 time, const F32 value)
-{
-	if (mNumValues < mNumBins)
-	{
-		mNumValues++;
-	}
-
-	// Increment the bin counters.
-	mCurBin++;
-	if ((U32)mCurBin == mNumBins)
-	{
-		mCurBin = 0;
-	}
-	mNextBin++;
-	if ((U32)mNextBin == mNumBins)
-	{
-		mNextBin = 0;
-	}
-
-	mBins[mCurBin] = value;
-	mTime[mCurBin] = time;
-	mDT[mCurBin] = (F32)(mTime[mCurBin] - mBeginTime[mCurBin]);
-	//this value is used to prime the min/max calls
-	mLastTime = mTime[mCurBin];
-	mLastValue = value;
-
-	// Set the begin time for the next stat segment.
-	mBeginTime[mNextBin] = mTime[mCurBin];
-	mTime[mNextBin] = mTime[mCurBin];
-	mDT[mNextBin] = 0.f;
-}
-
 void LLStat::start()
 {
 	if (mUseFrameTimer)
 	{
-		mBeginTime[mNextBin] = sFrameTimer.getElapsedSeconds();
+		mBins[mNextBin].mBeginTime = sFrameTimer.getElapsedSeconds();
 	}
 	else
 	{
-		mBeginTime[mNextBin] = sTimer.getElapsedTimeF64();
+		mBins[mNextBin].mBeginTime = sTimer.getElapsedTimeF64();
 	}
 }
 
@@ -185,41 +106,41 @@ void LLStat::addValue(const F32 value)
 
 	// Increment the bin counters.
 	mCurBin++;
-	if ((U32)mCurBin == mNumBins)
+	if (mCurBin >= mNumBins)
 	{
 		mCurBin = 0;
 	}
 	mNextBin++;
-	if ((U32)mNextBin == mNumBins)
+	if (mNextBin >= mNumBins)
 	{
 		mNextBin = 0;
 	}
 
-	mBins[mCurBin] = value;
+	mBins[mCurBin].mValue = value;
 	if (mUseFrameTimer)
 	{
-		mTime[mCurBin] = sFrameTimer.getElapsedSeconds();
+		mBins[mCurBin].mTime = sFrameTimer.getElapsedSeconds();
 	}
 	else
 	{
-		mTime[mCurBin] = sTimer.getElapsedTimeF64();
+		mBins[mCurBin].mTime = sTimer.getElapsedTimeF64();
 	}
-	mDT[mCurBin] = (F32)(mTime[mCurBin] - mBeginTime[mCurBin]);
+	mBins[mCurBin].mDT = (F32)(mBins[mCurBin].mTime - mBins[mCurBin].mBeginTime);
 
 	//this value is used to prime the min/max calls
-	mLastTime = mTime[mCurBin];
+	mLastTime = mBins[mCurBin].mTime;
 	mLastValue = value;
 
 	// Set the begin time for the next stat segment.
-	mBeginTime[mNextBin] = mTime[mCurBin];
-	mTime[mNextBin] = mTime[mCurBin];
-	mDT[mNextBin] = 0.f;
+	mBins[mNextBin].mBeginTime = mBins[mCurBin].mTime;
+	mBins[mNextBin].mTime = mBins[mCurBin].mTime;
+	mBins[mNextBin].mDT = 0.f;
 }
 
 
 F32 LLStat::getMax() const
 {
-	U32 i;
+	S32 i;
 	F32 current_max = mLastValue;
 	if (mNumBins == 0)
 	{
@@ -230,13 +151,13 @@ F32 LLStat::getMax() const
 		for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
 		{
 			// Skip the bin we're currently filling.
-			if (i == (U32)mNextBin)
+			if (i == mNextBin)
 			{
 				continue;
 			}
-			if (mBins[i] > current_max)
+			if (mBins[i].mValue > current_max)
 			{
-				current_max = mBins[i];
+				current_max = mBins[i].mValue;
 			}
 		}
 	}
@@ -245,17 +166,17 @@ F32 LLStat::getMax() const
 
 F32 LLStat::getMean() const
 {
-	U32 i;
+	S32 i;
 	F32 current_mean = 0.f;
-	U32 samples = 0;
+	S32 samples = 0;
 	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
 	{
 		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
+		if (i == mNextBin)
 		{
 			continue;
 		}
-		current_mean += mBins[i];
+		current_mean += mBins[i].mValue;
 		samples++;
 	}
 
@@ -273,7 +194,7 @@ F32 LLStat::getMean() const
 
 F32 LLStat::getMin() const
 {
-	U32 i;
+	S32 i;
 	F32 current_min = mLastValue;
 
 	if (mNumBins == 0)
@@ -285,53 +206,19 @@ F32 LLStat::getMin() const
 		for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
 		{
 			// Skip the bin we're currently filling.
-			if (i == (U32)mNextBin)
+			if (i == mNextBin)
 			{
 				continue;
 			}
-			if (mBins[i] < current_min)
+			if (mBins[i].mValue < current_min)
 			{
-				current_min = mBins[i];
+				current_min = mBins[i].mValue;
 			}
 		}
 	}
 	return current_min;
 }
 
-F32 LLStat::getSum() const
-{
-	U32 i;
-	F32 sum = 0.f;
-	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
-	{
-		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
-		{
-			continue;
-		}
-		sum += mBins[i];
-	}
-
-	return sum;
-}
-
-F32 LLStat::getSumDuration() const
-{
-	U32 i;
-	F32 sum = 0.f;
-	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
-	{
-		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
-		{
-			continue;
-		}
-		sum += mDT[i];
-	}
-
-	return sum;
-}
-
 F32 LLStat::getPrev(S32 age) const
 {
 	S32 bin;
@@ -347,7 +234,7 @@ F32 LLStat::getPrev(S32 age) const
 		// Bogus for bin we're currently working on.
 		return 0.f;
 	}
-	return mBins[bin];
+	return mBins[bin].mValue;
 }
 
 F32 LLStat::getPrevPerSec(S32 age) const
@@ -365,107 +252,34 @@ F32 LLStat::getPrevPerSec(S32 age) const
 		// Bogus for bin we're currently working on.
 		return 0.f;
 	}
-	return mBins[bin] / mDT[bin];
-}
-
-F64 LLStat::getPrevBeginTime(S32 age) const
-{
-	S32 bin;
-	bin = mCurBin - age;
-
-	while (bin < 0)
-	{
-		bin += mNumBins;
-	}
-
-	if (bin == mNextBin)
-	{
-		// Bogus for bin we're currently working on.
-		return 0.f;
-	}
-
-	return mBeginTime[bin];
-}
-
-F64 LLStat::getPrevTime(S32 age) const
-{
-	S32 bin;
-	bin = mCurBin - age;
-
-	while (bin < 0)
-	{
-		bin += mNumBins;
-	}
-
-	if (bin == mNextBin)
-	{
-		// Bogus for bin we're currently working on.
-		return 0.f;
-	}
-
-	return mTime[bin];
-}
-
-F32 LLStat::getBin(S32 bin) const
-{
-	return mBins[bin];
-}
-
-F32 LLStat::getBinPerSec(S32 bin) const
-{
-	return mBins[bin] / mDT[bin];
-}
-
-F64 LLStat::getBinBeginTime(S32 bin) const
-{
-	return mBeginTime[bin];
-}
-
-F64 LLStat::getBinTime(S32 bin) const
-{
-	return mTime[bin];
+	return mBins[bin].mValue / mBins[bin].mDT;
 }
 
 F32 LLStat::getCurrent() const
 {
-	return mBins[mCurBin];
+	return mBins[mCurBin].mValue;
 }
 
 F32 LLStat::getCurrentPerSec() const
 {
-	return mBins[mCurBin] / mDT[mCurBin];
-}
-
-F64 LLStat::getCurrentBeginTime() const
-{
-	return mBeginTime[mCurBin];
-}
-
-F64 LLStat::getCurrentTime() const
-{
-	return mTime[mCurBin];
-}
-
-F32 LLStat::getCurrentDuration() const
-{
-	return mDT[mCurBin];
+	return mBins[mCurBin].mValue / mBins[mCurBin].mDT;
 }
 
 F32 LLStat::getMeanPerSec() const
 {
-	U32 i;
+	S32 i;
 	F32 value = 0.f;
 	F32 dt    = 0.f;
 
 	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
 	{
 		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
+		if (i == mNextBin)
 		{
 			continue;
 		}
-		value += mBins[i];
-		dt    += mDT[i];
+		value += mBins[i].mValue;
+		dt    += mBins[i].mDT;
 	}
 
 	if (dt > 0.f)
@@ -481,14 +295,14 @@ F32 LLStat::getMeanPerSec() const
 F32 LLStat::getMeanDuration() const
 {
 	F32 dur = 0.0f;
-	U32 count = 0;
-	for (U32 i=0; (i < mNumBins) && (i < mNumValues); i++)
+	S32 count = 0;
+	for (S32 i=0; (i < mNumBins) && (i < mNumValues); i++)
 	{
-		if (i == (U32)mNextBin)
+		if (i == mNextBin)
 		{
 			continue;
 		}
-		dur += mDT[i];
+		dur += mBins[i].mDT;
 		count++;
 	}
 
@@ -505,46 +319,45 @@ F32 LLStat::getMeanDuration() const
 
 F32 LLStat::getMaxPerSec() const
 {
-	U32 i;
 	F32 value;
 
 	if (mNextBin != 0)
 	{
-		value = mBins[0]/mDT[0];
+		value = mBins[0].mValue/mBins[0].mDT;
 	}
 	else if (mNumValues > 0)
 	{
-		value = mBins[1]/mDT[1];
+		value = mBins[1].mValue/mBins[1].mDT;
 	}
 	else
 	{
 		value = 0.f;
 	}
 
-	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
+	for (S32 i = 0; (i < mNumBins) && (i < mNumValues); i++)
 	{
 		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
+		if (i == mNextBin)
 		{
 			continue;
 		}
-		value = llmax(value, mBins[i]/mDT[i]);
+		value = llmax(value, mBins[i].mValue/mBins[i].mDT);
 	}
 	return value;
 }
 
 F32 LLStat::getMinPerSec() const
 {
-	U32 i;
+	S32 i;
 	F32 value;
 	
 	if (mNextBin != 0)
 	{
-		value = mBins[0]/mDT[0];
+		value = mBins[0].mValue/mBins[0].mDT;
 	}
 	else if (mNumValues > 0)
 	{
-		value = mBins[1]/mDT[1];
+		value = mBins[1].mValue/mBins[0].mDT;
 	}
 	else
 	{
@@ -554,25 +367,15 @@ F32 LLStat::getMinPerSec() const
 	for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
 	{
 		// Skip the bin we're currently filling.
-		if (i == (U32)mNextBin)
+		if (i == mNextBin)
 		{
 			continue;
 		}
-		value = llmin(value, mBins[i]/mDT[i]);
+		value = llmin(value, mBins[i].mValue/mBins[i].mDT);
 	}
 	return value;
 }
 
-F32 LLStat::getMinDuration() const
-{
-	F32 dur = 0.0f;
-	for (U32 i=0; (i < mNumBins) && (i < mNumValues); i++)
-	{
-		dur = llmin(dur, mDT[i]);
-	}
-	return dur;
-}
-
 U32 LLStat::getNumValues() const
 {
 	return mNumValues;
@@ -583,11 +386,6 @@ S32 LLStat::getNumBins() const
 	return mNumBins;
 }
 
-S32 LLStat::getCurBin() const
-{
-	return mCurBin;
-}
-
 S32 LLStat::getNextBin() const
 {
 	return mNextBin;
diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h
index 7718d40ffba735c838154be66d08df453ac5116b..3dc52aa507c586ecfca0211894413a724a2b8ec9 100644
--- a/indra/llcommon/llstat.h
+++ b/indra/llcommon/llstat.h
@@ -27,12 +27,10 @@
 #ifndef LL_LLSTAT_H
 #define LL_LLSTAT_H
 
-#include <deque>
 #include <map>
 
 #include "lltimer.h"
 #include "llframetimer.h"
-#include "llfile.h"
 
 class	LLSD;
 
@@ -43,56 +41,31 @@ class LL_COMMON_API LLStat
 	typedef std::multimap<std::string, LLStat*> stat_map_t;
 	static stat_map_t sStatList;
 
-	void init();
-
 public:
-	LLStat(U32 num_bins = 32, BOOL use_frame_timer = FALSE);
-	LLStat(std::string name, U32 num_bins = 32, BOOL use_frame_timer = FALSE);
+	LLStat(std::string name = std::string(), S32 num_bins = 32, BOOL use_frame_timer = FALSE);
 	~LLStat();
 
-	void reset();
-
 	void start();	// Start the timer for the current "frame", otherwise uses the time tracked from
 					// the last addValue
+	void reset();
 	void addValue(const F32 value = 1.f); // Adds the current value being tracked, and tracks the DT.
 	void addValue(const S32 value) { addValue((F32)value); }
 	void addValue(const U32 value) { addValue((F32)value); }
 
-	void setBeginTime(const F64 time);
-	void addValueTime(const F64 time, const F32 value = 1.f);
-	
-	S32 getCurBin() const;
 	S32 getNextBin() const;
 	
-	F32 getCurrent() const;
-	F32 getCurrentPerSec() const;
-	F64 getCurrentBeginTime() const;
-	F64 getCurrentTime() const;
-	F32 getCurrentDuration() const;
-	
 	F32 getPrev(S32 age) const;				// Age is how many "addValues" previously - zero is current
 	F32 getPrevPerSec(S32 age) const;		// Age is how many "addValues" previously - zero is current
-	F64 getPrevBeginTime(S32 age) const;
-	F64 getPrevTime(S32 age) const;
-	
-	F32 getBin(S32 bin) const;
-	F32 getBinPerSec(S32 bin) const;
-	F64 getBinBeginTime(S32 bin) const;
-	F64 getBinTime(S32 bin) const;
-
-	F32 getMax() const;
-	F32 getMaxPerSec() const;
+	F32 getCurrent() const;
+	F32 getCurrentPerSec() const;
 	
+	F32 getMin() const;
+	F32 getMinPerSec() const;
 	F32 getMean() const;
 	F32 getMeanPerSec() const;
 	F32 getMeanDuration() const;
-
-	F32 getMin() const;
-	F32 getMinPerSec() const;
-	F32 getMinDuration() const;
-
-	F32 getSum() const;
-	F32 getSumDuration() const;
+	F32 getMax() const;
+	F32 getMaxPerSec() const;
 
 	U32 getNumValues() const;
 	S32 getNumBins() const;
@@ -104,10 +77,21 @@ class LL_COMMON_API LLStat
 	U32 mNumBins;
 	F32 mLastValue;
 	F64 mLastTime;
-	F32 *mBins;
-	F64 *mBeginTime;
-	F64 *mTime;
-	F32 *mDT;
+
+	struct ValueEntry
+	{
+		ValueEntry()
+		:	mValue(0.f),
+			mBeginTime(0.0),
+			mTime(0.0),
+			mDT(0.f)
+		{}
+		F32 mValue;
+		F64 mBeginTime;
+		F64 mTime;
+		F32 mDT;
+	};
+	ValueEntry* mBins;
 	S32 mCurBin;
 	S32 mNextBin;
 	
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index c46fd56acc61df883c75e652fda7e51ff229424b..430d6358f77673280e3a84cb8773dd165a666ba3 100644
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -40,7 +40,6 @@
 #include "llpacketack.h"
 #include "lluuid.h"
 #include "llthrottle.h"
-#include "llstat.h"
 
 //
 // Constants
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index 74eaf9f025a0bdd323fbaf6121c4907237d80710..20dc5ae968fd2923f90b795524caab93d6b970f3 100644
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -42,7 +42,6 @@
 #include "llpumpio.h"
 #include "llsd.h"
 #include "llsdserialize_xml.h"
-#include "llstat.h"
 #include "llstl.h"
 #include "lltimer.h"
 
diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h
index a2024166eedcb77e6c9917b639620aa6baac5318..ae8e0087c14d84c590d2f178ce7b8f2469bcc7e6 100644
--- a/indra/llmessage/llmessagetemplate.h
+++ b/indra/llmessage/llmessagetemplate.h
@@ -29,7 +29,6 @@
 
 #include "lldarray.h"
 #include "message.h" // TODO: babbage: Remove...
-#include "llstat.h"
 #include "llstl.h"
 
 class LLMsgVarData
diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp
index fcb77a23a90d9338805981201d1770517c328b33..8272240ef4b874cf2790c381a4039f6fc95ba709 100644
--- a/indra/llmessage/llpumpio.cpp
+++ b/indra/llmessage/llpumpio.cpp
@@ -36,7 +36,6 @@
 #include "llapr.h"
 #include "llmemtype.h"
 #include "llstl.h"
-#include "llstat.h"
 
 // These should not be enabled in production, but they can be
 // intensely useful during development for finding certain kinds of
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index c37798c330d5186d86950978566c027831c43f41..d0c22d25f2b4d25f66067ff43b833df6ecaea89f 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -33,6 +33,7 @@
 #include "llerror.h"
 #include "llrect.h"
 #include "llstring.h"
+#include "llstat.h"
 
 // project includes
 #include "lluictrlfactory.h"
@@ -83,7 +84,8 @@ BOOL LLFloaterJoystick::postBuild()
 
 	for (U32 i = 0; i < 6; i++)
 	{
-		mAxisStats[i] = new LLStat(4);
+		std::string stat_name(llformat("Joystick axis %d", i));
+		mAxisStats[i] = new LLStat(stat_name, 4);
 		std::string axisname = llformat("axis%d", i);
 		mAxisStatsBar[i] = getChild<LLStatBar>(axisname);
 		if (mAxisStatsBar[i])
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 107e1623b0167dafe7eff655a5fb95b8cfba66f8..dbe46444d22e30d9a9abd4a79aa71b69d07cfe53 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -35,6 +35,7 @@
 #include "lltextureinfo.h"
 #include "llapr.h"
 #include "llimageworker.h"
+#include "llstat.h"
 //#include "lltexturecache.h"
 
 class LLViewerTexture;
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index 184033de424bc6b1ea9d21536ba816971dc4985d..df4ecc74ecc51764b9369f3428c69421efc05577 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -120,11 +120,11 @@ class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera>
 protected:
 	void calcProjection(const F32 far_distance) const;
 
-	LLStat mVelocityStat;
-	LLStat mAngularVelocityStat;
-	LLVector3 mVelocityDir ;
-	F32       mAverageSpeed ;
-	F32       mAverageAngularSpeed ;
+	LLStat		mVelocityStat;
+	LLStat		mAngularVelocityStat;
+	LLVector3	mVelocityDir ;
+	F32			mAverageSpeed ;
+	F32			mAverageAngularSpeed ;
 
 	mutable LLMatrix4	mProjectionMatrix;	// Cache of perspective matrix
 	mutable LLMatrix4	mModelviewMatrix;
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 6c8a827ba3f9e107e6db93555773f4ea341fa580..0316f7997345be5022544791910ad6ee13feae07 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -59,8 +59,6 @@
 #include "indra_constants.h"
 #include "llinitparam.h"
 
-//#include "linden_common.h"
-//#include "llpreprocessor.h"
 #include "llallocator.h"
 #include "llapp.h"
 #include "llcriticaldamp.h"
@@ -77,10 +75,8 @@
 #include "llprocessor.h"
 #include "llrefcount.h"
 #include "llsafehandle.h"
-//#include "llsecondlifeurls.h"
 #include "llsd.h"
 #include "llsingleton.h"
-#include "llstat.h"
 #include "llstl.h"
 #include "llstrider.h"
 #include "llstring.h"
@@ -88,11 +84,8 @@
 #include "llthread.h"
 #include "lltimer.h"
 #include "lluuidhashmap.h"
-//#include "processor.h"
 #include "stdenums.h"
 #include "stdtypes.h"
-//#include "string_table.h"
-//#include "timer.h"
 #include "timing.h"
 #include "u64.h"
 
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 528e0080b78a61987fff9243925959432d885566..6d517e48a43ab80fefbfd118704212c5e0084f4c 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -67,12 +67,12 @@ void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL;
 U32 LLViewerTextureList::sTextureBits = 0;
 U32 LLViewerTextureList::sTexturePackets = 0;
 S32 LLViewerTextureList::sNumImages = 0;
-LLStat LLViewerTextureList::sNumImagesStat(32, TRUE);
-LLStat LLViewerTextureList::sNumRawImagesStat(32, TRUE);
-LLStat LLViewerTextureList::sGLTexMemStat(32, TRUE);
-LLStat LLViewerTextureList::sGLBoundMemStat(32, TRUE);
-LLStat LLViewerTextureList::sRawMemStat(32, TRUE);
-LLStat LLViewerTextureList::sFormattedMemStat(32, TRUE);
+LLStat LLViewerTextureList::sNumImagesStat("Num Images", 32, TRUE);
+LLStat LLViewerTextureList::sNumRawImagesStat("Num Raw Images", 32, TRUE);
+LLStat LLViewerTextureList::sGLTexMemStat("GL Texture Mem", 32, TRUE);
+LLStat LLViewerTextureList::sGLBoundMemStat("GL Bound Mem", 32, TRUE);
+LLStat LLViewerTextureList::sRawMemStat("Raw Image Mem", 32, TRUE);
+LLStat LLViewerTextureList::sFormattedMemStat("Formatted Image Mem", 32, TRUE);
 
 LLViewerTextureList gTextureList;
 static LLFastTimer::DeclareTimer FTM_PROCESS_IMAGES("Process Images");
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 39e330ad666c727d874576d4457e88666b0b0b9a..bbce53bc9abb9a38e8e5793a6d3fd5b15b67e327 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -77,6 +77,7 @@
 #include "llmediaentry.h"
 #include "llurldispatcher.h"
 #include "raytrace.h"
+#include "llstat.h"
 
 // newview includes
 #include "llagent.h"
@@ -1540,7 +1541,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 	mResDirty(false),
 	mStatesDirty(false),
 	mCurrResolutionIndex(0),
-	mProgressView(NULL)
+	mProgressView(NULL),
+	mMouseVelocityStat(new LLStat("Mouse Velocity"))
 {
 	// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
 	// pass its value right now. Instead, pass it a nullary function that
@@ -2064,6 +2066,8 @@ LLViewerWindow::~LLViewerWindow()
 
 	delete mDebugText;
 	mDebugText = NULL;
+
+	delete mMouseVelocityStat;
 }
 
 
@@ -3238,7 +3242,7 @@ void LLViewerWindow::updateMouseDelta()
 		mouse_vel.setVec((F32) dx, (F32) dy);
 	}
     
-	mMouseVelocityStat.addValue(mouse_vel.magVec());
+	mMouseVelocityStat->addValue(mouse_vel.magVec());
 }
 
 void LLViewerWindow::updateKeyboardFocus()
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 6efcaeaf18add8c01ba20c0d8912547e4c8edb0d..5f475fe145b2a79bf32a8b904cb578d0e3dd06c9 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -41,7 +41,6 @@
 #include "llcursortypes.h"
 #include "llwindowcallbacks.h"
 #include "lltimer.h"
-#include "llstat.h"
 #include "llmousehandler.h"
 #include "llhandle.h"
 #include "llinitparam.h"
@@ -50,7 +49,7 @@
 #include <boost/signals2.hpp>
 #include <boost/scoped_ptr.hpp>
 
-
+class LLStat;
 class LLView;
 class LLViewerObject;
 class LLUUID;
@@ -251,7 +250,7 @@ class LLViewerWindow : public LLWindowCallbacks
 	S32				getCurrentMouseDX()		const	{ return mCurrentMouseDelta.mX; }
 	S32				getCurrentMouseDY()		const	{ return mCurrentMouseDelta.mY; }
 	LLCoordGL		getCurrentMouseDelta()	const	{ return mCurrentMouseDelta; }
-	LLStat *		getMouseVelocityStat()		{ return &mMouseVelocityStat; }
+	LLStat*			getMouseVelocityStat()		{ return mMouseVelocityStat; }
 	BOOL			getLeftMouseDown()	const	{ return mLeftMouseDown; }
 	BOOL			getMiddleMouseDown()	const	{ return mMiddleMouseDown; }
 	BOOL			getRightMouseDown()	const	{ return mRightMouseDown; }
@@ -428,7 +427,7 @@ class LLViewerWindow : public LLWindowCallbacks
 	LLCoordGL		mCurrentMousePoint;			// last mouse position in GL coords
 	LLCoordGL		mLastMousePoint;		// Mouse point at last frame.
 	LLCoordGL		mCurrentMouseDelta;		//amount mouse moved this frame
-	LLStat			mMouseVelocityStat;
+	LLStat*			mMouseVelocityStat;
 	BOOL			mLeftMouseDown;
 	BOOL			mMiddleMouseDown;
 	BOOL			mRightMouseDown;