diff options
author | Richard Linden <none@none> | 2013-06-28 20:45:20 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-06-28 20:45:20 -0700 |
commit | ffa7123bb5187e1da491a8f475d696053d9c9ee4 (patch) | |
tree | c93505d62775737dd087695ced75f6c4d8f10d6a /indra/llcommon | |
parent | 0f178ec33debc6d92f3b2aa2392e640eb342a095 (diff) |
SH-4299 FIX Interesting: High fps shown temporarily off scale in statistics console
added ability to force uniqueness of LLCopyOnWritePointer
converted more variables to units
added convenience function for unit constants
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-x | indra/llcommon/llfasttimer.cpp | 4 | ||||
-rwxr-xr-x | indra/llcommon/llpointer.h | 18 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 5 | ||||
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/llunit.h | 68 |
5 files changed, 61 insertions, 42 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 60c451b137..23e27622bf 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -386,7 +386,7 @@ void TimeBlock::dumpCurTimes() U32 num_calls = last_frame_recording.getSum(timerp->callCount()); // Don't bother with really brief times, keep output concise - if (total_time < LLUnit<F32, LLUnits::Milliseconds>(0.1)) continue; + if (total_time < LLUnits::Milliseconds::fromValue(0.1f)) continue; std::ostringstream out_str; TimeBlock* parent_timerp = timerp; @@ -397,7 +397,7 @@ void TimeBlock::dumpCurTimes() } out_str << timerp->getName() << " " - << std::setprecision(3) << total_time.getAs<LLUnits::Milliseconds>() << " ms, " + << std::setprecision(3) << total_time.valueAs<LLUnits::Milliseconds>() << " ms, " << num_calls << " calls"; llinfos << out_str.str() << llendl; diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 6a0a8fcb0d..c827996db1 100755 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -173,15 +173,23 @@ public: typedef LLPointer<Type> pointer_t; LLCopyOnWritePointer() + : mStayUnique(false) {} LLCopyOnWritePointer(Type* ptr) - : LLPointer<Type>(ptr) + : LLPointer<Type>(ptr), + mStayUnique(false) {} LLCopyOnWritePointer(LLPointer<Type>& ptr) - : LLPointer<Type>(ptr) - {} + : LLPointer<Type>(ptr), + mStayUnique(false) + { + if (ptr.mForceUnique) + { + makeUnique(); + } + } Type* write() { @@ -199,6 +207,10 @@ public: const Type* operator->() const { return pointer_t::mPointer; } const Type& operator*() const { return *pointer_t::mPointer; } + + void setStayUnique(bool stay) { makeUnique(); mStayUnique = stay; } +private: + bool mStayUnique; }; #endif diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 0938317eaa..f1388e7935 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -100,14 +100,15 @@ void Recording::handleReset() void Recording::handleStart() { mSamplingTimer.reset(); + mBuffers.setStayUnique(true); LLTrace::get_thread_recorder()->activate(mBuffers.write()); } void Recording::handleStop() { mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); - AccumulatorBufferGroup* buffers = mBuffers.write(); - LLTrace::get_thread_recorder()->deactivate(buffers); + LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); + mBuffers.setStayUnique(false); } void Recording::handleSplitTo(Recording& other) diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 7192564c94..d0f0328d1c 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -99,14 +99,6 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index ) void ThreadRecorder::activate( AccumulatorBufferGroup* recording ) { - active_recording_list_t::reverse_iterator it, end_it; - for (it = mActiveRecordings.rbegin(), end_it = mActiveRecordings.rend(); - it != end_it; - ++it) - { - llassert((*it)->mTargetRecording != recording); - } - ActiveRecording* active_recording = new ActiveRecording(recording); if (!mActiveRecordings.empty()) { diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 2402cdbb95..c9bbed5574 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -75,17 +75,11 @@ struct LLUnit } template<typename NEW_UNIT_TYPE> - STORAGE_TYPE getAs() + STORAGE_TYPE valueAs() { return LLUnit<STORAGE_TYPE, NEW_UNIT_TYPE>(*this).value(); } - template<typename NEW_UNIT_TYPE> - STORAGE_TYPE setAs(STORAGE_TYPE val) - { - *this = LLUnit<STORAGE_TYPE, NEW_UNIT_TYPE>(val); - } - void operator += (storage_t value) { mValue += value; @@ -181,6 +175,7 @@ LL_FORCE_INLINE void ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out, .. if (boost::is_same<T1, typename T1::base_unit_t>::value) { if (boost::is_same<T2, typename T2::base_unit_t>::value) + { // T1 and T2 fully reduced and equal...just copy out = (S2)in.value(); @@ -493,26 +488,45 @@ struct LLUnitInverseLinearOps } }; -#define LL_DECLARE_BASE_UNIT(base_unit_name, unit_label) \ -struct base_unit_name { typedef base_unit_name base_unit_t; static const char* getUnitLabel() { return unit_label; }} - -#define LL_DECLARE_DERIVED_UNIT(unit_name, unit_label, base_unit_name, conversion_operation) \ -struct unit_name \ -{ \ - typedef base_unit_name base_unit_t; \ - static const char* getUnitLabel() { return unit_label; } \ -}; \ - \ -template<typename S1, typename S2> \ -void ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \ -{ \ - out = (S2)(LLUnitLinearOps<S1>(in.value()) conversion_operation).mValue; \ -} \ - \ -template<typename S1, typename S2> \ -void ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \ -{ \ - out = (S2)(LLUnitInverseLinearOps<S1>(in.value()) conversion_operation).mValue; \ +#define LL_DECLARE_BASE_UNIT(base_unit_name, unit_label) \ +struct base_unit_name \ +{ \ + typedef base_unit_name base_unit_t; \ + static const char* getUnitLabel() { return unit_label; } \ + template<typename T> \ + static LLUnit<T, base_unit_name> fromValue(T value) { return LLUnit<T, base_unit_name>(value); } \ + template<typename STORAGE_T, typename UNIT_T> \ + static LLUnit<STORAGE_T, base_unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \ + { return LLUnit<STORAGE_T, base_unit_name>(value); } \ +}; \ +template<typename T> std::ostream& operator<<(std::ostream& s, const LLUnit<T, base_unit_name>& val) \ +{ s << val.value() << base_unit_name::getUnitLabel; return s; } + + +#define LL_DECLARE_DERIVED_UNIT(unit_name, unit_label, base_unit_name, conversion_operation) \ +struct unit_name \ +{ \ + typedef base_unit_name base_unit_t; \ + static const char* getUnitLabel() { return unit_label; } \ + template<typename T> \ + static LLUnit<T, unit_name> fromValue(T value) { return LLUnit<T, unit_name>(value); } \ + template<typename STORAGE_T, typename UNIT_T> \ + static LLUnit<STORAGE_T, unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \ + { return LLUnit<STORAGE_T, unit_name>(value); } \ +}; \ +template<typename T> std::ostream& operator<<(std::ostream& s, const LLUnit<T, unit_name>& val) \ +{ s << val.value() << unit_name::getUnitLabel; return s; } \ + \ +template<typename S1, typename S2> \ +void ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \ +{ \ + out = (S2)(LLUnitLinearOps<S1>(in.value()) conversion_operation).mValue; \ +} \ + \ +template<typename S1, typename S2> \ +void ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \ +{ \ + out = (S2)(LLUnitInverseLinearOps<S1>(in.value()) conversion_operation).mValue; \ } // |