diff options
57 files changed, 1056 insertions, 925 deletions
| diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index a144a8c94e..5baf049c03 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -256,12 +256,12 @@ void TimeBlock::processTimes()  	while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer)  	{  		U64 cumulative_time_delta = cur_time - cur_timer->mStartTime; -	 -		accumulator->mTotalTimeCounter += cumulative_time_delta; -		accumulator->mChildTimeCounter += stack_record->mChildTime; +		accumulator->mTotalTimeCounter += cumulative_time_delta - (accumulator->mTotalTimeCounter - cur_timer->mBlockStartTotalTimeCounter); +		accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime;  		stack_record->mChildTime = 0;  		cur_timer->mStartTime = cur_time; +		cur_timer->mBlockStartTotalTimeCounter = accumulator->mTotalTimeCounter;  		stack_record = &cur_timer->mParentTimerData;  		accumulator = stack_record->mTimeBlock->getPrimaryAccumulator(); @@ -376,7 +376,7 @@ void TimeBlock::dumpCurTimes()  		}  		out_str << timerp->getName() << " "  -			<< std::setprecision(3) << total_time_ms.as<LLUnits::Milliseconds, F32>().value() << " ms, " +			<< std::setprecision(3) << total_time_ms.as<LLUnits::Milliseconds>().value() << " ms, "  			<< num_calls << " calls";  		llinfos << out_str.str() << llendl; @@ -400,8 +400,9 @@ void TimeBlock::writeLog(std::ostream& os)  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////  TimeBlockAccumulator::TimeBlockAccumulator()  -:	mChildTimeCounter(0), -	mTotalTimeCounter(0), +:	mTotalTimeCounter(0), +	mSelfTimeCounter(0), +	mStartTotalTimeCounter(0),  	mCalls(0),  	mLastCaller(NULL),  	mActiveCount(0), @@ -411,8 +412,8 @@ TimeBlockAccumulator::TimeBlockAccumulator()  void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )  { -	mChildTimeCounter += other.mChildTimeCounter; -	mTotalTimeCounter += other.mTotalTimeCounter; +	mTotalTimeCounter += other.mTotalTimeCounter - other.mStartTotalTimeCounter; +	mSelfTimeCounter += other.mSelfTimeCounter;  	mCalls += other.mCalls;  	mLastCaller = other.mLastCaller;  	mActiveCount = other.mActiveCount; @@ -422,9 +423,31 @@ void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )  void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other )  { -	mTotalTimeCounter = 0; -	mChildTimeCounter = 0;  	mCalls = 0; +	mSelfTimeCounter = 0; + +	if (other) +	{ +		mStartTotalTimeCounter = other->mTotalTimeCounter; +		mTotalTimeCounter = mStartTotalTimeCounter; + +		mLastCaller = other->mLastCaller; +		mActiveCount = other->mActiveCount; +		mMoveUpTree = other->mMoveUpTree; +		mParent = other->mParent; +	} +	else +	{ +		mStartTotalTimeCounter = mTotalTimeCounter; +	} +} + +LLUnit<LLUnits::Seconds, F64> BlockTimer::getElapsedTime() +{ +	U64 total_time = TimeBlock::getCPUClockCount64() - mStartTime; + +	return (F64)total_time / (F64)TimeBlock::countsPerSecond();  } +  } // namespace LLTrace diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 726db70fbe..32a0629a87 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -71,9 +71,12 @@ public:  	BlockTimer(TimeBlock& timer);  	~BlockTimer(); +	LLUnit<LLUnits::Seconds, F64> getElapsedTime(); +  private:  	U64						mStartTime; +	U64						mBlockStartTotalTimeCounter;  	BlockTimerStackRecord	mParentTimerData;  }; @@ -279,6 +282,7 @@ LL_FORCE_INLINE BlockTimer::BlockTimer(TimeBlock& timer)  	BlockTimerStackRecord* cur_timer_data = ThreadTimerStack::getIfExists();  	TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator();  	accumulator->mActiveCount++; +	mBlockStartTotalTimeCounter = accumulator->mTotalTimeCounter;  	// keep current parent as long as it is active when we are  	accumulator->mMoveUpTree |= (accumulator->mParent->getPrimaryAccumulator()->mActiveCount == 0); @@ -299,8 +303,8 @@ LL_FORCE_INLINE BlockTimer::~BlockTimer()  	TimeBlockAccumulator* accumulator = cur_timer_data->mTimeBlock->getPrimaryAccumulator();  	accumulator->mCalls++; -	accumulator->mChildTimeCounter += cur_timer_data->mChildTime; -	accumulator->mTotalTimeCounter += total_time; +	accumulator->mTotalTimeCounter += total_time - (accumulator->mTotalTimeCounter - mBlockStartTotalTimeCounter); +	accumulator->mSelfTimeCounter += total_time - cur_timer_data->mChildTime;  	accumulator->mActiveCount--;  	// store last caller to bootstrap tree creation diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 0f927bad53..44da1939c6 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -42,506 +42,519 @@  namespace LLTrace  { -	class Recording; - -	typedef LLUnit<LLUnits::Bytes, F64>			Bytes; -	typedef LLUnit<LLUnits::Kilobytes, F64>		Kilobytes; -	typedef LLUnit<LLUnits::Megabytes, F64>		Megabytes; -	typedef LLUnit<LLUnits::Gigabytes, F64>		Gigabytes; -	typedef LLUnit<LLUnits::Bits, F64>			Bits; -	typedef LLUnit<LLUnits::Kilobits, F64>		Kilobits; -	typedef LLUnit<LLUnits::Megabits, F64>		Megabits; -	typedef LLUnit<LLUnits::Gigabits, F64>		Gigabits; - -	typedef LLUnit<LLUnits::Seconds, F64>		Seconds; -	typedef LLUnit<LLUnits::Milliseconds, F64>	Milliseconds; -	typedef LLUnit<LLUnits::Minutes, F64>		Minutes; -	typedef LLUnit<LLUnits::Hours, F64>			Hours; -	typedef LLUnit<LLUnits::Milliseconds, F64>	Milliseconds; -	typedef LLUnit<LLUnits::Microseconds, F64>	Microseconds; -	typedef LLUnit<LLUnits::Nanoseconds, F64>	Nanoseconds; - -	typedef LLUnit<LLUnits::Meters, F64>		Meters; -	typedef LLUnit<LLUnits::Kilometers, F64>	Kilometers; -	typedef LLUnit<LLUnits::Centimeters, F64>	Centimeters; -	typedef LLUnit<LLUnits::Millimeters, F64>	Millimeters; - -	void init(); -	void cleanup(); -	bool isInitialized(); - -	const LLThreadLocalPointer<class ThreadRecorder>& get_thread_recorder(); -	void set_thread_recorder(class ThreadRecorder*); - -	class MasterThreadRecorder& getMasterThreadRecorder(); - -	// one per thread per type -	template<typename ACCUMULATOR> -	class AccumulatorBuffer : public LLRefCount -	{ -		typedef AccumulatorBuffer<ACCUMULATOR> self_t; -		static const U32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 64; -	private: -		struct StaticAllocationMarker { }; - -		AccumulatorBuffer(StaticAllocationMarker m) -		:	mStorageSize(0), -			mStorage(NULL), -			mNextStorageSlot(0) -		{ -		} +class Recording; + +typedef LLUnit<LLUnits::Bytes, F64>			Bytes; +typedef LLUnit<LLUnits::Kilobytes, F64>		Kilobytes; +typedef LLUnit<LLUnits::Megabytes, F64>		Megabytes; +typedef LLUnit<LLUnits::Gigabytes, F64>		Gigabytes; +typedef LLUnit<LLUnits::Bits, F64>			Bits; +typedef LLUnit<LLUnits::Kilobits, F64>		Kilobits; +typedef LLUnit<LLUnits::Megabits, F64>		Megabits; +typedef LLUnit<LLUnits::Gigabits, F64>		Gigabits; + +typedef LLUnit<LLUnits::Seconds, F64>		Seconds; +typedef LLUnit<LLUnits::Milliseconds, F64>	Milliseconds; +typedef LLUnit<LLUnits::Minutes, F64>		Minutes; +typedef LLUnit<LLUnits::Hours, F64>			Hours; +typedef LLUnit<LLUnits::Milliseconds, F64>	Milliseconds; +typedef LLUnit<LLUnits::Microseconds, F64>	Microseconds; +typedef LLUnit<LLUnits::Nanoseconds, F64>	Nanoseconds; + +typedef LLUnit<LLUnits::Meters, F64>		Meters; +typedef LLUnit<LLUnits::Kilometers, F64>	Kilometers; +typedef LLUnit<LLUnits::Centimeters, F64>	Centimeters; +typedef LLUnit<LLUnits::Millimeters, F64>	Millimeters; + +void init(); +void cleanup(); +bool isInitialized(); + +const LLThreadLocalPointer<class ThreadRecorder>& get_thread_recorder(); +void set_thread_recorder(class ThreadRecorder*); + +class MasterThreadRecorder& getMasterThreadRecorder(); + +// one per thread per type +template<typename ACCUMULATOR> +class AccumulatorBuffer : public LLRefCount +{ +	typedef AccumulatorBuffer<ACCUMULATOR> self_t; +	static const U32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 64; +private: +	struct StaticAllocationMarker { }; -	public: +	AccumulatorBuffer(StaticAllocationMarker m) +	:	mStorageSize(0), +		mStorage(NULL), +		mNextStorageSlot(0) +	{ +	} -		AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) -		:	mStorageSize(0), -			mStorage(NULL), -			mNextStorageSlot(other.mNextStorageSlot) -		{ -			resize(other.mStorageSize); -			for (S32 i = 0; i < mNextStorageSlot; i++) -			{ -				mStorage[i] = other.mStorage[i]; -			} -		} +public: -		~AccumulatorBuffer() +	AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) +	:	mStorageSize(0), +		mStorage(NULL), +		mNextStorageSlot(other.mNextStorageSlot) +	{ +		resize(other.mStorageSize); +		for (S32 i = 0; i < mNextStorageSlot; i++)  		{ -			if (LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance() == mStorage) -			{ -				LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(getDefaultBuffer()->mStorage); -			} -			delete[] mStorage; +			mStorage[i] = other.mStorage[i];  		} +	} -		LL_FORCE_INLINE ACCUMULATOR& operator[](size_t index)  -		{  -			return mStorage[index];  +	~AccumulatorBuffer() +	{ +		if (LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance() == mStorage) +		{ +			LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(getDefaultBuffer()->mStorage);  		} +		delete[] mStorage; +	} -		LL_FORCE_INLINE const ACCUMULATOR& operator[](size_t index) const -		{  -			return mStorage[index];  -		} +	LL_FORCE_INLINE ACCUMULATOR& operator[](size_t index)  +	{  +		return mStorage[index];  +	} -		void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other) -		{ -			llassert(mNextStorageSlot == other.mNextStorageSlot); +	LL_FORCE_INLINE const ACCUMULATOR& operator[](size_t index) const +	{  +		return mStorage[index];  +	} -			for (size_t i = 0; i < mNextStorageSlot; i++) -			{ -				mStorage[i].addSamples(other.mStorage[i]); -			} -		} +	void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other) +	{ +		llassert(mNextStorageSlot == other.mNextStorageSlot); -		void copyFrom(const AccumulatorBuffer<ACCUMULATOR>& other) +		for (size_t i = 0; i < mNextStorageSlot; i++)  		{ -			for (size_t i = 0; i < mNextStorageSlot; i++) -			{ -				mStorage[i] = other.mStorage[i]; -			} +			mStorage[i].addSamples(other.mStorage[i]);  		} +	} -		void reset(const AccumulatorBuffer<ACCUMULATOR>* other = NULL) +	void copyFrom(const AccumulatorBuffer<ACCUMULATOR>& other) +	{ +		for (size_t i = 0; i < mNextStorageSlot; i++)  		{ -			for (size_t i = 0; i < mNextStorageSlot; i++) -			{ -				mStorage[i].reset(other ? &other->mStorage[i] : NULL); -			} +			mStorage[i] = other.mStorage[i];  		} +	} -		void makePrimary() +	void reset(const AccumulatorBuffer<ACCUMULATOR>* other = NULL) +	{ +		for (size_t i = 0; i < mNextStorageSlot; i++)  		{ -			LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(mStorage); +			mStorage[i].reset(other ? &other->mStorage[i] : NULL);  		} +	} -		bool isPrimary() const -		{ -			return LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance() == mStorage; -		} +	void makePrimary() +	{ +		LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(mStorage); +	} -		LL_FORCE_INLINE static ACCUMULATOR* getPrimaryStorage()  -		{  -			return LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance();  -		} +	bool isPrimary() const +	{ +		return LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance() == mStorage; +	} -		// NOTE: this is not thread-safe.  We assume that slots are reserved in the main thread before any child threads are spawned -		size_t reserveSlot() +	LL_FORCE_INLINE static ACCUMULATOR* getPrimaryStorage()  +	{  +		return LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance();  +	} + +	// NOTE: this is not thread-safe.  We assume that slots are reserved in the main thread before any child threads are spawned +	size_t reserveSlot() +	{ +		if (LLTrace::isInitialized())  		{ -			if (LLTrace::isInitialized()) -			{ -				llerrs << "Attempting to declare trace object after program initialization.  Trace objects should be statically initialized." << llendl; -			} -			size_t next_slot = mNextStorageSlot++; -			if (next_slot >= mStorageSize) -			{ -				resize(mStorageSize + (mStorageSize >> 2)); -			} -			llassert(mStorage && next_slot < mStorageSize); -			return next_slot; +			llerrs << "Attempting to declare trace object after program initialization.  Trace objects should be statically initialized." << llendl;  		} - -		void resize(size_t new_size) +		size_t next_slot = mNextStorageSlot++; +		if (next_slot >= mStorageSize)  		{ -			if (new_size <= mStorageSize) return; +			resize(mStorageSize + (mStorageSize >> 2)); +		} +		llassert(mStorage && next_slot < mStorageSize); +		return next_slot; +	} -			ACCUMULATOR* old_storage = mStorage; -			mStorage = new ACCUMULATOR[new_size]; -			if (old_storage) -			{ -				for (S32 i = 0; i < mStorageSize; i++) -				{ -					mStorage[i] = old_storage[i]; -				} -			} -			mStorageSize = new_size; -			delete[] old_storage; +	void resize(size_t new_size) +	{ +		if (new_size <= mStorageSize) return; -			self_t* default_buffer = getDefaultBuffer(); -			if (this != default_buffer -				&& new_size > default_buffer->size()) +		ACCUMULATOR* old_storage = mStorage; +		mStorage = new ACCUMULATOR[new_size]; +		if (old_storage) +		{ +			for (S32 i = 0; i < mStorageSize; i++)  			{ -				//NB: this is not thread safe, but we assume that all resizing occurs during static initialization -				default_buffer->resize(new_size); +				mStorage[i] = old_storage[i];  			}  		} +		mStorageSize = new_size; +		delete[] old_storage; -		size_t size() const +		self_t* default_buffer = getDefaultBuffer(); +		if (this != default_buffer +			&& new_size > default_buffer->size())  		{ -			return mNextStorageSlot; +			//NB: this is not thread safe, but we assume that all resizing occurs during static initialization +			default_buffer->resize(new_size);  		} +	} + +	size_t size() const +	{ +		return mNextStorageSlot; +	} -		static self_t* getDefaultBuffer() +	static self_t* getDefaultBuffer() +	{ +		// this buffer is allowed to leak so that trace calls from global destructors have somewhere to put their data +		// so as not to trigger an access violation +		static self_t* sBuffer = new AccumulatorBuffer(StaticAllocationMarker()); +		static bool sInitialized = false; +		if (!sInitialized)  		{ -			// this buffer is allowed to leak so that trace calls from global destructors have somewhere to put their data -			// so as not to trigger an access violation -			static self_t* sBuffer = new AccumulatorBuffer(StaticAllocationMarker()); -			static bool sInitialized = false; -			if (!sInitialized) -			{ -				sBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); -				sInitialized = true; -			} -			return sBuffer; +			sBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); +			sInitialized = true;  		} +		return sBuffer; +	} -	private: -		ACCUMULATOR*								mStorage; -		size_t										mStorageSize; -		size_t										mNextStorageSlot; -	}; +private: +	ACCUMULATOR*								mStorage; +	size_t										mStorageSize; +	size_t										mNextStorageSlot; +}; -	//TODO: replace with decltype when C++11 is enabled -	template<typename T> -	struct MeanValueType -	{ -		typedef F64 type; -	}; +//TODO: replace with decltype when C++11 is enabled +template<typename T> +struct MeanValueType +{ +	typedef F64 type; +}; -	template<typename ACCUMULATOR> -	class TraceType  -	:	 public LLInstanceTracker<TraceType<ACCUMULATOR>, std::string> -	{ -	public: -		typedef typename MeanValueType<TraceType<ACCUMULATOR> >::type  mean_t; +template<typename ACCUMULATOR> +class TraceType  +:	 public LLInstanceTracker<TraceType<ACCUMULATOR>, std::string> +{ +public: +	TraceType(const char* name, const char* description = NULL) +	:	LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>(name), +		mName(name), +		mDescription(description ? description : ""), +		mAccumulatorIndex(AccumulatorBuffer<ACCUMULATOR>::getDefaultBuffer()->reserveSlot()) +	{} -		TraceType(const char* name, const char* description = NULL) -		:	LLInstanceTracker<TraceType<ACCUMULATOR>, std::string>(name), -			mName(name), -			mDescription(description ? description : ""), -			mAccumulatorIndex(AccumulatorBuffer<ACCUMULATOR>::getDefaultBuffer()->reserveSlot()) -		{} +	LL_FORCE_INLINE ACCUMULATOR* getPrimaryAccumulator() const +	{ +		ACCUMULATOR* accumulator_storage = AccumulatorBuffer<ACCUMULATOR>::getPrimaryStorage(); +		return &accumulator_storage[mAccumulatorIndex]; +	} -		LL_FORCE_INLINE ACCUMULATOR* getPrimaryAccumulator() const -		{ -			ACCUMULATOR* accumulator_storage = AccumulatorBuffer<ACCUMULATOR>::getPrimaryStorage(); -			return &accumulator_storage[mAccumulatorIndex]; -		} +	size_t getIndex() const { return mAccumulatorIndex; } -		size_t getIndex() const { return mAccumulatorIndex; } +	const std::string& getName() const { return mName; } -		const std::string& getName() const { return mName; } +protected: +	const std::string	mName; +	const std::string	mDescription; +	const size_t		mAccumulatorIndex; +}; -	protected: -		const std::string	mName; -		const std::string	mDescription; -		const size_t		mAccumulatorIndex; -	}; +template<typename T> +class MeasurementAccumulator +{ +public: +	typedef T value_t; +	typedef MeasurementAccumulator<T> self_t; + +	MeasurementAccumulator() +	:	mSum(0), +		mMin((std::numeric_limits<T>::max)()), +		mMax((std::numeric_limits<T>::min)()), +		mMean(0), +		mVarianceSum(0), +		mNumSamples(0), +		mLastValue(0) +	{} -	template<typename T> -	class MeasurementAccumulator +	void sample(T value)  	{ -	public: -		typedef T value_t; -		typedef MeasurementAccumulator<T> self_t; - -		MeasurementAccumulator() -		:	mSum(0), -			mMin((std::numeric_limits<T>::max)()), -			mMax((std::numeric_limits<T>::min)()), -			mMean(0), -			mVarianceSum(0), -			mNumSamples(0), -			mLastValue(0) -		{} +		mNumSamples++; +		mSum += value; +		if (value < mMin) +		{ +			mMin = value; +		} +		if (value > mMax) +		{ +			mMax = value; +		} +		F64 old_mean = mMean; +		mMean += ((F64)value - old_mean) / (F64)mNumSamples; +		mVarianceSum += ((F64)value - old_mean) * ((F64)value - mMean); +		mLastValue = value; +	} -		LL_FORCE_INLINE void sample(T value) +	void addSamples(const self_t& other) +	{ +		if (other.mNumSamples)  		{ -			T storage_value(value); -			mNumSamples++; -			mSum += storage_value; -			if (storage_value < mMin) +			mSum += other.mSum; +			if (other.mMin < mMin)  			{ -				mMin = storage_value; +				mMin = other.mMin;  			} -			if (storage_value > mMax) +			if (other.mMax > mMax)  			{ -				mMax = storage_value; +				mMax = other.mMax;  			} -			F64 old_mean = mMean; -			mMean += ((F64)storage_value - old_mean) / (F64)mNumSamples; -			mVarianceSum += ((F64)storage_value - old_mean) * ((F64)storage_value - mMean); -			mLastValue = storage_value; -		} - -		void addSamples(const self_t& other) -		{ -			if (other.mNumSamples) +			F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); +			mNumSamples += other.mNumSamples; +			mMean = mMean * weight + other.mMean * (1.f - weight); + +			// combine variance (and hence standard deviation) of 2 different sized sample groups using +			// the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm +			F64 n_1 = (F64)mNumSamples, +				n_2 = (F64)other.mNumSamples; +			F64 m_1 = mMean, +				m_2 = other.mMean; +			F64 v_1 = mVarianceSum / mNumSamples, +				v_2 = other.mVarianceSum / other.mNumSamples; +			if (n_1 == 0) +			{ +				mVarianceSum = other.mVarianceSum; +			} +			else if (n_2 == 0) +			{ +				// don't touch variance +				// mVarianceSum = mVarianceSum; +			} +			else  			{ -				mSum += other.mSum; -				if (other.mMin < mMin) -				{ -					mMin = other.mMin; -				} -				if (other.mMax > mMax) -				{ -					mMax = other.mMax; -				} -				F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); -				mNumSamples += other.mNumSamples; -				mMean = mMean * weight + other.mMean * (1.f - weight); - -				// combine variance (and hence standard deviation) of 2 different sized sample groups using -				// the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm -				F64 n_1 = (F64)mNumSamples, -					n_2 = (F64)other.mNumSamples; -				F64 m_1 = mMean, -					m_2 = other.mMean; -				F64 sd_1 = getStandardDeviation(), -					sd_2 = other.getStandardDeviation(); -				if (n_1 == 0) -				{ -					mVarianceSum = other.mVarianceSum; -				} -				else if (n_2 == 0) -				{ -					// don't touch variance -					// mVarianceSum = mVarianceSum; -				} -				else -				{ -					mVarianceSum =  (F64)mNumSamples -								* ((((n_1 - 1.f) * sd_1 * sd_1) -									+ ((n_2 - 1.f) * sd_2 * sd_2) -									+ (((n_1 * n_2) / (n_1 + n_2)) -										* ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) -								/ (n_1 + n_2 - 1.f)); -				} -				mLastValue = other.mLastValue; +				mVarianceSum = (F64)mNumSamples +					* ((((n_1 - 1.f) * v_1) +					+ ((n_2 - 1.f) * v_2) +					+ (((n_1 * n_2) / (n_1 + n_2)) +					* ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) +					/ (n_1 + n_2 - 1.f));  			} +			mLastValue = other.mLastValue;  		} +	} -		void reset(const self_t* other) -		{ -			mNumSamples = 0; -			mSum = 0; -			mMin = 0; -			mMax = 0; -			mMean = 0; -			mVarianceSum = 0; -			mLastValue = other ? other->mLastValue : 0; -		} +	void reset(const self_t* other) +	{ +		mNumSamples = 0; +		mSum = 0; +		mMin = 0; +		mMax = 0; +		mMean = 0; +		mVarianceSum = 0; +		mLastValue = other ? other->mLastValue : 0; +	} + +	T	getSum() const { return (T)mSum; } +	T	getMin() const { return (T)mMin; } +	T	getMax() const { return (T)mMax; } +	T	getLastValue() const { return (T)mLastValue; } +	F64	getMean() const { return mMean; } +	F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } +	U32 getSampleCount() const { return mNumSamples; } -		T	getSum() const { return (T)mSum; } -		T	getMin() const { return (T)mMin; } -		T	getMax() const { return (T)mMax; } -		T	getLastValue() const { return (T)mLastValue; } -		F64	getMean() const { return mMean; } -		F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } -		U32 getSampleCount() const { return mNumSamples; } +private: +	T	mSum, +		mMin, +		mMax, +		mLastValue; -	private: -		T	mSum, -			mMin, -			mMax, -			mLastValue; +	F64	mMean, +		mVarianceSum; -		F64	mMean, -			mVarianceSum; +	U32	mNumSamples; +}; -		U32	mNumSamples; -	}; +template<typename T> +class CountAccumulator +{ +public: +	typedef CountAccumulator<T> self_t; +	typedef T value_t; -	template<typename T> -	class CountAccumulator +	CountAccumulator() +	:	mSum(0), +		mNumSamples(0) +	{} + +	void add(T value)  	{ -	public: -		typedef CountAccumulator<T> self_t; -		typedef T value_t; +		mNumSamples++; +		mSum += value; +	} -		CountAccumulator() -		:	mSum(0), -			mNumSamples(0) -		{} +	void addSamples(const CountAccumulator<T>& other) +	{ +		mSum += other.mSum; +		mNumSamples += other.mNumSamples; +	} -		LL_FORCE_INLINE void add(T value) -		{ -			mNumSamples++; -			mSum += value; -		} +	void reset(const self_t* other) +	{ +		mNumSamples = 0; +		mSum = 0; +	} -		void addSamples(const CountAccumulator<T>& other) -		{ -			mSum += other.mSum; -			mNumSamples += other.mNumSamples; -		} +	T	getSum() const { return (T)mSum; } -		void reset(const self_t* other) -		{ -			mNumSamples = 0; -			mSum = 0; -		} +	U32 getSampleCount() const { return mNumSamples; } -		T	getSum() const { return (T)mSum; } +private: +	T	mSum; -		U32 getSampleCount() const { return mNumSamples; } +	U32	mNumSamples; +}; -	private: -		T	mSum; +class TimeBlockAccumulator +{ +public: +	typedef LLUnit<LLUnits::Seconds, F64> value_t; +	typedef TimeBlockAccumulator self_t; -		U32	mNumSamples; +	// fake class that allows us to view call count aspect of timeblock accumulator +	struct CallCountAspect  +	{ +		typedef U32 value_t;  	}; -	class TimeBlockAccumulator +	struct SelfTimeAspect  	{ -	public:  		typedef LLUnit<LLUnits::Seconds, F64> value_t; -		typedef TimeBlockAccumulator self_t; +	}; -		// fake class that allows us to view call count aspect of timeblock accumulator -		struct CallCountAspect  -		{ -			typedef U32 value_t; -		}; +	TimeBlockAccumulator(); +	void addSamples(const self_t& other); +	void reset(const self_t* other); + +	// +	// members +	// +	U64							mStartTotalTimeCounter, +								mTotalTimeCounter, +								mSelfTimeCounter; +	U32							mCalls; +	class TimeBlock*			mParent;		// last acknowledged parent of this time block +	class TimeBlock*			mLastCaller;	// used to bootstrap tree construction +	U16							mActiveCount;	// number of timers with this ID active on stack +	bool						mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame -		struct SelfTimeAspect -		{ -			typedef LLUnit<LLUnits::Seconds, F64> value_t; -		}; - -		TimeBlockAccumulator(); -		void addSamples(const self_t& other); -		void reset(const self_t* other); - -		// -		// members -		// -		U64							mChildTimeCounter, -									mTotalTimeCounter; -		U32							mCalls; -		class TimeBlock*			mParent;		// last acknowledged parent of this time block -		class TimeBlock*			mLastCaller;	// used to bootstrap tree construction -		U16							mActiveCount;	// number of timers with this ID active on stack -		bool						mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame +}; -	}; +template<> +struct MeanValueType<TraceType<TimeBlockAccumulator> > +{ +	typedef LLUnit<LLUnits::Seconds, F64> type; +}; + +template<> +class TraceType<TimeBlockAccumulator::CallCountAspect> +:	public TraceType<TimeBlockAccumulator> +{ +public: + +	TraceType(const char* name, const char* description = "") +	:	TraceType<TimeBlockAccumulator>(name, description) +	{} +}; + +template<> +struct MeanValueType<TraceType<TimeBlockAccumulator::CallCountAspect> > +{ +	typedef F64 type; +}; -	template<> -	struct MeanValueType<TraceType<TimeBlockAccumulator> > -	{ -		typedef LLUnit<LLUnits::Seconds, F64> type; -	}; -	template<> -	class TraceType<TimeBlockAccumulator::CallCountAspect> +template<> +class TraceType<TimeBlockAccumulator::SelfTimeAspect>  	:	public TraceType<TimeBlockAccumulator> -	{ -	public: -		typedef F32 mean_t; +{ +public: -		TraceType(const char* name, const char* description = "") +	TraceType(const char* name, const char* description = "")  		:	TraceType<TimeBlockAccumulator>(name, description) -		{} -	}; +	{} +}; -	template<> -	class TraceType<TimeBlockAccumulator::SelfTimeAspect> -		:	public TraceType<TimeBlockAccumulator> -	{ -	public: -		typedef F32 mean_t; +template<> +struct MeanValueType<TraceType<TimeBlockAccumulator::SelfTimeAspect> > +{ +	typedef LLUnit<LLUnits::Seconds, F64> type; +}; -		TraceType(const char* name, const char* description = "") -			:	TraceType<TimeBlockAccumulator>(name, description) -		{} -	}; -	class TimeBlock; -	class TimeBlockTreeNode -	{ -	public: -		TimeBlockTreeNode(); +class TimeBlock; +class TimeBlockTreeNode +{ +public: +	TimeBlockTreeNode(); -		void setParent(TimeBlock* parent); -		TimeBlock* getParent() { return mParent; } +	void setParent(TimeBlock* parent); +	TimeBlock* getParent() { return mParent; } -		TimeBlock*					mBlock; -		TimeBlock*					mParent;	 -		std::vector<TimeBlock*>		mChildren; -		bool						mNeedsSorting; -	}; +	TimeBlock*					mBlock; +	TimeBlock*					mParent;	 +	std::vector<TimeBlock*>		mChildren; +	bool						mNeedsSorting; +}; -	template <typename T = F64> -	class Measurement -	:	public TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > -	{ -	public: -		typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t; -		typedef TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t; +template <typename T = F64> +class MeasurementStatHandle +:	public TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > +{ +public: +	typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t; +	typedef TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t; -		Measurement(const char* name, const char* description = NULL)  -		:	trace_t(name, description) -		{} +	MeasurementStatHandle(const char* name, const char* description = NULL)  +	:	trace_t(name, description) +	{} +}; -		template<typename UNIT_T> -		void sample(UNIT_T value) -		{ -			T converted_value(value); -			trace_t::getPrimaryAccumulator()->sample(LLUnits::rawValue(converted_value)); -		} -	}; +template<typename T, typename VALUE_T> +void sample(MeasurementStatHandle<T>& measurement, VALUE_T value) +{ +	T converted_value(value); +	measurement.getPrimaryAccumulator()->sample(LLUnits::rawValue(converted_value)); +} -	template <typename T = F64> -	class Count  -	:	public TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > -	{ -	public: -		typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t; -		typedef TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t; -		Count(const char* name, const char* description = NULL)  -		:	trace_t(name) -		{} +template <typename T = F64> +class CountStatHandle +:	public TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > +{ +public: +	typedef typename LLUnits::HighestPrecisionType<T>::type_t storage_t; +	typedef TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > trace_t; + +	CountStatHandle(const char* name, const char* description = NULL)  +	:	trace_t(name) +	{} + +}; + +template<typename T, typename VALUE_T> +void add(CountStatHandle<T>& count, VALUE_T value) +{ +	T converted_value(value); +	count.getPrimaryAccumulator()->add(LLUnits::rawValue(converted_value)); +} -		template<typename UNIT_T> -		void add(UNIT_T value) -		{ -			T converted_value(value); -			trace_t::getPrimaryAccumulator()->add(LLUnits::rawValue(converted_value)); -		} -	};  struct MemStatAccumulator  { @@ -574,11 +587,11 @@ struct MemStatAccumulator  				mDeallocatedCount;  }; -class MemStat : public TraceType<MemStatAccumulator> +class MemStatHandle : public TraceType<MemStatAccumulator>  {  public:  	typedef TraceType<MemStatAccumulator> trace_t; -	MemStat(const char* name) +	MemStatHandle(const char* name)  	:	trace_t(name)  	{}  }; diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 913c4cbdad..ab8dbce2ce 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -109,9 +109,17 @@ void Recording::handleSplitTo(Recording& other)  {  	stop();  	other.restart(); +	syncTo(other); +} + +void Recording::syncTo(Recording& other) +{ +	other.mCountsFloat.write()->reset(mCountsFloat);  	other.mMeasurementsFloat.write()->reset(mMeasurementsFloat); +	other.mCounts.write()->reset(mCounts);  	other.mMeasurements.write()->reset(mMeasurements); -	//TODO: figure out how to get seamless handoff of timing stats +	other.mStackTimers.write()->reset(mStackTimers); +	other.mMemStats.write()->reset(mMemStats);  }  void Recording::makePrimary() @@ -174,12 +182,15 @@ void Recording::mergeRecording( const Recording& other)  LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) const  { -	return (F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter / (F64)LLTrace::TimeBlock::countsPerSecond(); +	const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()]; +	return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter)  +				/ (F64)LLTrace::TimeBlock::countsPerSecond();  }  LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const  { -	return ((F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter - (F64)(*mStackTimers)[stat.getIndex()].mChildTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond(); +	const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()]; +	return (F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond();  } @@ -190,12 +201,18 @@ U32 Recording::getSum(const TraceType<TimeBlockAccumulator::CallCountAspect>& st  LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat) const  { -	return (F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds); +	const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()]; + +	return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter)  +				/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds);  }  LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const  { -	return ((F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter - (F64)(*mStackTimers)[stat.getIndex()].mChildTimeCounter) / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds); +	const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()]; + +	return (F64)(accumulator.mSelfTimeCounter)  +			/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds);  }  F32 Recording::getPerSec(const TraceType<TimeBlockAccumulator::CallCountAspect>& stat) const @@ -520,7 +537,7 @@ void ExtendableRecording::splitFrom(ExtendableRecording& other)  PeriodicRecording& get_frame_recording()  { -	static LLThreadLocalPointer<PeriodicRecording> sRecording(new PeriodicRecording(64, PeriodicRecording::STARTED)); +	static LLThreadLocalPointer<PeriodicRecording> sRecording(new PeriodicRecording(200, PeriodicRecording::STARTED));  	return *sRecording;  } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 05e1577a5a..7a0266529b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -119,6 +119,7 @@ namespace LLTrace  		// gather data from recording, ignoring time relationship (for example, pulling data from slave threads)  		void mergeRecording(const Recording& other); +		// grab latest recorded data  		void update();  		// Timer accessors @@ -134,11 +135,11 @@ namespace LLTrace  		LLUnit<LLUnits::Bytes, U32> getSum(const TraceType<MemStatAccumulator>& stat) const;  		LLUnit<LLUnits::Bytes, F32> getPerSec(const TraceType<MemStatAccumulator>& stat) const; -		// Count accessors +		// CountStatHandle accessors  		F64 getSum(const TraceType<CountAccumulator<F64> >& stat) const;  		S64 getSum(const TraceType<CountAccumulator<S64> >& stat) const;  		template <typename T> -		T getSum(const Count<T>& stat) const +		T getSum(const CountStatHandle<T>& stat) const  		{  			return (T)getSum(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -146,7 +147,7 @@ namespace LLTrace  		F64 getPerSec(const TraceType<CountAccumulator<F64> >& stat) const;  		F64 getPerSec(const TraceType<CountAccumulator<S64> >& stat) const;  		template <typename T> -		T getPerSec(const Count<T>& stat) const +		T getPerSec(const CountStatHandle<T>& stat) const  		{  			return (T)getPerSec(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -155,11 +156,11 @@ namespace LLTrace  		U32 getSampleCount(const TraceType<CountAccumulator<S64> >& stat) const; -		// Measurement accessors +		// MeasurementStatHandle accessors  		F64 getSum(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		S64 getSum(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getSum(const Measurement<T>& stat) const +		T getSum(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getSum(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -167,7 +168,7 @@ namespace LLTrace  		F64 getPerSec(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		F64 getPerSec(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getPerSec(const Measurement<T>& stat) const +		T getPerSec(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getPerSec(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -175,7 +176,7 @@ namespace LLTrace  		F64 getMin(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		S64 getMin(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getMin(const Measurement<T>& stat) const +		T getMin(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getMin(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -183,7 +184,7 @@ namespace LLTrace  		F64 getMax(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		S64 getMax(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getMax(const Measurement<T>& stat) const +		T getMax(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getMax(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -191,7 +192,7 @@ namespace LLTrace  		F64 getMean(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		F64 getMean(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getMean(Measurement<T>& stat) const +		T getMean(MeasurementStatHandle<T>& stat) const  		{  			return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -199,7 +200,7 @@ namespace LLTrace  		F64 getStandardDeviation(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		F64 getStandardDeviation(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getStandardDeviation(const Measurement<T>& stat) const +		T getStandardDeviation(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -207,7 +208,7 @@ namespace LLTrace  		F64 getLastValue(const TraceType<MeasurementAccumulator<F64> >& stat) const;  		S64 getLastValue(const TraceType<MeasurementAccumulator<S64> >& stat) const;  		template <typename T> -		T getLastValue(const Measurement<T>& stat) const +		T getLastValue(const MeasurementStatHandle<T>& stat) const  		{  			return (T)getLastValue(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat));  		} @@ -217,6 +218,8 @@ namespace LLTrace  		LLUnit<LLUnits::Seconds, F64> getDuration() const { return LLUnit<LLUnits::Seconds, F64>(mElapsedSeconds); } +		void syncTo(Recording& other); +  	private:  		friend class ThreadRecorder; @@ -337,9 +340,9 @@ namespace LLTrace  		}  		template <typename T> -		typename TraceType<T>::mean_t getPeriodMean(const TraceType<T>& stat) const +		typename MeanValueType<TraceType<T> >::type getPeriodMean(const TraceType<T>& stat) const  		{ -			typename TraceType<T>::mean_t mean = 0.0; +			typename MeanValueType<TraceType<T> >::type mean = 0.0;  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				if (mRecordingPeriods[i].getDuration() > 0.f) @@ -352,9 +355,9 @@ namespace LLTrace  		}  		template <typename T> -		typename TraceType<T>::mean_t getPeriodMeanPerSec(const TraceType<T>& stat) const +		typename MeanValueType<TraceType<T> >::type getPeriodMeanPerSec(const TraceType<T>& stat) const  		{ -			typename TraceType<T>::mean_t mean = 0.0; +			typename MeanValueType<TraceType<T> >::type mean = 0.0;  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				if (mRecordingPeriods[i].getDuration() > 0.f) @@ -391,6 +394,7 @@ namespace LLTrace  	{  	public:  		void extend(); +  		Recording& getAcceptedRecording() { return mAcceptedRecording; }  		// implementation for LLStopWatchControlsMixin diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 7b493a651e..113febcca8 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -76,7 +76,7 @@ ThreadRecorder::~ThreadRecorder()  	while(mActiveRecordings.size())  	{ -		mActiveRecordings.front().mTargetRecording->stop(); +		mActiveRecordings.front()->mTargetRecording->stop();  	}  	set_thread_recorder(NULL);  	delete[] mTimeBlockTreeNodes; @@ -94,31 +94,37 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode(S32 index)  void ThreadRecorder::activate( Recording* recording )  { -	mActiveRecordings.push_front(ActiveRecording(recording)); -	mActiveRecordings.front().mBaseline.makePrimary(); +	ActiveRecording* active_recording = new ActiveRecording(recording); +	if (!mActiveRecordings.empty()) +	{ +		mActiveRecordings.front()->mBaseline.syncTo(active_recording->mBaseline); +	} +	mActiveRecordings.push_front(active_recording); + +	mActiveRecordings.front()->mBaseline.makePrimary();  } -std::list<ThreadRecorder::ActiveRecording>::iterator ThreadRecorder::update( Recording* recording ) +ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::update( Recording* recording )  { -	std::list<ActiveRecording>::iterator it, end_it; +	active_recording_list_t::iterator it, end_it;  	for (it = mActiveRecordings.begin(), end_it = mActiveRecordings.end();  		it != end_it;  		++it)  	{ -		std::list<ActiveRecording>::iterator next_it = it; +		active_recording_list_t::iterator next_it = it;  		++next_it;  		// if we have another recording further down in the stack...  		if (next_it != mActiveRecordings.end())  		{  			// ...push our gathered data down to it -			next_it->mBaseline.appendRecording(it->mBaseline); +			(*next_it)->mBaseline.appendRecording((*it)->mBaseline);  		}  		// copy accumulated measurements into result buffer and clear accumulator (mBaseline) -		it->moveBaselineToTarget(); +		(*it)->moveBaselineToTarget(); -		if (it->mTargetRecording == recording) +		if ((*it)->mTargetRecording == recording)  		{  			// found the recording, so return it  			break; @@ -142,17 +148,18 @@ AccumulatorBuffer<MemStatAccumulator>			gMemStats;  void ThreadRecorder::deactivate( Recording* recording )  { -	std::list<ActiveRecording>::iterator it = update(recording); +	active_recording_list_t::iterator it = update(recording);  	if (it != mActiveRecordings.end())  	{  		// and if we've found the recording we wanted to update -		std::list<ActiveRecording>::iterator next_it = it; +		active_recording_list_t::iterator next_it = it;  		++next_it;  		if (next_it != mActiveRecordings.end())  		{ -			next_it->mTargetRecording->makePrimary(); +			(*next_it)->mTargetRecording->makePrimary();  		} +		delete *it;  		mActiveRecordings.erase(it);  	}  } @@ -244,7 +251,7 @@ void MasterThreadRecorder::pullFromSlaveThreads()  	LLMutexLock lock(&mSlaveListMutex); -	Recording& target_recording = mActiveRecordings.front().mBaseline; +	Recording& target_recording = mActiveRecordings.front()->mBaseline;  	for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end();  		it != end_it;  		++it) diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index 337035974c..0e6c091900 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -39,13 +39,14 @@ namespace LLTrace  	{  	protected:  		struct ActiveRecording; +		typedef std::list<ActiveRecording*> active_recording_list_t;  	public:  		ThreadRecorder();  		virtual ~ThreadRecorder();  		void activate(Recording* recording); -		std::list<struct ActiveRecording>::iterator update(Recording* recording); +		active_recording_list_t::iterator update(Recording* recording);  		void deactivate(Recording* recording);  		virtual void pushToMaster() = 0; @@ -63,11 +64,12 @@ namespace LLTrace  			void moveBaselineToTarget();  		};  		Recording					mThreadRecording; -		std::list<ActiveRecording>	mActiveRecordings; -		class BlockTimer*				mRootTimer; -		TimeBlockTreeNode*				mTimeBlockTreeNodes; -		size_t							mNumTimeBlockTreeNodes; +		active_recording_list_t		mActiveRecordings; + +		class BlockTimer*			mRootTimer; +		TimeBlockTreeNode*			mTimeBlockTreeNodes; +		size_t						mNumTimeBlockTreeNodes;  	};  	class LL_COMMON_API MasterThreadRecorder : public ThreadRecorder diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index c2a31b7604..823550db5d 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -106,11 +106,12 @@ struct LLUnit  		return mValue;  	} -	template<typename NEW_UNIT_TYPE, typename NEW_STORAGE_TYPE> LLUnit<NEW_UNIT_TYPE, NEW_STORAGE_TYPE> as() +	template<typename NEW_UNIT_TYPE> LLUnit<NEW_UNIT_TYPE, STORAGE_TYPE> as()  	{ -		return LLUnit<NEW_UNIT_TYPE, NEW_STORAGE_TYPE>(*this); +		return LLUnit<NEW_UNIT_TYPE, STORAGE_TYPE>(*this);  	} +  	void operator += (storage_t value)  	{  		mValue += value; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index f3452ce86a..f06547ed7d 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -50,7 +50,7 @@ LLMutex* LLImage::sMutex = NULL;  bool LLImage::sUseNewByteRange = false;  S32  LLImage::sMinimalReverseByteRangePercent = 75;  LLPrivateMemoryPool* LLImageBase::sPrivatePoolp = NULL ; -LLTrace::MemStat	LLImageBase::sMemStat("LLImage"); +LLTrace::MemStatHandle	LLImageBase::sMemStat("LLImage");  //static  void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent) diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 6eafcf1bf7..5487bc6370 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -165,7 +165,7 @@ public:  	static void destroyPrivatePool() ;  	static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;} -	static LLTrace::MemStat sMemStat; +	static LLTrace::MemStatHandle sMemStat;  private:  	U8 *mData; diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 328d15b4bc..430c9503ac 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -55,7 +55,7 @@  LLAssetStorage *gAssetStorage = NULL;  LLMetrics *LLAssetStorage::metric_recipient = NULL; -static LLTrace::Count<> sFailedDownloadCount("faileddownloads", "Number of times LLAssetStorage::getAssetData() has failed"); +static LLTrace::CountStatHandle<> sFailedDownloadCount("faileddownloads", "Number of times LLAssetStorage::getAssetData() has failed");  const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010")); @@ -454,7 +454,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL  		if (callback)  		{ -			sFailedDownloadCount.add(1); +			add(sFailedDownloadCount, 1);  			callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_NONE);  		}  		return; @@ -465,7 +465,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL  		// Special case early out for NULL uuid and for shutting down  		if (callback)  		{ -			sFailedDownloadCount.add(1); +			add(sFailedDownloadCount, 1);  			callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);  		}  		return; @@ -578,7 +578,7 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at  		llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;  		if (callback)  		{ -			sFailedDownloadCount.add(1); +			add(sFailedDownloadCount, 1);  			callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);  		}  	} @@ -658,7 +658,7 @@ void LLAssetStorage::downloadCompleteCallback(  		{  			if (result != LL_ERR_NOERR)  			{ -				sFailedDownloadCount.add(1); +				add(sFailedDownloadCount, 1);  			}  			tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);  		} @@ -680,7 +680,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen  		// Special case early out for NULL uuid  		if (callback)  		{ -			sFailedDownloadCount.add(1); +			add(sFailedDownloadCount, 1);  			callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);  		}  		return; @@ -753,7 +753,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen  			llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;  			if (callback)  			{ -				sFailedDownloadCount.add(1); +				add(sFailedDownloadCount, 1);  				callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);  			}  		} @@ -798,7 +798,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(  	if (result != LL_ERR_NOERR)  	{ -		sFailedDownloadCount.add(1); +		add(sFailedDownloadCount, 1);  	}  	req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status);  } @@ -900,7 +900,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age  			llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;  			if (callback)  			{ -				sFailedDownloadCount.add(1); +				add(sFailedDownloadCount, 1);  				callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);  			}  		} @@ -945,7 +945,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(  	if (result != LL_ERR_NOERR)  	{ -		sFailedDownloadCount.add(1); +		add(sFailedDownloadCount, 1);  	}  	req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status);  } @@ -1259,7 +1259,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re  		}  		if (req->mDownCallback)  		{ -			sFailedDownloadCount.add(1); +			add(sFailedDownloadCount, 1);  			req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED);  		}  		if (req->mInfoCallback) @@ -1388,7 +1388,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss  	if (status != LL_ERR_NOERR)  	{ -		sFailedDownloadCount.add(1); +		add(sFailedDownloadCount, 1);  	}  	legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status);  	delete legacy; diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 1bc9a9fc67..954f615210 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -45,10 +45,10 @@ LLStatBar::LLStatBar(const Params& p)  	  mUnitLabel(p.unit_label),  	  mMinBar(p.bar_min),  	  mMaxBar(p.bar_max), -	  mCountFloatp(LLTrace::Count<>::getInstance(p.stat)), -	  mCountIntp(LLTrace::Count<S64>::getInstance(p.stat)), -	  mMeasurementFloatp(LLTrace::Measurement<>::getInstance(p.stat)), -	  mMeasurementIntp(LLTrace::Measurement<S64>::getInstance(p.stat)), +	  mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)), +	  mCountIntp(LLTrace::CountStatHandle<S64>::getInstance(p.stat)), +	  mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)), +	  mMeasurementIntp(LLTrace::MeasurementStatHandle<S64>::getInstance(p.stat)),  	  mTickSpacing(p.tick_spacing),  	  mLabelSpacing(p.label_spacing),  	  mPrecision(p.precision), @@ -336,10 +336,10 @@ void LLStatBar::draw()  void LLStatBar::setStat(const std::string& stat_name)  { -	mCountFloatp = LLTrace::Count<>::getInstance(stat_name); -	mCountIntp = LLTrace::Count<S64>::getInstance(stat_name); -	mMeasurementFloatp = LLTrace::Measurement<>::getInstance(stat_name); -	mMeasurementIntp = LLTrace::Measurement<S64>::getInstance(stat_name); +	mCountFloatp = LLTrace::CountStatHandle<>::getInstance(stat_name); +	mCountIntp = LLTrace::CountStatHandle<S64>::getInstance(stat_name); +	mMeasurementFloatp = LLTrace::MeasurementStatHandle<>::getInstance(stat_name); +	mMeasurementIntp = LLTrace::MeasurementStatHandle<S64>::getInstance(stat_name);  } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 74e966560e..680b6ed16d 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -47,7 +47,7 @@  const F32	CURSOR_FLASH_DELAY = 1.0f;  // in seconds  const S32	CURSOR_THICKNESS = 2; -LLTrace::MemStat	LLTextSegment::sMemStat("LLTextSegment"); +LLTrace::MemStatHandle	LLTextSegment::sMemStat("LLTextSegment");  LLTextBase::line_info::line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num)   :	mDocIndexStart(index_start),  diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 7d791ec75a..2ce15d891a 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -99,7 +99,7 @@ public:  	S32						getEnd() const						{ return mEnd; }  	void					setEnd( S32 end )					{ mEnd = end; } -	static LLTrace::MemStat sMemStat; +	static LLTrace::MemStatHandle sMemStat;  protected:  	S32				mStart; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6a87977718..b9d935847b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1147,6 +1147,8 @@ void gl_rect_2d_simple( S32 width, S32 height )  	gGL.end();  } +static LLFastTimer::DeclareTimer FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); +  void gl_segmented_rect_2d_tex(const S32 left,   							  const S32 top,   							  const S32 right,  @@ -1156,6 +1158,7 @@ void gl_segmented_rect_2d_tex(const S32 left,  							  const S32 border_size,   							  const U32 edges)  { +	LLFastTimer _(FTM_RENDER_SEGMENTED_RECT);  	S32 width = llabs(right - left);  	S32 height = llabs(top - bottom); @@ -1306,10 +1309,7 @@ void gl_segmented_rect_2d_tex(const S32 left,  }  //FIXME: rewrite to use scissor? -void gl_segmented_rect_2d_fragment_tex(const S32 left,  -									   const S32 top,  -									   const S32 right,  -									   const S32 bottom,  +void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,   									   const S32 texture_width,   									   const S32 texture_height,   									   const S32 border_size,  @@ -1317,6 +1317,11 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,  									   const F32 end_fragment,   									   const U32 edges)  { +	LLFastTimer _(FTM_RENDER_SEGMENTED_RECT); +	const S32 left = rect.mLeft; +	const S32 right = rect.mRight; +	const S32 top = rect.mTop; +	const S32 bottom = rect.mBottom;  	S32 width = llabs(right - left);  	S32 height = llabs(top - bottom); @@ -1354,9 +1359,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,  	{  		if (start_fragment < middle_start)  		{ -			u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX]; +			u_min = (start_fragment / middle_start)			* border_uv_scale.mV[VX];  			u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX]; -			x_min = (start_fragment / middle_start) * border_width_left; +			x_min = (start_fragment / middle_start)			* border_width_left;  			x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left;  			// draw bottom left @@ -1446,10 +1451,10 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,  		if (end_fragment > middle_end)  		{ -			u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX]; -			u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]; -			x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right); -			x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); +			u_min = 1.f			- ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]); +			u_max = 1.f			- ((1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]); +			x_min = width_vec	- ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_width_right); +			x_max = width_vec	- ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);  			// draw bottom right  			gGL.texCoord2f(u_min, 0.f); @@ -1500,6 +1505,7 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo  							  const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec,  							  const U32 edges)  { +	LLFastTimer _(FTM_RENDER_SEGMENTED_RECT);  	LLVector3 left_border_width = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? border_width : LLVector3::zero;  	LLVector3 right_border_width = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? border_width : LLVector3::zero; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 90a4617c4e..dfb9fa60c9 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -128,7 +128,7 @@ typedef enum e_rounded_edge  void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); +void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);  void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec, U32 edges = ROUNDED_RECT_ALL);  void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 47bf410af6..587953477d 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -67,7 +67,7 @@ LLView* LLView::sPreviewClickedElement = NULL;  BOOL	LLView::sDrawPreviewHighlights = FALSE;  S32		LLView::sLastLeftXML = S32_MIN;  S32		LLView::sLastBottomXML = S32_MIN; -LLTrace::MemStat	LLView::sMemStat("LLView"); +LLTrace::MemStatHandle	LLView::sMemStat("LLView");  std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack;  LLView::DrilldownFunc LLView::sDrilldown = diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 256f86c00d..e18cfff8e5 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -673,7 +673,7 @@ public:  	static S32 sLastLeftXML;  	static S32 sLastBottomXML;  	static BOOL sForceReshape; -	static LLTrace::MemStat sMemStat; +	static LLTrace::MemStatHandle sMemStat;  };  class LLCompareByTabOrder diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 1bd09e8086..901260bec8 100644 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -35,7 +35,7 @@  // external library headers  // other Linden headers -LLTrace::MemStat	LLViewModel::sMemStat("LLViewModel"); +LLTrace::MemStatHandle	LLViewModel::sMemStat("LLViewModel");  ///  LLViewModel::LLViewModel() diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index 214780393b..2c016d2560 100644 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -83,7 +83,7 @@ public:  	//       void setDirty() { mDirty = true; } -	static LLTrace::MemStat sMemStat; +	static LLTrace::MemStatHandle sMemStat;  protected:      LLSD mValue; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 24c9da8e17..4e60127ef3 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -752,7 +752,7 @@ void LLAgent::setFlying(BOOL fly)  		}  		if( !was_flying )  		{ -			LLStatViewer::FLY.add(1); +			add(LLStatViewer::FLY, 1);  		}  		setControlFlags(AGENT_CONTROL_FLY);  	} @@ -3814,7 +3814,7 @@ bool LLAgent::teleportCore(bool is_local)  	gAgentCamera.resetView(FALSE);  	// local logic -	LLStatViewer::TELEPORT.add(1); +	add(LLStatViewer::TELEPORT, 1);  	if (is_local)  	{  		gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL ); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3d7770c765..c00fddbb24 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4865,7 +4865,7 @@ void LLAppViewer::idleNetwork()  			gPrintMessagesThisFrame = FALSE;  		}  	} -	LLStatViewer::NUM_NEW_OBJECTS.sample(gObjectList.mNumNewObjects); +	sample(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects);  	// Retransmit unacknowledged packets.  	gXferManager->retransmitUnackedPackets(); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ba970671af..9c3d9f4d34 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -59,7 +59,7 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f;  static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound");  extern bool gShiftFrame; -LLTrace::MemStat	LLDrawable::sMemStat("LLDrawable"); +LLTrace::MemStatHandle	LLDrawable::sMemStat("LLDrawable");  //////////////////////// diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 161f550bb6..3691bbf71b 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -292,7 +292,7 @@ public:  	F32				mDistanceWRTCamera;  	static F32 sCurPixelAngle; //current pixels per radian -	static LLTrace::MemStat sMemStat; +	static LLTrace::MemStatHandle sMemStat;  private:  	typedef std::vector<LLFace*> face_list_t; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 7858378f00..3893b0e772 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -58,9 +58,7 @@ using namespace LLTrace;  static const S32 MAX_VISIBLE_HISTORY = 10;  static const S32 LINE_GRAPH_HEIGHT = 240; - -const S32 FTV_MAX_DEPTH = 8; -const S32 HISTORY_NUM = 300; +static const S32 MIN_BAR_HEIGHT = 3;  std::vector<TimeBlock*> ft_display_idx; // line of table entry for display purposes (for collapse) @@ -107,7 +105,7 @@ LLFastTimerView::LLFastTimerView(const LLSD& key)  	mRecording(&get_frame_recording()),  	mPauseHistory(false)  { -	mBarRects = new std::vector<LLRect>[MAX_VISIBLE_HISTORY + 1]; +	mTimerBars = new std::vector<TimerBar>[MAX_VISIBLE_HISTORY + 1];  }  LLFastTimerView::~LLFastTimerView() @@ -117,29 +115,37 @@ LLFastTimerView::~LLFastTimerView()  		delete mRecording;  	}  	mRecording = NULL; -	delete [] mBarRects; +	delete [] mTimerBars;  }  void LLFastTimerView::onPause()  { -	mPauseHistory = !mPauseHistory; +	setPauseState(!mPauseHistory); +} + +void LLFastTimerView::setPauseState(bool pause_state) +{ +	if (pause_state == mPauseHistory) return; +  	// reset scroll to bottom when unpausing -	if (!mPauseHistory) -	{ -		mRecording = new PeriodicRecording(get_frame_recording()); -		mScrollIndex = 0; -		getChild<LLButton>("pause_btn")->setLabel(getString("pause")); -	} -	else +	if (!pause_state)  	{  		if (mRecording != &get_frame_recording())  		{  			delete mRecording;  		}  		mRecording = &get_frame_recording(); +		getChild<LLButton>("pause_btn")->setLabel(getString("pause")); +	} +	else +	{ +		mRecording = new PeriodicRecording(get_frame_recording()); +		mScrollIndex = 0;  		getChild<LLButton>("pause_btn")->setLabel(getString("run"));  	} + +	mPauseHistory = pause_state;  }  BOOL LLFastTimerView::postBuild() @@ -177,7 +183,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)  TimeBlock* LLFastTimerView::getLegendID(S32 y)  { -	S32 idx = (getRect().getHeight() - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 5; +	S32 idx = (mBarRect.mTop - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 1;  	if (idx >= 0 && idx < (S32)ft_display_idx.size())  	{ @@ -256,7 +262,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  	if (hasMouseCapture())  	{  		F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); -		mScrollIndex = llround( lerp * (F32)(HISTORY_NUM - MAX_VISIBLE_HISTORY)); +		mScrollIndex = llround( lerp * (F32)(mRecording->getNumPeriods() - MAX_VISIBLE_HISTORY));  		mScrollIndex = llclamp(	mScrollIndex, 0, mRecording->getNumPeriods());  		return TRUE;  	} @@ -265,8 +271,9 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  	if(mPauseHistory && mBarRect.pointInRect(x, y))  	{ -		mHoverBarIndex = llmin(mRecording->getNumPeriods() - 1,  -								MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight())); +		mHoverBarIndex = llmin((mBarRect.mTop - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1, +								mRecording->getNumPeriods() - 1, +								MAX_VISIBLE_HISTORY);  		if (mHoverBarIndex == 0)  		{  			return TRUE; @@ -282,7 +289,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  			++it, ++i)  		{  			// is mouse over bar for this timer? -			if (mBarRects[mHoverBarIndex][i].pointInRect(x, y)) +			if (mTimerBars[mHoverBarIndex][i].mVisibleRect.pointInRect(x, y))  			{  				mHoverID = (*it);  				if (mHoverTimer != *it) @@ -294,7 +301,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  					mHoverTimer = (*it);  				} -				mToolTipRect = mBarRects[mHoverBarIndex][i]; +				mToolTipRect = mTimerBars[mHoverBarIndex][i].mVisibleRect;  			}  			if ((*it)->getCollapsed()) @@ -318,17 +325,15 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  static std::string get_tooltip(TimeBlock& timer, S32 history_index, PeriodicRecording& frame_recording)  { -	F64 ms_multiplier = 1000.0 / (F64)TimeBlock::countsPerSecond(); -  	std::string tooltip; -	if (history_index < 0) +	if (history_index == 0)  	{  		// by default, show average number of call -		tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(frame_recording.getPeriodMean(timer) * ms_multiplier).value(), (S32)frame_recording.getPeriodMean(timer.callCount())); +		tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)LLUnit<LLUnits::Milliseconds, F64>(frame_recording.getPeriodMean(timer)).value(), (S32)frame_recording.getPeriodMean(timer.callCount()));  	}  	else  	{ -		tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(frame_recording.getPrevRecordingPeriod(history_index).getSum(timer) * ms_multiplier).value(), (S32)frame_recording.getPrevRecordingPeriod(history_index).getSum(timer.callCount())); +		tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)LLUnit<LLUnits::Milliseconds, F64>(frame_recording.getPrevRecordingPeriod(history_index).getSum(timer)).value(), (S32)frame_recording.getPrevRecordingPeriod(history_index).getSum(timer.callCount()));  	}  	return tooltip;  } @@ -343,7 +348,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  			LLRect screen_rect;  			localRectToScreen(mToolTipRect, &screen_rect); -			std::string tooltip = get_tooltip(*mHoverTimer, mScrollIndex + mHoverBarIndex, *mRecording); +			std::string tooltip = get_tooltip(*mHoverTimer, mHoverBarIndex > 0 ? mScrollIndex + mHoverBarIndex : 0, *mRecording);  			LLToolTipMgr::instance().show(LLToolTip::Params()  				.message(tooltip) @@ -361,7 +366,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  			TimeBlock* idp = getLegendID(y);  			if (idp)  			{ -				LLToolTipMgr::instance().show(get_tooltip(*idp, -1,  *mRecording)); +				LLToolTipMgr::instance().show(get_tooltip(*idp, 0, *mRecording));  				return TRUE;  			} @@ -373,10 +378,10 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)  { -	mPauseHistory = true; +	setPauseState(true);  	mScrollIndex = llclamp(	mScrollIndex + clicks,  							0, -							llmin(mRecording->getNumPeriods(), (S32)HISTORY_NUM - MAX_VISIBLE_HISTORY)); +							llmin(mRecording->getNumPeriods(), (S32)mRecording->getNumPeriods() - MAX_VISIBLE_HISTORY));  	return TRUE;  } @@ -397,7 +402,7 @@ void LLFastTimerView::draw()  	gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f));  	S32 y = drawHelp(getRect().getHeight() - MARGIN); -	drawLegend(y - ((S32)LLFontGL::getFontMonospace()->getLineHeight() - 2)); +	drawLegend(y - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 2));  	// update rectangle that includes timer bars  	const S32 LEGEND_WIDTH = 220; @@ -999,8 +1004,11 @@ void LLFastTimerView::printLineStats()  	}  } +static LLFastTimer::DeclareTimer FTM_DRAW_LINE_GRAPH("Draw line graph"); +  void LLFastTimerView::drawLineGraph()  { +	LLFastTimer _(FTM_DRAW_LINE_GRAPH);  	//draw line graph history  	S32 x = mBarRect.mLeft;  	S32 y = LINE_GRAPH_HEIGHT; @@ -1019,7 +1027,7 @@ void LLFastTimerView::drawLineGraph()  	else if (mDisplayHz)  		axis_label = llformat("%d Hz", (int)(1.f / max_time.value()));  	else -		axis_label = llformat("%4.2f ms", max_time.value()); +		axis_label = llformat("%4.2f ms", LLUnit<LLUnits::Milliseconds, F32>(max_time).value());  	x = mGraphRect.mRight - LLFontGL::getFontMonospace()->getWidth(axis_label)-5;  	y = mGraphRect.mTop - LLFontGL::getFontMonospace()->getLineHeight(); @@ -1029,10 +1037,10 @@ void LLFastTimerView::drawLineGraph()  	//highlight visible range  	{ -		S32 first_frame = HISTORY_NUM - mScrollIndex; +		S32 first_frame = mRecording->getNumPeriods() - mScrollIndex;  		S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; -		F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(HISTORY_NUM-1); +		F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording->getNumPeriods()-1);  		F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame;  		F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; @@ -1040,9 +1048,9 @@ void LLFastTimerView::drawLineGraph()  		gGL.color4f(0.5f,0.5f,0.5f,0.3f);  		gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom); -		if (mHoverBarIndex >= 0) +		if (mHoverBarIndex > 0)  		{ -			S32 bar_frame = first_frame - mHoverBarIndex; +			S32 bar_frame = first_frame - mHoverBarIndex - 1;  			F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame;  			gGL.color4f(0.5f,0.5f,0.5f,1); @@ -1074,7 +1082,7 @@ void LLFastTimerView::drawLineGraph()  		F32 alpha = 1.f;  		if (mHoverID != NULL && -			idp != mHoverID) +			mHoverID != idp)  		{	//fade out non-highlighted timers  			if (idp->getParent() != mHoverID)  			{ @@ -1097,7 +1105,7 @@ void LLFastTimerView::drawLineGraph()  				cur_max = llmax(cur_max, time);  				cur_max_calls = llmax(cur_max_calls, calls);  			} -			F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(HISTORY_NUM-1); +			F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(mRecording->getNumPeriods()-1);  			F32 y = mDisplayHz   				? mGraphRect.mBottom + (1.f / time.value()) * ((F32) mGraphRect.getHeight() / (1.f / max_time.value()))  				: mGraphRect.mBottom + time / max_time * (F32)mGraphRect.getHeight(); @@ -1118,7 +1126,7 @@ void LLFastTimerView::drawLineGraph()  			it.skipDescendants();  		}  	} - +	  	//interpolate towards new maximum  	max_time = lerp(max_time.value(), cur_max.value(), LLCriticalDamp::getInterpolant(0.1f));  	if (max_time - cur_max <= 1 ||  cur_max - max_time  <= 1) @@ -1281,41 +1289,40 @@ void LLFastTimerView::generateUniqueColors()  S32 LLFastTimerView::drawHelp( S32 y )  {  	// Draw some help -	{ -		const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - -		char modedesc[][32] = { -			"2 x Average ", -			"Max         ", -			"Recent Max  ", -			"100 ms      " -		}; -		char centerdesc[][32] = { -			"Left      ", -			"Centered  ", -			"Ordered   " -		}; - -		std::string text; -		text = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]); -		LLFontGL::getFontMonospace()->renderUTF8(text, 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - -		y -= (texth + 2); -		text = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]); -		LLFontGL::getFontMonospace()->renderUTF8(text, 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); -		y -= (texth + 2); - -		LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"), -			0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); -		y -= (texth + 2); -	}	return y; +	const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight(); + +	char modedesc[][32] = { +		"2 x Average ", +		"Max         ", +		"Recent Max  ", +		"100 ms      " +	}; +	char centerdesc[][32] = { +		"Left      ", +		"Centered  ", +		"Ordered   " +	}; + +	std::string text; +	text = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]); +	LLFontGL::getFontMonospace()->renderUTF8(text, 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + +	y -= (texth + 2); +	text = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]); +	LLFontGL::getFontMonospace()->renderUTF8(text, 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); +	y -= (texth + 2); + +	LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"), +		0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); +	y -= (texth + 2); +	return y;  } -void LLFastTimerView::drawTicks( LLUnit<LLUnits::Seconds, F64> total_time ) +void LLFastTimerView::drawTicks()  {  	// Draw MS ticks  	{ -		LLUnit<LLUnits::Milliseconds, U32> ms = total_time; +		LLUnit<LLUnits::Milliseconds, U32> ms = mTotalTimeDisplay;  		std::string tick_label;  		S32 x;  		S32 barw = mBarRect.getWidth(); @@ -1377,187 +1384,216 @@ void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32  	}  } -LLUnit<LLUnits::Seconds, F64> LLFastTimerView::getTotalTime() +void LLFastTimerView::updateTotalTime()  { -	LLUnit<LLUnits::Seconds, F64> total_time;  	switch(mDisplayMode)  	{  	case 0: -		total_time = mRecording->getPeriodMean(FTM_FRAME)*2; +		mTotalTimeDisplay = mRecording->getPeriodMean(FTM_FRAME)*2;  		break;  	case 1: -		total_time = mAllTimeMax; +		mTotalTimeDisplay = mAllTimeMax;  		break;  	case 2:  		// Calculate the max total ticks for the current history -		total_time = mRecording->getPeriodMax(FTM_FRAME); +		mTotalTimeDisplay = mRecording->getPeriodMax(FTM_FRAME);  		break;  	default: -		total_time = LLUnit<LLUnits::Milliseconds, F32>(100); +		mTotalTimeDisplay = LLUnit<LLUnits::Milliseconds, F32>(100);  		break;  	} -	return total_time; + +	mTotalTimeDisplay = LLUnit<LLUnits::Milliseconds, F32>(llceil(mTotalTimeDisplay.as<LLUnits::Milliseconds>().value() / 20.f) * 20.f);  }  void LLFastTimerView::drawBars()  { -	LLUnit<LLUnits::Seconds, F64> total_time = getTotalTime(); -	if (total_time <= 0.0) return; +	updateTotalTime(); +	if (mTotalTimeDisplay <= 0.0) return; -	LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("Rounded_Square");  	LLLocalClipRect clip(mBarRect); -	S32 bar_height = (mBarRect.mTop - MARGIN - LINE_GRAPH_HEIGHT) / (MAX_VISIBLE_HISTORY + 2); +	S32 bar_height = mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2);  	S32 vpad = llmax(1, bar_height / 4); // spacing between bars  	bar_height -= vpad; -	drawTicks(total_time); +	drawTicks();  	S32 y = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);  	drawBorders(y, mBarRect.mLeft, bar_height, vpad);  	// Draw bars for each history entry  	// Special: -1 = show running average -	gGL.getTexUnit(0)->bind(box_imagep->getImage()); -	const S32 histmax = llmin(mRecording->getNumPeriods()+1, MAX_VISIBLE_HISTORY); +	LLPointer<LLUIImage> bar_image = LLUI::getUIImage("Rounded_Square"); +	gGL.getTexUnit(0)->bind(bar_image->getImage()); +	const S32 histmax = llmin(mRecording->getNumPeriods(), MAX_VISIBLE_HISTORY) + 1; -	for (S32 j = -1; j < histmax && y > LINE_GRAPH_HEIGHT; j++) +	for (S32 bar_index = 0; bar_index < histmax && y > LINE_GRAPH_HEIGHT; bar_index++)  	{ -		mBarRects[llmax(j, 0)].clear(); -		int sublevel_dx[FTV_MAX_DEPTH]; -		int sublevel_left[FTV_MAX_DEPTH]; -		int sublevel_right[FTV_MAX_DEPTH]; -		S32 tidx = (j >= 0) -			? j + 1 + mScrollIndex +		S32 history_index = (bar_index > 0) +			? bar_index + mScrollIndex  			: -1; +		mTimerBars[bar_index].clear(); +		mTimerBars[bar_index].reserve(LLInstanceTracker<LLTrace::TimeBlock>::instanceCount()); + +		updateTimerBarWidths(&FTM_FRAME, mTimerBars[bar_index], history_index, true); +		LLRect frame_bar_rect(mBarRect.mLeft, y, mBarRect.mLeft + mTimerBars[bar_index][0].mWidth, y-bar_height); +		mTimerBars[bar_index][0].mVisibleRect = frame_bar_rect; +		updateTimerBarFractions(&FTM_FRAME, 0, mTimerBars[bar_index]); +		drawBar(&FTM_FRAME, frame_bar_rect, mTimerBars[bar_index], 0, bar_image); +				 +		y -= (bar_height + vpad); +		if (bar_index == 0) +			y -= bar_height; +	} +	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +} -		// draw the bars for each stat -		std::vector<S32> xpos; -		S32 deltax = 0; -		xpos.push_back(mBarRect.mLeft); +static LLFastTimer::DeclareTimer FTM_UPDATE_TIMER_BAR_WIDTHS("Update timer bar widths"); -		TimeBlock* prev_id = NULL; +S32 LLFastTimerView::updateTimerBarWidths(LLTrace::TimeBlock* time_block, std::vector<TimerBar>& bars, S32 history_index, bool visible) +{ +	LLFastTimer _(FTM_UPDATE_TIMER_BAR_WIDTHS); +	F32 self_time_frame_fraction = history_index == -1 +		? (mRecording->getPeriodMean(time_block->selfTime()) / mTotalTimeDisplay)  +		: (mRecording->getPrevRecordingPeriod(history_index).getSum(time_block->selfTime()) / mTotalTimeDisplay); -		S32 i = 0; -		for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -			it != end_timer_tree(); -			++it, ++i) -		{ -			TimeBlock* idp = (*it); -			F32 frac = tidx == -1 -				? (mRecording->getPeriodMean(*idp) / total_time)  -				: (mRecording->getPrevRecordingPeriod(tidx).getSum(*idp).value() / total_time.value()); +	S32 self_time_width = llround(self_time_frame_fraction * (F32)mBarRect.getWidth()); +	S32 full_width = self_time_width; -			S32 dx = llround(frac * (F32)mBarRect.getWidth()); -			S32 prev_delta_x = deltax; -			deltax = dx; +	bool children_visible = visible; -			const int level = get_depth(idp) - 1; -			while ((S32)xpos.size() > level + 1) -			{ -				xpos.pop_back(); -			} +	// reserve a spot for this bar to be rendered before its children +	// even though we don't know its size yet +	S32 bar_rect_index = bars.size(); +	if (visible) +	{ +		bars.push_back(TimerBar()); +	} -			LLRect bar_rect; -			bar_rect.setLeftTopAndSize(xpos.back(), y, dx, bar_height); -			mBarRects[llmax(j, 0)].push_back(bar_rect); +	if (time_block->getCollapsed()) +	{ +		children_visible = false; +	} +	for (TimeBlock::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it) +	{ +		full_width += updateTimerBarWidths(*it, bars, history_index, children_visible); +	} -			if (level == 0) -			{ -				sublevel_left[level] = mBarRect.mLeft; -				sublevel_dx[level] = dx; -				sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; -			} -			else if (prev_id && get_depth(prev_id) < get_depth(idp)) -			{ -				F64 sublevelticks = 0; +	if (visible) +	{ +		TimerBar& timer_bar = bars[bar_rect_index]; -				for (TimeBlock::child_const_iter it = prev_id->beginChildren(); -					it != prev_id->endChildren(); -					++it) -				{ -					sublevelticks += (tidx == -1) -						? mRecording->getPeriodMean(**it).value() -						: mRecording->getPrevRecordingPeriod(tidx).getSum(**it).value(); -				} +		timer_bar.mWidth = full_width; +		timer_bar.mSelfWidth = self_time_width; +		timer_bar.mColor = sTimerColors[time_block]; + +		BOOL is_child_of_hover_item = (time_block == mHoverID); +		TimeBlock* next_parent = time_block->getParent(); +		while(!is_child_of_hover_item && next_parent) +		{ +			is_child_of_hover_item = (mHoverID == next_parent); +			if (next_parent->getParent() == next_parent) break; +			next_parent = next_parent->getParent(); +		} -				F32 subfrac = (F32)sublevelticks / (F32)total_time.value(); -				sublevel_dx[level] = (int)(subfrac * (F32)mBarRect.getWidth() + .5f); +		if (mHoverID != NULL  +			&& time_block != mHoverID  +			&& !is_child_of_hover_item) +		{ +			timer_bar.mColor = lerp(timer_bar.mColor, LLColor4::grey, 0.8f); +		} +	} +	return full_width; +} -				if (mDisplayCenter == ALIGN_CENTER) -				{ -					bar_rect.mLeft += (prev_delta_x - sublevel_dx[level])/2; -				} -				else if (mDisplayCenter == ALIGN_RIGHT) -				{ -					bar_rect.mLeft += (prev_delta_x - sublevel_dx[level]); -				} +static LLFastTimer::DeclareTimer FTM_UPDATE_TIMER_BAR_FRACTIONS("Update timer bar fractions"); -				sublevel_left[level] = bar_rect.mLeft; -				sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; -			}				 +S32 LLFastTimerView::updateTimerBarFractions(LLTrace::TimeBlock* time_block, S32 timer_bar_index, std::vector<TimerBar>& bars) +{ +	LLFastTimer _(FTM_UPDATE_TIMER_BAR_FRACTIONS); +	TimerBar& timer_bar = bars[timer_bar_index]; +	S32 child_time_width = timer_bar.mWidth - timer_bar.mSelfWidth; +	LLRect children_rect = timer_bar.mVisibleRect; -			xpos.back() = bar_rect.mRight; -			xpos.push_back(bar_rect.mLeft); +	if (mDisplayCenter == ALIGN_CENTER) +	{ +		children_rect.mLeft += timer_bar.mSelfWidth / 2; +	} +	else if (mDisplayCenter == ALIGN_RIGHT) +	{ +		children_rect.mLeft += timer_bar.mSelfWidth; +	} +	children_rect.mRight = children_rect.mLeft + timer_bar.mWidth - timer_bar.mSelfWidth; -			if (bar_rect.getWidth() > 0) -			{ -				LLColor4 color = sTimerColors[idp]; -				S32 scale_offset = 0; +	if (children_rect.getHeight() > MIN_BAR_HEIGHT) +	{ +		children_rect.mTop -= 1; +		children_rect.mBottom += 1; +	} +	timer_bar.mChildrenRect = children_rect; -				BOOL is_child_of_hover_item = (idp == mHoverID); -				TimeBlock* next_parent = idp->getParent(); -				while(!is_child_of_hover_item && next_parent) -				{ -					is_child_of_hover_item = (mHoverID == next_parent); -					if (next_parent->getParent() == next_parent) break; -					next_parent = next_parent->getParent(); -				} +	//now loop through children and figure out portion of bar image covered by each bar, now that we know the +	//sum of all children +	if (!time_block->getCollapsed()) +	{ +		F32 bar_fraction_start = 0.f; +		for (TimeBlock::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren();  +			it != end_it;  +			++it) +		{ +			timer_bar_index++; -				if (idp == mHoverID) -				{ -					scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); -					//color = lerp(color, LLColor4::black, -0.4f); -				} -				else if (mHoverID != NULL && !is_child_of_hover_item) -				{ -					color = lerp(color, LLColor4::grey, 0.8f); -				} +			TimerBar& child_timer_bar = bars[timer_bar_index]; +			TimeBlock* child_time_block = *it; -				gGL.color4fv(color.mV); -				F32 start_fragment = llclamp((F32)(bar_rect.mLeft - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); -				F32 end_fragment = llclamp((F32)(bar_rect.mRight - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); -				gl_segmented_rect_2d_fragment_tex( -					sublevel_left[level],  -					bar_rect.mTop - level + scale_offset,  -					sublevel_right[level],  -					bar_rect.mBottom + level - scale_offset,  -					box_imagep->getTextureWidth(), box_imagep->getTextureHeight(),  -					16,  -					start_fragment, end_fragment); -			} +			child_timer_bar.mStartFraction = bar_fraction_start; +			child_timer_bar.mEndFraction = child_time_width > 0 +				? bar_fraction_start + (F32)child_timer_bar.mWidth / child_time_width +				: 1.f; +			child_timer_bar.mVisibleRect.set(children_rect.mLeft + llround(child_timer_bar.mStartFraction * children_rect.getWidth()),  +				children_rect.mTop,  +				children_rect.mLeft + llround(child_timer_bar.mEndFraction * children_rect.getWidth()),  +				children_rect.mBottom); -			if ((*it)->getCollapsed()) -			{ -				it.skipDescendants(); -			} +			timer_bar_index = updateTimerBarFractions(child_time_block, timer_bar_index, bars); -			prev_id = idp; +			bar_fraction_start = child_timer_bar.mEndFraction;  		} -		y -= (bar_height + vpad); -		if (j < 0) -			y -= bar_height;  	} -	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +	return timer_bar_index;  } +S32 LLFastTimerView::drawBar(LLTrace::TimeBlock* time_block, LLRect bar_rect, std::vector<TimerBar>& bars, S32 bar_index, LLPointer<LLUIImage>& bar_image) +{ +	TimerBar& timer_bar = bars[bar_index]; +	// animate scale of bar when hovering over that particular timer +	if (bar_rect.getWidth() > 0) +	{ +		LLRect render_rect(bar_rect); +		S32 scale_offset = 0; +		if (time_block == mHoverID) +		{ +			scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); +			render_rect.mTop += scale_offset; +			render_rect.mBottom -= scale_offset; +		} +		gGL.color4fv(timer_bar.mColor.mV); +		gl_segmented_rect_2d_fragment_tex(render_rect, +			bar_image->getTextureWidth(), bar_image->getTextureHeight(),  +			16,  +			timer_bar.mStartFraction, timer_bar.mEndFraction); +	} +	if (!time_block->getCollapsed()) +	{ +		for (TimeBlock::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it) +		{ +			++bar_index; +			bar_index = drawBar(*it, timer_bar.mChildrenRect, bars, bar_index, bar_image); +		} +	} - - - - - - - +	return bar_index; +} diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 7eee3c1cb5..f9ceb4423b 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -61,8 +61,6 @@ public:  	virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);  	virtual void draw(); - -  	LLTrace::TimeBlock* getLegendID(S32 y);  	F64 getTime(const std::string& name); @@ -70,7 +68,7 @@ protected:  	virtual	void	onClickCloseBtn();  private:	 -	void drawTicks(LLUnit<LLUnits::Seconds, F64> total_time); +	void drawTicks();  	void drawLineGraph();  	void drawLegend(S32 y);  	S32 drawHelp(S32 y); @@ -79,10 +77,32 @@ private:  	void printLineStats();  	void generateUniqueColors(); -	LLUnit<LLUnits::Seconds, F64> getTotalTime(); +	void updateTotalTime(); - -	std::vector<LLRect>* mBarRects; +	struct TimerBar +	{ +		TimerBar() +		:	mWidth(0), +			mSelfWidth(0), +			mVisible(true), +			mStartFraction(0.f), +			mEndFraction(1.f) +		{} +		S32			mWidth; +		S32			mSelfWidth; +		LLRect		mVisibleRect, +					mChildrenRect; +		LLColor4	mColor; +		bool		mVisible; +		F32			mStartFraction, +					mEndFraction; +	}; +	S32 updateTimerBarWidths(LLTrace::TimeBlock* time_block, std::vector<TimerBar>& bars, S32 history_index, bool visible); +	S32 updateTimerBarFractions(LLTrace::TimeBlock* time_block, S32 timer_bar_index, std::vector<TimerBar>& bars); +	S32 drawBar(LLTrace::TimeBlock* time_block, LLRect bar_rect, std::vector<TimerBar>& bars, S32 bar_index, LLPointer<LLUIImage>& bar_image); +	void setPauseState(bool pause_state); + +	std::vector<TimerBar>* mTimerBars;  	S32 mDisplayMode;  	typedef enum child_alignment @@ -96,7 +116,8 @@ private:  	ChildAlignment                mDisplayCenter;  	bool                          mDisplayCalls,  								  mDisplayHz; -	LLUnit<LLUnits::Seconds, F64> mAllTimeMax; +	LLUnit<LLUnits::Seconds, F64> mAllTimeMax, +								  mTotalTimeDisplay;  	LLRect                        mBarRect;  	S32						      mScrollIndex;  	LLTrace::TimeBlock*           mHoverID; diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index ab7fc1cf3f..25c119d9e1 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -42,13 +42,13 @@  #include "llviewerjoystick.h"  #include "llcheckboxctrl.h" -static LLTrace::Measurement<> sJoystickAxis1("Joystick axis 1"), -								sJoystickAxis2("Joystick axis 2"), -								sJoystickAxis3("Joystick axis 3"), -								sJoystickAxis4("Joystick axis 4"), -								sJoystickAxis5("Joystick axis 5"), -								sJoystickAxis6("Joystick axis 6"); -static LLTrace::Measurement<>* sJoystickAxes[6] =  +static LLTrace::MeasurementStatHandle<> sJoystickAxis1("Joystick axis 1"), +										sJoystickAxis2("Joystick axis 2"), +										sJoystickAxis3("Joystick axis 3"), +										sJoystickAxis4("Joystick axis 4"), +										sJoystickAxis5("Joystick axis 5"), +										sJoystickAxis6("Joystick axis 6"); +static LLTrace::MeasurementStatHandle<>* sJoystickAxes[6] =   {  	&sJoystickAxis1,  	&sJoystickAxis2, diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 0d90037e7b..04fc572220 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -992,7 +992,7 @@ void LLSnapshotLivePreview::saveTexture()  		llwarns << "Error encoding snapshot" << llendl;  	} -	LLStatViewer::SNAPSHOT.add(1); +	add(LLStatViewer::SNAPSHOT, 1);  	mDataSize = 0;  } diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 56fbdb429a..c12916ec6b 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -900,7 +900,7 @@ void LLHUDNameTag::updateAll()  //		}  	} -	LLTrace::Count<>* camera_vel_stat = LLViewerCamera::getVelocityStat(); +	LLTrace::CountStatHandle<>* camera_vel_stat = LLViewerCamera::getVelocityStat();  	F32 camera_vel = LLTrace::get_frame_recording().getLastRecordingPeriod().getPerSec(*camera_vel_stat);  	if (camera_vel > MAX_STABLE_CAMERA_VELOCITY)  	{ diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 23cbfae044..142aaa795b 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -638,7 +638,7 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32  	gAgent.sendReliableMessage(); -	LLStatViewer::CHAT_COUNT.add(1); +	add(LLStatViewer::CHAT_COUNT, 1);  }  class LLChatCommandHandler : public LLCommandHandler diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 39ded21183..88f2c5ff52 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1049,7 +1049,7 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item)  void LLPanelFace::onCommitTexture( const LLSD& data )  { -	LLStatViewer::EDIT_TEXTURE.add(1); +	add(LLStatViewer::EDIT_TEXTURE, 1);  	sendTexture();  } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 050db136bc..f87a958fbc 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -942,7 +942,7 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata)  void LLScriptEdCore::doSave( BOOL close_after_save )  { -	LLStatViewer::LSL_SAVES.add(1); +	add(LLStatViewer::LSL_SAVES, 1);  	if( mSaveCallback )  	{ @@ -1146,7 +1146,7 @@ void LLScriptEdCore::onBtnLoadFromFile( void* data )  void LLScriptEdCore::onBtnSaveToFile( void* userdata )  { -	LLStatViewer::LSL_SAVES.add(1); +	add(LLStatViewer::LSL_SAVES, 1);  	LLScriptEdCore* self = (LLScriptEdCore*) userdata; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 36ce7bb60e..bdbb1bb797 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1550,7 +1550,7 @@ void LLObjectSelection::applyNoCopyTextureToTEs(LLViewerInventoryItem* item)  				}  				// apply texture for the selected faces -				LLStatViewer::EDIT_TEXTURE.add(1); +				add(LLStatViewer::EDIT_TEXTURE, 1);  				object->setTEImage(te, image);  				dialog_refresh_all(); @@ -3424,7 +3424,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response,  			gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);  			// Keep track of how many objects have been deleted. -			LLStatViewer::DELETE_OBJECT.add(LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount()); +			add(LLStatViewer::DELETE_OBJECT, LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount());  		}  		break;  	case 1: diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 648fb0f7b7..2effec7d3a 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2071,7 +2071,7 @@ bool idle_startup()  		if (wearables_time > MAX_WEARABLES_TIME)  		{  			LLNotificationsUtil::add("ClothingLoading"); -			LLStatViewer::LOADING_WEARABLES_LONG_DELAY.add(1); +			add(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, 1);  			LLStartUp::setStartupState( STATE_CLEANUP );  			return TRUE;  		} diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index fad7a73008..d6cd881894 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -460,7 +460,7 @@ BOOL LLTexLayerSetBuffer::requestUpdateImmediate()  void LLTexLayerSetBuffer::doUpload()  {  	llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl; -	LLStatViewer::TEX_BAKES.add(1); +	add(LLStatViewer::TEX_BAKES, 1);  	// Don't need caches since we're baked now.  (note: we won't *really* be baked   	// until this image is sent to the server and the Avatar Appearance message is received.) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index fba636e8ef..0dc2601e60 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -65,8 +65,8 @@  #include "bufferstream.h"  bool LLTextureFetchDebugger::sDebuggerEnabled = false ; -LLTrace::Measurement<> LLTextureFetch::sCacheHitRate("texture_cache_hits"); -LLTrace::Measurement<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency"); +LLTrace::MeasurementStatHandle<> LLTextureFetch::sCacheHitRate("texture_cache_hits"); +LLTrace::MeasurementStatHandle<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");  ////////////////////////////////////////////////////////////////////////////// @@ -1237,7 +1237,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; -			LLTextureFetch::sCacheHitRate.sample(100.f); +			sample(LLTextureFetch::sCacheHitRate, 100.f);  		}  		else  		{ @@ -1254,7 +1254,7 @@ bool LLTextureFetchWorker::doWork(S32 param)  			}  			// fall through -			LLTextureFetch::sCacheHitRate.sample(0.f); +			sample(LLTextureFetch::sCacheHitRate, 0.f);  		}  	} @@ -2706,7 +2706,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,  			F32 cache_read_time = worker->mCacheReadTime;  			if (cache_read_time != 0.f)  			{ -				sCacheReadLatency.sample(cache_read_time * 1000.f); +				sample(sCacheReadLatency, cache_read_time * 1000.f);  			}  			res = true;  			LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL; @@ -2832,7 +2832,7 @@ S32 LLTextureFetch::update(F32 max_time_ms)  		mNetworkQueueMutex.lock();										// +Mfnq  		mMaxBandwidth = band_width ; -		LLStatViewer::TEXTURE_KBIT.add(mHTTPTextureBits); +		add(LLStatViewer::TEXTURE_KBIT, mHTTPTextureBits);  		mHTTPTextureBits = 0;  		mNetworkQueueMutex.unlock();									// -Mfnq diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 2c1e7502e5..2e398023fe 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -308,8 +308,8 @@ private:  	LLMutex mQueueMutex;        //to protect mRequestMap and mCommands only  	LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue. -	static LLTrace::Measurement<> sCacheHitRate; -	static LLTrace::Measurement<> sCacheReadLatency; +	static LLTrace::MeasurementStatHandle<> sCacheHitRate; +	static LLTrace::MeasurementStatHandle<> sCacheReadLatency;  	LLTextureCache* mTextureCache;  	LLImageDecodeThread* mImageDecodeThread; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 652847aac9..90ae0b428b 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1062,7 +1062,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,  		return;  	}  	LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); -	LLStatViewer::EDIT_TEXTURE.add(1); +	add(LLStatViewer::EDIT_TEXTURE, 1);  	S32 num_faces = hit_obj->getNumTEs();  	for( S32 face = 0; face < num_faces; face++ )  	{ @@ -1130,7 +1130,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,  	}  	// update viewer side image in anticipation of update from simulator  	LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); -	LLStatViewer::EDIT_TEXTURE.add(1); +	add(LLStatViewer::EDIT_TEXTURE, 1);  	hit_obj->setTEImage(hit_face, image);  	dialog_refresh_all(); @@ -1354,7 +1354,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,  	effectp->setDuration(LL_HUD_DUR_SHORT);  	effectp->setColor(LLColor4U(gAgent.getEffectColor())); -	LLStatViewer::OBJECT_REZ.add(1); +	add(LLStatViewer::OBJECT_REZ, 1);  }  void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 329249eee8..c026ddd42e 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -433,7 +433,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )  	effectp->setDuration(LL_HUD_DUR_SHORT);  	effectp->setColor(LLColor4U(gAgent.getEffectColor())); -	LLStatViewer::OBJECT_CREATE.add(1); +	add(LLStatViewer::OBJECT_CREATE, 1);  	return TRUE;  } diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 890394dd22..0c72c3c5aa 100644 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -177,7 +177,7 @@ namespace LLViewerAssetStatsFF  		return ret;  	} -	static LLTrace::Count<> sEnqueueAssetRequestsTempTextureHTTP   ("enqueuedassetrequeststemptexturehttp",  +	static LLTrace::CountStatHandle<> sEnqueueAssetRequestsTempTextureHTTP   ("enqueuedassetrequeststemptexturehttp",   																	"Number of temporary texture asset http requests enqueued"),  							sEnqueueAssetRequestsTempTextureUDP    ("enqueuedassetrequeststemptextureudp",   																	"Number of temporary texture asset udp requests enqueued"), @@ -194,7 +194,7 @@ namespace LLViewerAssetStatsFF  							sEnqueuedAssetRequestsOther            ("enqueuedassetrequestsother",   																	"Number of other asset requests enqueued"); -	static LLTrace::Count<>* sEnqueued[EVACCount] = {		 +	static LLTrace::CountStatHandle<>* sEnqueued[EVACCount] = {		  		&sEnqueueAssetRequestsTempTextureHTTP,     		&sEnqueueAssetRequestsTempTextureUDP,    		&sEnqueueAssetRequestsNonTempTextureHTTP, @@ -205,7 +205,7 @@ namespace LLViewerAssetStatsFF  		&sEnqueuedAssetRequestsOther              	}; -	static LLTrace::Count<> sDequeueAssetRequestsTempTextureHTTP   ("dequeuedassetrequeststemptexturehttp",  +	static LLTrace::CountStatHandle<> sDequeueAssetRequestsTempTextureHTTP   ("dequeuedassetrequeststemptexturehttp",   																	"Number of temporary texture asset http requests dequeued"),  							sDequeueAssetRequestsTempTextureUDP    ("dequeuedassetrequeststemptextureudp",   																	"Number of temporary texture asset udp requests dequeued"), @@ -222,7 +222,7 @@ namespace LLViewerAssetStatsFF  							sDequeuedAssetRequestsOther            ("dequeuedassetrequestsother",   																	"Number of other asset requests dequeued"); -	static LLTrace::Count<>* sDequeued[EVACCount] = { +	static LLTrace::CountStatHandle<>* sDequeued[EVACCount] = {  		&sDequeueAssetRequestsTempTextureHTTP,     		&sDequeueAssetRequestsTempTextureUDP,    		&sDequeueAssetRequestsNonTempTextureHTTP, @@ -233,7 +233,7 @@ namespace LLViewerAssetStatsFF  		&sDequeuedAssetRequestsOther              	}; -	static LLTrace::Measurement<LLTrace::Seconds>	sResponseAssetRequestsTempTextureHTTP   ("assetresponsetimestemptexturehttp",  +	static LLTrace::MeasurementStatHandle<LLTrace::Seconds>	sResponseAssetRequestsTempTextureHTTP   ("assetresponsetimestemptexturehttp",   																							"Time spent responding to temporary texture asset http requests"),  													sResponseAssetRequestsTempTextureUDP    ("assetresponsetimestemptextureudp",   																							"Time spent responding to temporary texture asset udp requests"), @@ -250,7 +250,7 @@ namespace LLViewerAssetStatsFF  													sResponsedAssetRequestsOther            ("assetresponsetimesother",   																							"Time spent responding to other asset requests"); -	static LLTrace::Measurement<LLTrace::Seconds>* sResponse[EVACCount] = { +	static LLTrace::MeasurementStatHandle<LLTrace::Seconds>* sResponse[EVACCount] = {  		&sResponseAssetRequestsTempTextureHTTP,     		&sResponseAssetRequestsTempTextureUDP,    		&sResponseAssetRequestsNonTempTextureHTTP, diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index f74897daa7..6e0a2c88a8 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -54,8 +54,8 @@  // System includes  #include <iomanip> // for setprecision -LLTrace::Count<> LLViewerCamera::sVelocityStat("camera_velocity"); -LLTrace::Count<> LLViewerCamera::sAngularVelocityStat("camera_angular_velocity"); +LLTrace::CountStatHandle<> LLViewerCamera::sVelocityStat("camera_velocity"); +LLTrace::CountStatHandle<> LLViewerCamera::sAngularVelocityStat("camera_angular_velocity");  U32 LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 607bfa7199..ffec284f72 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -101,8 +101,8 @@ public:  	BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const;  	const LLVector3* getVelocityDir() const {return &mVelocityDir;} -	static LLTrace::Count<>* getVelocityStat()		   {return &sVelocityStat; } -	static LLTrace::Count<>* getAngularVelocityStat()  {return &sAngularVelocityStat; } +	static LLTrace::CountStatHandle<>* getVelocityStat()		   {return &sVelocityStat; } +	static LLTrace::CountStatHandle<>* getAngularVelocityStat()  {return &sAngularVelocityStat; }  	F32     getCosHalfFov() {return mCosHalfCameraFOV;}  	F32     getAverageSpeed() {return mAverageSpeed ;}  	F32     getAverageAngularSpeed() {return mAverageAngularSpeed;} @@ -130,8 +130,8 @@ public:  protected:  	void calcProjection(const F32 far_distance) const; -	static LLTrace::Count<> sVelocityStat; -	static LLTrace::Count<> sAngularVelocityStat; +	static LLTrace::CountStatHandle<> sVelocityStat; +	static LLTrace::CountStatHandle<> sAngularVelocityStat;  	LLVector3 mVelocityDir ;  	F32       mAverageSpeed ; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fe83f80caa..2aec25b7aa 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -749,8 +749,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			{  				LLFastTimer t(FTM_IMAGE_UPDATE_CLASS); -				LLTrace::Count<>* velocity_stat = LLViewerCamera::getVelocityStat(); -				LLTrace::Count<>* angular_velocity_stat = LLViewerCamera::getAngularVelocityStat(); +				LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat(); +				LLTrace::CountStatHandle<>* angular_velocity_stat = LLViewerCamera::getAngularVelocityStat();  				LLViewerTexture::updateClass(LLTrace::get_frame_recording().getPeriodMeanPerSec(*velocity_stat),  											LLTrace::get_frame_recording().getPeriodMeanPerSec(*angular_velocity_stat));  			} diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 50ca8db267..b7282a8493 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -1096,17 +1096,17 @@ void upload_new_resource(  	if( LLAssetType::AT_SOUND == asset_type )  	{ -		LLStatViewer::UPLOAD_SOUND.add(1); +		add(LLStatViewer::UPLOAD_SOUND, 1);  	}  	else  	if( LLAssetType::AT_TEXTURE == asset_type )  	{ -		LLStatViewer::UPLOAD_TEXTURE.add(1); +		add(LLStatViewer::UPLOAD_TEXTURE, 1);  	}  	else  	if( LLAssetType::AT_ANIMATION == asset_type)  	{ -		LLStatViewer::ANIMATION_UPLOADS.add(1); +		add(LLStatViewer::ANIMATION_UPLOADS, 1);  	}  	if(LLInventoryType::IT_NONE == inv_type) @@ -1231,15 +1231,15 @@ void increase_new_upload_stats(LLAssetType::EType asset_type)  {  	if ( LLAssetType::AT_SOUND == asset_type )  	{ -		LLStatViewer::UPLOAD_SOUND.add(1); +		add(LLStatViewer::UPLOAD_SOUND, 1);  	}  	else if ( LLAssetType::AT_TEXTURE == asset_type )  	{ -		LLStatViewer::UPLOAD_TEXTURE.add(1); +		add(LLStatViewer::UPLOAD_TEXTURE, 1);  	}  	else if ( LLAssetType::AT_ANIMATION == asset_type )  	{ -		LLStatViewer::ANIMATION_UPLOADS.add(1); +		add(LLStatViewer::ANIMATION_UPLOADS, 1);  	}  } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7a2025ed5b..db169b86a4 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5824,7 +5824,7 @@ void process_alert_core(const std::string& message, BOOL modal)  	// HACK -- handle callbacks for specific alerts. It also is localized in notifications.xml  	if ( message == "You died and have been teleported to your home location")  	{ -		LLStatViewer::KILLED.add(1); +		add(LLStatViewer::KILLED, 1);  	}  	else if( message == "Home position set." )  	{ diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f5f5bdffbd..a5bd57145d 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -113,7 +113,7 @@ BOOL		LLViewerObject::sMapDebug = TRUE;  LLColor4	LLViewerObject::sEditSelectColor(	1.0f, 1.f, 0.f, 0.3f);	// Edit OK  LLColor4	LLViewerObject::sNoEditSelectColor(	1.0f, 0.f, 0.f, 0.3f);	// Can't edit  S32			LLViewerObject::sAxisArrowLength(50); -LLTrace::MemStat	LLViewerObject::sMemStat("LLViewerObject"); +LLTrace::MemStatHandle	LLViewerObject::sMemStat("LLViewerObject");  BOOL		LLViewerObject::sPulseEnabled(FALSE); @@ -2103,7 +2103,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,  		// If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps  		if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) )  		{ -			LLStatViewer::AGENT_POSITION_SNAP.sample<LLTrace::Meters>(diff.length()); +			sample(LLStatViewer::AGENT_POSITION_SNAP, LLTrace::Meters(diff.length()));  		}  	} diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 20254bfe02..aa30d1c790 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -636,7 +636,7 @@ public:  	LLPointer<LLHUDIcon> mIcon;  	static	BOOL				sUseSharedDrawables; -	static	LLTrace::MemStat	sMemStat; +	static	LLTrace::MemStatHandle	sMemStat;  protected:  	// delete an item in the inventory, but don't tell the diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index dce963c5c5..e0063cf4f1 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -94,7 +94,7 @@ 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::Measurement<>	LLViewerObjectList::sCacheHitRate("object_cache_hits"); +LLTrace::MeasurementStatHandle<>	LLViewerObjectList::sCacheHitRate("object_cache_hits");  LLViewerObjectList::LLViewerObjectList()  { @@ -356,7 +356,7 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*  		}  		justCreated = true;  		mNumNewObjects++; -		sCacheHitRate.sample(100.f); +		sample(sCacheHitRate, 100.f);  	}  	if (objectp->isDead()) @@ -672,7 +672,7 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys,  			continue; // no data packer, skip this object  		} -		sCacheHitRate.sample(100.f); +		sample(sCacheHitRate, 100.f);  	}  	return; @@ -1125,10 +1125,10 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  	}  	*/ -	LLStatViewer::NUM_OBJECTS.sample(mObjects.size()); -	LLStatViewer::NUM_ACTIVE_OBJECTS.sample(idle_count); -	LLStatViewer::NUM_SIZE_CULLED.sample(mNumSizeCulled); -	LLStatViewer::NUM_VIS_CULLED.sample(mNumVisCulled); +	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 b92be61fae..cb11ef1f5e 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -198,7 +198,7 @@ protected:  	std::vector<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects  	S32 mNumOrphans; -	static LLTrace::Measurement<> sCacheHitRate; +	static LLTrace::MeasurementStatHandle<> sCacheHitRate;  	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 136a4d0a9e..921c681e2a 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -64,48 +64,48 @@  namespace LLStatViewer  { -LLTrace::Count<>	FPS("fpsstat"), -					PACKETS_IN("packetsinstat"), -					PACKETS_LOST("packetsloststat"), -					PACKETS_OUT("packetsoutstat"), -					TEXTURE_PACKETS("texturepacketsstat"), -					TRIANGLES_DRAWN("trianglesdrawnstat"), -					CHAT_COUNT("chatcount", "Chat messages sent"), -					IM_COUNT("imcount", "IMs sent"), -					OBJECT_CREATE("objectcreate"), -					OBJECT_REZ("objectrez", "Object rez count"), -					LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"), -					LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"), -					LSL_SAVES("lslsaves", "Number of times user has saved a script"), -					ANIMATION_UPLOADS("animationuploads", "Animations uploaded"), -					FLY("fly", "Fly count"), -					TELEPORT("teleport", "Teleport count"), -					DELETE_OBJECT("deleteobject", "Objects deleted"), -					SNAPSHOT("snapshot", "Snapshots taken"), -					UPLOAD_SOUND("uploadsound", "Sounds uploaded"), -					UPLOAD_TEXTURE("uploadtexture", "Textures uploaded"), -					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"); -LLTrace::Count<LLTrace::Kilobits>	KBIT("kbitstat"), -									LAYERS_KBIT("layerskbitstat"), -									OBJECT_KBIT("objectkbitstat"), -									ASSET_KBIT("assetkbitstat"), -									TEXTURE_KBIT("texturekbitstat"), -									ACTUAL_IN_KBIT("actualinkbitstat"), -									ACTUAL_OUT_KBIT("actualoutkbitstat"); - -LLTrace::Count<LLTrace::Seconds> AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"), -								TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), -								MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), -								FPS_10_TIME("fps10time", "Seconds below 10 FPS"), -								FPS_8_TIME("fps8time", "Seconds below 8 FPS"), -								FPS_2_TIME("fps2time", "Seconds below 2 FPS"), -								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%"); +LLTrace::CountStatHandle<>	FPS("fpsstat"), +							PACKETS_IN("packetsinstat"), +							PACKETS_LOST("packetsloststat"), +							PACKETS_OUT("packetsoutstat"), +							TEXTURE_PACKETS("texturepacketsstat"), +							TRIANGLES_DRAWN("trianglesdrawnstat"), +							CHAT_COUNT("chatcount", "Chat messages sent"), +							IM_COUNT("imcount", "IMs sent"), +							OBJECT_CREATE("objectcreate"), +							OBJECT_REZ("objectrez", "Object rez count"), +							LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"), +							LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"), +							LSL_SAVES("lslsaves", "Number of times user has saved a script"), +							ANIMATION_UPLOADS("animationuploads", "Animations uploaded"), +							FLY("fly", "Fly count"), +							TELEPORT("teleport", "Teleport count"), +							DELETE_OBJECT("deleteobject", "Objects deleted"), +							SNAPSHOT("snapshot", "Snapshots taken"), +							UPLOAD_SOUND("uploadsound", "Sounds uploaded"), +							UPLOAD_TEXTURE("uploadtexture", "Textures uploaded"), +							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"); +LLTrace::CountStatHandle<LLTrace::Kilobits>	KBIT("kbitstat"), +											LAYERS_KBIT("layerskbitstat"), +											OBJECT_KBIT("objectkbitstat"), +											ASSET_KBIT("assetkbitstat"), +											TEXTURE_KBIT("texturekbitstat"), +											ACTUAL_IN_KBIT("actualinkbitstat"), +											ACTUAL_OUT_KBIT("actualoutkbitstat"); + +LLTrace::CountStatHandle<LLTrace::Seconds> AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"), +											TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), +											MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), +											FPS_10_TIME("fps10time", "Seconds below 10 FPS"), +											FPS_8_TIME("fps8time", "Seconds below 8 FPS"), +											FPS_2_TIME("fps2time", "Seconds below 2 FPS"), +											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), @@ -128,34 +128,34 @@ 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); -LLTrace::Measurement<>		FPS_SAMPLE("fpssample"), -							NUM_IMAGES("numimagesstat"), -							NUM_RAW_IMAGES("numrawimagesstat"), -							NUM_OBJECTS("numobjectsstat"), -							NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), -							NUM_NEW_OBJECTS("numnewobjectsstat"), -							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"), -							CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled"), -							PENDING_VFS_OPERATIONS("vfspendingoperations"),  -							PACKETS_LOST_PERCENT("packetslostpercentstat"), -							WINDOW_WIDTH("windowwidth", "Window width"), -							WINDOW_HEIGHT("windowheight", "Window height"); +LLTrace::MeasurementStatHandle<>	FPS_SAMPLE("fpssample"), +									NUM_IMAGES("numimagesstat"), +									NUM_RAW_IMAGES("numrawimagesstat"), +									NUM_OBJECTS("numobjectsstat"), +									NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), +									NUM_NEW_OBJECTS("numnewobjectsstat"), +									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"), +									CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled"), +									PENDING_VFS_OPERATIONS("vfspendingoperations"),  +									PACKETS_LOST_PERCENT("packetslostpercentstat"), +									WINDOW_WIDTH("windowwidth", "Window width"), +									WINDOW_HEIGHT("windowheight", "Window height"); -LLTrace::Measurement<LLTrace::Meters> AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections"); +LLTrace::MeasurementStatHandle<LLTrace::Meters> AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections"); -LLTrace::Measurement<LLTrace::Bytes>	GL_TEX_MEM("gltexmemstat"), -										GL_BOUND_MEM("glboundmemstat"), -										RAW_MEM("rawmemstat"), -										FORMATTED_MEM("formattedmemstat"), -										DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), -										MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting"); +LLTrace::MeasurementStatHandle<LLTrace::Bytes>	GL_TEX_MEM("gltexmemstat"), +												GL_BOUND_MEM("glboundmemstat"), +												RAW_MEM("rawmemstat"), +												FORMATTED_MEM("formattedmemstat"), +												DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), +												MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting");  SimMeasurement<LLTrace::Milliseconds> SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS), @@ -177,17 +177,17 @@ SimMeasurement<LLTrace::Bytes> SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_  								SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY); -LLTrace::Measurement<LLTrace::Milliseconds>	FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), -											FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), -											LOGIN_SECONDS("loginseconds", "Time between LoginRequest and LoginReply"), -											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"), -											SIM_PING("simpingstat"); +LLTrace::MeasurementStatHandle<LLTrace::Milliseconds>	FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), +														FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), +														LOGIN_SECONDS("loginseconds", "Time between LoginRequest and LoginReply"), +														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"), +														SIM_PING("simpingstat");  } @@ -212,50 +212,50 @@ void LLViewerStats::updateFrameStats(const F64 time_diff)  	LLTrace::Seconds time_diff_seconds(time_diff);  	if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > 5.0)  	{ -		LLStatViewer::LOSS_5_PERCENT_TIME.add(time_diff_seconds); +		add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff_seconds);  	}  	F32 sim_fps = getRecording().getLastValue(LLStatViewer::SIM_FPS);  	if (0.f < sim_fps && sim_fps < 20.f)  	{ -		LLStatViewer::SIM_20_FPS_TIME.add(time_diff_seconds); +		add(LLStatViewer::SIM_20_FPS_TIME, time_diff_seconds);  	}  	F32 sim_physics_fps = getRecording().getLastValue(LLStatViewer::SIM_PHYSICS_FPS);  	if (0.f < sim_physics_fps && sim_physics_fps < 20.f)  	{ -		LLStatViewer::SIM_PHYSICS_20_FPS_TIME.add(time_diff_seconds); +		add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff_seconds);  	}  	if (time_diff >= 0.5)  	{ -		LLStatViewer::FPS_2_TIME.add(time_diff_seconds); +		add(LLStatViewer::FPS_2_TIME, time_diff_seconds);  	}  	if (time_diff >= 0.125)  	{ -		LLStatViewer::FPS_8_TIME.add(time_diff_seconds); +		add(LLStatViewer::FPS_8_TIME, time_diff_seconds);  	}  	if (time_diff >= 0.1)  	{ -		LLStatViewer::FPS_10_TIME.add(time_diff_seconds); +		add(LLStatViewer::FPS_10_TIME, time_diff_seconds);  	}  	if (gFrameCount && mLastTimeDiff > 0.0)  	{  		// new "stutter" meter -		LLStatViewer::FRAMETIME_DOUBLED.add(time_diff >= 2.0 * mLastTimeDiff ? 1 : 0); +		add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0);  		// old stats that were never really used -		LLStatViewer::FRAMETIME_JITTER.sample<LLTrace::Milliseconds>(mLastTimeDiff - time_diff); +		sample(LLStatViewer::FRAMETIME_JITTER, LLTrace::Milliseconds(mLastTimeDiff - time_diff));  		F32 average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount; -		LLStatViewer::FRAMETIME_SLEW.sample<LLTrace::Milliseconds>(average_frametime - time_diff); +		sample(LLStatViewer::FRAMETIME_SLEW, LLTrace::Milliseconds(average_frametime - time_diff));  		F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();  		F32 delta_bandwidth = gViewerThrottle.getCurrentBandwidth() - max_bandwidth; -		LLStatViewer::DELTA_BANDWIDTH.sample<LLTrace::Bits>(delta_bandwidth); -		LLStatViewer::MAX_BANDWIDTH.sample<LLTrace::Bits>(max_bandwidth); +		sample(LLStatViewer::DELTA_BANDWIDTH, LLTrace::Bits(delta_bandwidth)); +		sample(LLStatViewer::MAX_BANDWIDTH, LLTrace::Bits(max_bandwidth));  	}  	mLastTimeDiff = time_diff; @@ -311,53 +311,53 @@ void update_statistics()  	{  		if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)  		{ -			LLStatViewer::MOUSELOOK_TIME.add(gFrameIntervalSeconds); +			add(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds);  		}  		else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)  		{ -			LLStatViewer::AVATAR_EDIT_TIME.add(gFrameIntervalSeconds); +			add(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds);  		}  		else if (LLFloaterReg::instanceVisible("build"))  		{ -			LLStatViewer::TOOLBOX_TIME.add(gFrameIntervalSeconds); +			add(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds);  		}  	} -	LLStatViewer::ENABLE_VBO.sample((F64)gSavedSettings.getBOOL("RenderVBOEnable")); -	LLStatViewer::LIGHTING_DETAIL.sample((F64)gPipeline.getLightingDetail()); -	LLStatViewer::DRAW_DISTANCE.sample((F64)gSavedSettings.getF32("RenderFarClip")); -	LLStatViewer::CHAT_BUBBLES.sample((F64)gSavedSettings.getBOOL("UseChatBubbles")); +	sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); +	sample(LLStatViewer::LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail()); +	sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip")); +	sample(LLStatViewer::CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles")); -	LLStatViewer::FRAME_STACKTIME.sample<LLTrace::Seconds>(gDebugView->mFastTimerView->getTime("Frame")); +	sample(LLStatViewer::FRAME_STACKTIME, LLTrace::Seconds(gDebugView->mFastTimerView->getTime("Frame")));  	F64 idle_secs = gDebugView->mFastTimerView->getTime("Idle");  	F64 network_secs = gDebugView->mFastTimerView->getTime("Network"); -	LLStatViewer::UPDATE_STACKTIME.sample<LLTrace::Seconds>(idle_secs - network_secs); -	LLStatViewer::NETWORK_STACKTIME.sample<LLTrace::Seconds>(network_secs); -	LLStatViewer::IMAGE_STACKTIME.sample<LLTrace::Seconds>(gDebugView->mFastTimerView->getTime("Update Images")); -	LLStatViewer::REBUILD_STACKTIME.sample<LLTrace::Seconds>(gDebugView->mFastTimerView->getTime("Sort Draw State")); -	LLStatViewer::RENDER_STACKTIME.sample<LLTrace::Seconds>(gDebugView->mFastTimerView->getTime("Geometry")); +	sample(LLStatViewer::UPDATE_STACKTIME, LLTrace::Seconds(idle_secs - network_secs)); +	sample(LLStatViewer::NETWORK_STACKTIME, LLTrace::Seconds(network_secs)); +	sample(LLStatViewer::IMAGE_STACKTIME, LLTrace::Seconds(gDebugView->mFastTimerView->getTime("Update Images"))); +	sample(LLStatViewer::REBUILD_STACKTIME, LLTrace::Seconds(gDebugView->mFastTimerView->getTime("Sort Draw State"))); +	sample(LLStatViewer::RENDER_STACKTIME, LLTrace::Seconds(gDebugView->mFastTimerView->getTime("Geometry")));  	LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());  	if (cdp)  	{ -		LLStatViewer::SIM_PING.sample<LLTrace::Milliseconds>(cdp->getPingDelay()); +		sample(LLStatViewer::SIM_PING, LLTrace::Milliseconds(cdp->getPingDelay()));  		gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);  		gSimPingCount++;  	}  	else  	{ -		LLStatViewer::SIM_PING.sample<LLTrace::Seconds>(10); +		sample(LLStatViewer::SIM_PING, LLTrace::Seconds(10));  	} -	LLStatViewer::FPS.add(1); +	add(LLStatViewer::FPS, 1);  	if (LLTrace::get_frame_recording().getTotalRecording().getSampleCount(LLStatViewer::FPS))  	{ -		LLStatViewer::FPS_SAMPLE.sample(LLTrace::get_frame_recording().getTotalRecording().getPerSec(LLStatViewer::FPS)); +		sample(LLStatViewer::FPS_SAMPLE, LLTrace::get_frame_recording().getTotalRecording().getPerSec(LLStatViewer::FPS));  	}  	F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); -	LLStatViewer::LAYERS_KBIT.add<LLTrace::Bits>(layer_bits); -	LLStatViewer::OBJECT_KBIT.add(gObjectData); -	LLStatViewer::PENDING_VFS_OPERATIONS.sample(LLVFile::getVFSThread()->getPending()); -	LLStatViewer::ASSET_KBIT.add<LLTrace::Bits>(gTransferManager.getTransferBitsIn(LLTCT_ASSET)); +	add(LLStatViewer::LAYERS_KBIT, LLTrace::Bits(layer_bits)); +	add(LLStatViewer::OBJECT_KBIT, gObjectData); +	sample(LLStatViewer::PENDING_VFS_OPERATIONS, LLVFile::getVFSThread()->getPending()); +	add(LLStatViewer::ASSET_KBIT, LLTrace::Bits(gTransferManager.getTransferBitsIn(LLTCT_ASSET)));  	gTransferManager.resetTransferBitsIn(LLTCT_ASSET);  	if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) @@ -378,7 +378,7 @@ void update_statistics()  			visible_avatar_frames = 1.f;  			avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames;  		} -		LLStatViewer::VISIBLE_AVATARS.sample((F64)avg_visible_avatars); +		sample(LLStatViewer::VISIBLE_AVATARS, (F64)avg_visible_avatars);  	}  	LLWorld::getInstance()->updateNetStats();  	LLWorld::getInstance()->requestCacheMisses(); diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 6b95c9359d..a82c64317e 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -41,26 +41,21 @@ struct SimMeasurementSampler : public LLInstanceTracker<SimMeasurementSampler, E  	:	LLInstanceTracker<SimMeasurementSampler, ESimStatID>(id)  	{}  	virtual ~SimMeasurementSampler() {} -	virtual void sample(F64 value) = 0;  };  template<typename T = F64> -struct SimMeasurement : public LLTrace::Measurement<T>, public SimMeasurementSampler +struct SimMeasurement : public LLTrace::MeasurementStatHandle<T>, public SimMeasurementSampler  {  	SimMeasurement(const char* name, const char* description, ESimStatID stat_id) -	:	LLTrace::Measurement<T>(name, description), +	:	LLTrace::MeasurementStatHandle<T>(name, description),  		SimMeasurementSampler(stat_id)	  	{}  	using SimMeasurementSampler::getInstance; - -	/*virtual*/ void sample(F64 value) -	{ -		LLTrace::Measurement<T>::sample(T(value)); -	}  }; -extern LLTrace::Count<>						FPS, + +extern LLTrace::CountStatHandle<>						FPS,  											PACKETS_IN,  											PACKETS_LOST,  											PACKETS_OUT, @@ -87,7 +82,7 @@ extern LLTrace::Count<>						FPS,  											TEX_REBAKES; -extern LLTrace::Count<LLTrace::Kilobits>	KBIT, +extern LLTrace::CountStatHandle<LLTrace::Kilobits>	KBIT,  											LAYERS_KBIT,  											OBJECT_KBIT,  											ASSET_KBIT, @@ -95,7 +90,7 @@ extern LLTrace::Count<LLTrace::Kilobits>	KBIT,  											ACTUAL_IN_KBIT,  											ACTUAL_OUT_KBIT; -extern LLTrace::Count<LLTrace::Seconds>		AVATAR_EDIT_TIME, +extern LLTrace::CountStatHandle<LLTrace::Seconds>		AVATAR_EDIT_TIME,  											TOOLBOX_TIME,  											MOUSELOOK_TIME,  											FPS_10_TIME, @@ -126,7 +121,7 @@ extern SimMeasurement<>						SIM_TIME_DILATION,  											SIM_PHYSICS_PINNED_TASKS,  											SIM_PHYSICS_LOD_TASKS; -extern LLTrace::Measurement<>				FPS_SAMPLE, +extern LLTrace::MeasurementStatHandle<>		FPS_SAMPLE,  											NUM_IMAGES,  											NUM_RAW_IMAGES,  											NUM_OBJECTS, @@ -145,14 +140,14 @@ extern LLTrace::Measurement<>				FPS_SAMPLE,  											WINDOW_WIDTH,  											WINDOW_HEIGHT; -extern LLTrace::Measurement<LLTrace::Meters> AGENT_POSITION_SNAP; +extern LLTrace::MeasurementStatHandle<LLTrace::Meters> AGENT_POSITION_SNAP; -extern LLTrace::Measurement<LLTrace::Bytes>	DELTA_BANDWIDTH, -											MAX_BANDWIDTH, -											GL_TEX_MEM, -											GL_BOUND_MEM, -											RAW_MEM, -											FORMATTED_MEM; +extern LLTrace::MeasurementStatHandle<LLTrace::Bytes>	DELTA_BANDWIDTH, +														MAX_BANDWIDTH, +														GL_TEX_MEM, +														GL_BOUND_MEM, +														RAW_MEM, +														FORMATTED_MEM;  extern SimMeasurement<LLTrace::Milliseconds>	SIM_FRAME_TIME,  												SIM_NET_TIME, @@ -173,7 +168,7 @@ extern SimMeasurement<LLTrace::Bytes>			SIM_UNACKED_BYTES,  												SIM_PHYSICS_MEM; -extern LLTrace::Measurement<LLTrace::Milliseconds>	FRAMETIME_JITTER, +extern LLTrace::MeasurementStatHandle<LLTrace::Milliseconds>	FRAMETIME_JITTER,  													FRAMETIME_SLEW,  													LOGIN_SECONDS,  													REGION_CROSSING_TIME, diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 3106a351e0..899ef985ff 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -599,9 +599,11 @@ static LLFastTimer::DeclareTimer FTM_IMAGE_FETCH("Fetch");  static LLFastTimer::DeclareTimer FTM_FAST_CACHE_IMAGE_FETCH("Fast Cache Fetch");  static LLFastTimer::DeclareTimer FTM_IMAGE_CREATE("Create");  static LLFastTimer::DeclareTimer FTM_IMAGE_STATS("Stats"); +static LLFastTimer::DeclareTimer FTM_UPDATE_IMAGES("Update Images");  void LLViewerTextureList::updateImages(F32 max_time)  { +	LLFastTimer _(FTM_UPDATE_IMAGES);  	static BOOL cleared = FALSE;  	if(gTeleportDisplay)  	{ @@ -621,12 +623,12 @@ void LLViewerTextureList::updateImages(F32 max_time)  	{  		using namespace LLStatViewer; -		NUM_IMAGES.sample(sNumImages); -		NUM_RAW_IMAGES.sample(LLImageRaw::sRawImageCount); -		GL_TEX_MEM.sample(LLImageGL::sGlobalTextureMemory); -		GL_BOUND_MEM.sample(LLImageGL::sBoundTextureMemory); -		RAW_MEM.sample<LLTrace::Bytes>(LLImageRaw::sGlobalRawMemory); -		FORMATTED_MEM.sample<LLTrace::Bytes>(LLImageFormatted::sGlobalFormattedMemory); +		sample(NUM_IMAGES, sNumImages); +		sample(NUM_RAW_IMAGES, LLImageRaw::sRawImageCount); +		sample(GL_TEX_MEM, LLImageGL::sGlobalTextureMemory); +		sample(GL_BOUND_MEM, LLImageGL::sBoundTextureMemory); +		sample(RAW_MEM, LLTrace::Bytes(LLImageRaw::sGlobalRawMemory)); +		sample(FORMATTED_MEM, LLTrace::Bytes(LLImageFormatted::sGlobalFormattedMemory));  	}  	{ @@ -1322,8 +1324,8 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d  	{  		received_size = msg->getReceiveSize() ;		  	} -	LLStatViewer::TEXTURE_KBIT.add<LLTrace::Bytes>(received_size); -	LLStatViewer::TEXTURE_PACKETS.add(1); +	add(LLStatViewer::TEXTURE_KBIT, LLTrace::Bytes(received_size)); +	add(LLStatViewer::TEXTURE_PACKETS, 1);  	U8 codec;  	U16 packets; @@ -1396,8 +1398,8 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d  		received_size = msg->getReceiveSize() ;		  	} -	LLStatViewer::TEXTURE_KBIT.add<LLTrace::Bytes>(received_size); -	LLStatViewer::TEXTURE_PACKETS.add(1); +	add(LLStatViewer::TEXTURE_KBIT, LLTrace::Bytes(received_size)); +	add(LLStatViewer::TEXTURE_PACKETS, 1);  	//llprintline("Start decode, image header...");  	msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, id); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 70792cd0a0..0bd0b2a769 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -248,7 +248,7 @@ std::string	LLViewerWindow::sSnapshotDir;  std::string	LLViewerWindow::sMovieBaseName; -LLTrace::Measurement<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity"); +LLTrace::MeasurementStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity");  class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole> @@ -2186,8 +2186,8 @@ void LLViewerWindow::reshape(S32 width, S32 height)  			}  		} -		LLStatViewer::WINDOW_WIDTH.sample((F64)width); -		LLStatViewer::WINDOW_HEIGHT.sample((F64)height); +		sample(LLStatViewer::WINDOW_WIDTH, width); +		sample(LLStatViewer::WINDOW_HEIGHT, height);  		LLLayoutStack::updateClass();  	} @@ -3250,7 +3250,7 @@ void LLViewerWindow::updateMouseDelta()  		mouse_vel.setVec((F32) dx, (F32) dy);  	} -	sMouseVelocityStat.sample(mouse_vel.magVec()); +	sample(sMouseVelocityStat, mouse_vel.magVec());  }  void LLViewerWindow::updateKeyboardFocus() diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index be2d6d885e..004a59fda5 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -250,7 +250,7 @@ public:  	S32				getCurrentMouseDX()		const	{ return mCurrentMouseDelta.mX; }  	S32				getCurrentMouseDY()		const	{ return mCurrentMouseDelta.mY; }  	LLCoordGL		getCurrentMouseDelta()	const	{ return mCurrentMouseDelta; } -	static LLTrace::Measurement<>*	getMouseVelocityStat()		{ return &sMouseVelocityStat; } +	static LLTrace::MeasurementStatHandle<>*	getMouseVelocityStat()		{ return &sMouseVelocityStat; }  	BOOL			getLeftMouseDown()	const	{ return mLeftMouseDown; }  	BOOL			getMiddleMouseDown()	const	{ return mMiddleMouseDown; }  	BOOL			getRightMouseDown()	const	{ return mRightMouseDown; } @@ -482,7 +482,7 @@ private:  	// Object temporarily hovered over while dragging  	LLPointer<LLViewerObject>	mDragHoveredObject; -	static LLTrace::Measurement<>	sMouseVelocityStat; +	static LLTrace::MeasurementStatHandle<>	sMouseVelocityStat;  };  // diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index cd033c84bf..4ecb7f2fc7 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -913,7 +913,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)  		{  			++mRegionCrossingCount;  			LLTrace::Seconds delta = mRegionCrossingTimer.getElapsedTimeF32(); -			LLStatViewer::REGION_CROSSING_TIME.sample(delta); +			sample(LLStatViewer::REGION_CROSSING_TIME, delta);  			// Diagnostics  			llinfos << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << llendl; @@ -2583,7 +2583,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)  					llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;  					gAgentAvatarp->invalidateComposite(layer_set, TRUE);  					found = TRUE; -					LLStatViewer::TEX_REBAKES.add(1); +					add(LLStatViewer::TEX_REBAKES, 1);  				}  			}  		} @@ -2628,7 +2628,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)  			}  			invalidateComposite(layer_set, TRUE); -			LLStatViewer::TEX_REBAKES.add(1); +			add(LLStatViewer::TEX_REBAKES, 1);  		}  		else  		{ diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 06e2302b0b..e088f94d64 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -720,15 +720,15 @@ void LLWorld::updateNetStats()  	S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();  	S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); -	LLStatViewer::ACTUAL_IN_KBIT.add<LLTrace::Bits>(actual_in_bits); -	LLStatViewer::ACTUAL_OUT_KBIT.add<LLTrace::Bits>(actual_out_bits); -	LLStatViewer::KBIT.add<LLTrace::Bits>(bits); -	LLStatViewer::PACKETS_IN.add(packets_in); -	LLStatViewer::PACKETS_OUT.add(packets_out); -	LLStatViewer::PACKETS_LOST.add(packets_lost); +	add(LLStatViewer::ACTUAL_IN_KBIT, LLTrace::Bits(actual_in_bits)); +	add(LLStatViewer::ACTUAL_OUT_KBIT, LLTrace::Bits(actual_out_bits)); +	add(LLStatViewer::KBIT, LLTrace::Bits(bits)); +	add(LLStatViewer::PACKETS_IN, packets_in); +	add(LLStatViewer::PACKETS_OUT, packets_out); +	add(LLStatViewer::PACKETS_LOST, packets_lost);  	if (packets_in)  	{ -		LLStatViewer::PACKETS_LOST_PERCENT.sample(100.f*((F32)packets_lost/(F32)packets_in)); +		sample(LLStatViewer::PACKETS_LOST_PERCENT, 100.f * ((F32)packets_lost/(F32)packets_in));  	}  	mLastPacketsIn = gMessageSystem->mPacketsIn; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8d3075d1e1..355fa1350b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1800,7 +1800,7 @@ void LLPipeline::resetFrameStats()  {  	assertInitialized(); -	LLStatViewer::TRIANGLES_DRAWN.add(mTrianglesDrawn); +	add(LLStatViewer::TRIANGLES_DRAWN, mTrianglesDrawn);  	if (mBatchCount > 0)  	{ @@ -9805,7 +9805,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)  	if (gen_shadow)  	{ -		LLTrace::Count<>* velocity_stat = LLViewerCamera::getVelocityStat(); +		LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat();  		F32 fade_amt = gFrameIntervalSeconds.value()   			* llmax(LLTrace::get_frame_recording().getLastRecordingPeriod().getSum(*velocity_stat) / LLTrace::get_frame_recording().getLastRecordingPeriod().getDuration().value(), 1.0); | 
