diff options
author | Richard Linden <none@none> | 2013-03-06 11:27:12 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2013-03-06 11:27:12 -0800 |
commit | 9a81945eac31f41848cd48a5ba18dee4949f2d03 (patch) | |
tree | 2a0a6644adfa609651ce9c42a808ce67bef9d0b3 | |
parent | dcf4e489213d6e954a34fbb3c5c96e94645b868b (diff) | |
parent | e52e5fe5be0d2f4e0e8ded445bd18c0985ef968a (diff) |
Automated merge with ssh://hg.lindenlab.com/richard/viewer-interesting
47 files changed, 677 insertions, 679 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 5d57327a14..44da1939c6 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -42,517 +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> +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()) + {} + + LL_FORCE_INLINE ACCUMULATOR* getPrimaryAccumulator() const { - 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()) - {} + 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) { - 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; + // don't touch variance + // mVarianceSum = mVarianceSum; } + else + { + 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; + + CountAccumulator() + : mSum(0), + mNumSamples(0) + {} - template<typename T> - class CountAccumulator + 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 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 +}; - }; +template<> +struct MeanValueType<TraceType<TimeBlockAccumulator> > +{ + typedef LLUnit<LLUnits::Seconds, F64> type; +}; - template<> - struct MeanValueType<TraceType<TimeBlockAccumulator> > - { - typedef LLUnit<LLUnits::Seconds, F64> type; - }; +template<> +class TraceType<TimeBlockAccumulator::CallCountAspect> +: public TraceType<TimeBlockAccumulator> +{ +public: - template<> - class TraceType<TimeBlockAccumulator::CallCountAspect> + TraceType(const char* name, const char* description = "") + : TraceType<TimeBlockAccumulator>(name, description) + {} +}; + +template<> +struct MeanValueType<TraceType<TimeBlockAccumulator::CallCountAspect> > +{ + typedef F64 type; +}; + + +template<> +class TraceType<TimeBlockAccumulator::SelfTimeAspect> : public TraceType<TimeBlockAccumulator> - { - public: +{ +public: - TraceType(const char* name, const char* description = "") + 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::SelfTimeAspect> > +{ + typedef LLUnit<LLUnits::Seconds, F64> type; +}; - template<> - class TraceType<TimeBlockAccumulator::SelfTimeAspect> - : public TraceType<TimeBlockAccumulator> - { - public: - TraceType(const char* name, const char* description = "") - : TraceType<TimeBlockAccumulator>(name, description) - {} - }; +class TimeBlock; +class TimeBlockTreeNode +{ +public: + TimeBlockTreeNode(); - template<> - struct MeanValueType<TraceType<TimeBlockAccumulator::SelfTimeAspect> > - { - typedef LLUnit<LLUnits::Seconds, F64> type; - }; + void setParent(TimeBlock* parent); + TimeBlock* getParent() { return mParent; } + TimeBlock* mBlock; + TimeBlock* mParent; + std::vector<TimeBlock*> mChildren; + bool mNeedsSorting; +}; - class TimeBlock; - class TimeBlockTreeNode - { - public: - TimeBlockTreeNode(); - void setParent(TimeBlock* parent); - TimeBlock* getParent() { return mParent; } +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; - TimeBlock* mBlock; - TimeBlock* mParent; - std::vector<TimeBlock*> mChildren; - bool mNeedsSorting; - }; + MeasurementStatHandle(const char* name, const char* description = NULL) + : trace_t(name, description) + {} +}; +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 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; - Measurement(const char* name, const char* description = NULL) - : trace_t(name, description) - {} +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; - template<typename UNIT_T> - void sample(UNIT_T value) - { - T converted_value(value); - trace_t::getPrimaryAccumulator()->sample(LLUnits::rawValue(converted_value)); - } - }; + CountStatHandle(const char* name, const char* description = NULL) + : trace_t(name) + {} - 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, 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 { @@ -585,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.h b/indra/llcommon/lltracerecording.h index 16fee04979..7a0266529b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -135,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)); } @@ -147,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)); } @@ -156,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)); } @@ -168,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)); } @@ -176,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)); } @@ -184,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)); } @@ -192,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)); } @@ -200,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)); } @@ -208,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)); } @@ -394,6 +394,7 @@ namespace LLTrace { public: void extend(); + Recording& getAcceptedRecording() { return mAcceptedRecording; } // implementation for LLStopWatchControlsMixin 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/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/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 6f8b439049..899ef985ff 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -623,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)); } { @@ -1324,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; @@ -1398,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); |