diff options
author | Richard Linden <none@none> | 2013-08-14 11:51:49 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-08-14 11:51:49 -0700 |
commit | 26581404e426b00cd0a07c38b5cb858d5d5faa28 (patch) | |
tree | f2a9a512fac56b7ce4f5f643617346e05c0a2992 /indra | |
parent | 9faaa28f4445425e8c5b7b002faffbe0365b905d (diff) |
BUILDFIX: added header for numeric_limits support on gcc
added convenience types for units F32Seconds, etc.
Diffstat (limited to 'indra')
33 files changed, 313 insertions, 138 deletions
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 8c9477f80d..66e4b947c4 100755 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -383,7 +383,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; // roll is critically damped interpolation between current roll and angular velocity-derived target roll - mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, LLUnits::Milliseconds::fromValue(100)); + mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, LLUnits::U32Milliseconds(100)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 7810676388..a3619559eb 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -308,7 +308,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; #define lllog(level, once, ...) \ do { \ const char* tags[] = {"", ##__VA_ARGS__}; \ - size_t tag_count = LL_ARRAY_SIZE(tags) - 1; \ + ::size_t tag_count = LL_ARRAY_SIZE(tags) - 1; \ static LLError::CallSite _site( \ level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, once, &tags[1], tag_count);\ if (LL_UNLIKELY(_site.shouldLog())) \ diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 8f86a1dfbc..a91e716f19 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -339,7 +339,7 @@ void TimeBlock::logStats() } call_count++; - LLUnit<F64, LLUnits::Seconds> total_time(0); + LLUnits::F64Seconds total_time(0); LLSD sd; { @@ -382,11 +382,11 @@ void TimeBlock::dumpCurTimes() ++it) { TimeBlock* timerp = (*it); - LLUnit<F64, LLUnits::Seconds> total_time = last_frame_recording.getSum(*timerp); + LLUnits::F64Seconds total_time = last_frame_recording.getSum(*timerp); U32 num_calls = last_frame_recording.getSum(timerp->callCount()); // Don't bother with really brief times, keep output concise - if (total_time < LLUnits::Milliseconds::fromValue(0.1f)) continue; + if (total_time < LLUnits::F32Milliseconds(0.1f)) continue; std::ostringstream out_str; TimeBlock* parent_timerp = timerp; @@ -466,11 +466,11 @@ void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other ) } } -LLUnit<F64, LLUnits::Seconds> BlockTimer::getElapsedTime() +LLUnits::F64Seconds BlockTimer::getElapsedTime() { U64 total_time = TimeBlock::getCPUClockCount64() - mStartTime; - return LLUnits::Seconds::fromValue((F64)total_time / (F64)TimeBlock::countsPerSecond()); + return LLUnits::F64Seconds((F64)total_time / (F64)TimeBlock::countsPerSecond()); } diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 73c40749ed..589b9bb941 100755 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -48,7 +48,7 @@ public: BlockTimer(TimeBlock& timer); ~BlockTimer(); - LLUnit<F64, LLUnits::Seconds> getElapsedTime(); + LLUnits::F64Seconds getElapsedTime(); private: diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index a2c5f3d699..7077ea4b4f 100755 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -262,7 +262,7 @@ LLUnitImplicit<U64, LLUnits::Microseconds> totalTime() } // Return the total clock tick count in microseconds. - return LLUnits::Microseconds::fromValue(gTotalTimeClockCount*gClocksToMicroseconds); + return LLUnits::U64Microseconds(gTotalTimeClockCount*gClocksToMicroseconds); } diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index ef73bd3091..4d79964526 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -418,7 +418,7 @@ namespace LLTrace class TimeBlockAccumulator { public: - typedef LLUnit<F64, LLUnits::Seconds> value_t; + typedef LLUnits::F64Seconds value_t; typedef TimeBlockAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic @@ -429,7 +429,7 @@ namespace LLTrace struct SelfTimeFacet { - typedef LLUnit<F64, LLUnits::Seconds> value_t; + typedef LLUnits::F64Seconds value_t; }; TimeBlockAccumulator(); diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 42d97ce314..963f0cd174 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -95,7 +95,7 @@ void Recording::handleReset() { mBuffers.write()->reset(); - mElapsedSeconds = LLUnits::Seconds::fromValue(0.0); + mElapsedSeconds = LLUnits::F64Seconds(0.0); mSamplingTimer.reset(); } @@ -128,17 +128,17 @@ void Recording::appendRecording( Recording& other ) mElapsedSeconds += other.mElapsedSeconds; } -LLUnit<F64, LLUnits::Seconds> Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) +LLUnits::F64Seconds Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return LLUnits::Seconds::fromValue((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) + return LLUnits::F64Seconds((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond()); } -LLUnit<F64, LLUnits::Seconds> Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat) +LLUnits::F64Seconds Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return LLUnits::Seconds::fromValue((F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond()); + return LLUnits::F64Seconds((F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond()); } @@ -147,19 +147,19 @@ U32 Recording::getSum(const TraceType<TimeBlockAccumulator::CallCountFacet>& sta return mBuffers->mStackTimers[stat.getIndex()].mCalls; } -LLUnit<F64, LLUnits::Seconds> Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat) +LLUnits::F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return LLUnits::Seconds::fromValue((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) + return LLUnits::F64Seconds((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value())); } -LLUnit<F64, LLUnits::Seconds> Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat) +LLUnits::F64Seconds Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return LLUnits::Seconds::fromValue((F64)(accumulator.mSelfTimeCounter) + return LLUnits::F64Seconds((F64)(accumulator.mSelfTimeCounter) / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value())); } @@ -168,54 +168,54 @@ F32 Recording::getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& return (F32)mBuffers->mStackTimers[stat.getIndex()].mCalls / mElapsedSeconds.value(); } -LLUnit<F64, LLUnits::Bytes> Recording::getMin(const TraceType<MemStatAccumulator>& stat) +LLUnits::F64Bytes Recording::getMin(const TraceType<MemStatAccumulator>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); } -LLUnit<F64, LLUnits::Bytes> Recording::getMean(const TraceType<MemStatAccumulator>& stat) +LLUnits::F64Bytes Recording::getMean(const TraceType<MemStatAccumulator>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMean()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMean()); } -LLUnit<F64, LLUnits::Bytes> Recording::getMax(const TraceType<MemStatAccumulator>& stat) +LLUnits::F64Bytes Recording::getMax(const TraceType<MemStatAccumulator>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMax()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMax()); } -LLUnit<F64, LLUnits::Bytes> Recording::getStandardDeviation(const TraceType<MemStatAccumulator>& stat) +LLUnits::F64Bytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation()); } -LLUnit<F64, LLUnits::Bytes> Recording::getLastValue(const TraceType<MemStatAccumulator>& stat) +LLUnits::F64Bytes Recording::getLastValue(const TraceType<MemStatAccumulator>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue()); } -LLUnit<F64, LLUnits::Bytes> Recording::getMin(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) +LLUnits::F64Bytes Recording::getMin(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMin()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMin()); } -LLUnit<F64, LLUnits::Bytes> Recording::getMean(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) +LLUnits::F64Bytes Recording::getMean(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMean()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMean()); } -LLUnit<F64, LLUnits::Bytes> Recording::getMax(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) +LLUnits::F64Bytes Recording::getMax(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMax()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMax()); } -LLUnit<F64, LLUnits::Bytes> Recording::getStandardDeviation(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) +LLUnits::F64Bytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getStandardDeviation()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mChildSize.getStandardDeviation()); } -LLUnit<F64, LLUnits::Bytes> Recording::getLastValue(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) +LLUnits::F64Bytes Recording::getLastValue(const TraceType<MemStatAccumulator::ChildMemFacet>& stat) { - return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getLastValue()); + return LLUnits::F64Bytes(mBuffers->mMemStats[stat.getIndex()].mChildSize.getLastValue()); } U32 Recording::getSum(const TraceType<MemStatAccumulator::AllocationCountFacet>& stat) @@ -427,9 +427,9 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) getCurRecording().setPlayState(getPlayState()); } -LLUnit<F64, LLUnits::Seconds> PeriodicRecording::getDuration() const +LLUnits::F64Seconds PeriodicRecording::getDuration() const { - LLUnit<F64, LLUnits::Seconds> duration; + LLUnits::F64Seconds duration; size_t num_periods = mRecordingPeriods.size(); for (size_t i = 1; i <= num_periods; i++) { diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3722a61327..811786fbfa 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -166,12 +166,12 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - LLUnit<F64, LLUnits::Seconds> getSum(const TraceType<TimeBlockAccumulator>& stat); - LLUnit<F64, LLUnits::Seconds> getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat); + LLUnits::F64Seconds getSum(const TraceType<TimeBlockAccumulator>& stat); + LLUnits::F64Seconds getSum(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat); U32 getSum(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat); - LLUnit<F64, LLUnits::Seconds> getPerSec(const TraceType<TimeBlockAccumulator>& stat); - LLUnit<F64, LLUnits::Seconds> getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat); + LLUnits::F64Seconds getPerSec(const TraceType<TimeBlockAccumulator>& stat); + LLUnits::F64Seconds getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeFacet>& stat); F32 getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat); // Memory accessors @@ -295,7 +295,7 @@ namespace LLTrace U32 getSampleCount(const TraceType<EventAccumulator>& stat); - LLUnit<F64, LLUnits::Seconds> getDuration() const { return mElapsedSeconds; } + LLUnits::F64Seconds getDuration() const { return mElapsedSeconds; } protected: friend class ThreadRecorder; @@ -310,7 +310,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - LLUnit<F64, LLUnits::Seconds> mElapsedSeconds; + LLUnits::F64Seconds mElapsedSeconds; LLCopyOnWritePointer<AccumulatorBufferGroup> mBuffers; bool mInHandOff; @@ -325,7 +325,7 @@ namespace LLTrace void nextPeriod(); size_t getNumRecordedPeriods() { return mNumPeriods; } - LLUnit<F64, LLUnits::Seconds> getDuration() const; + LLUnits::F64Seconds getDuration() const; void appendPeriodicRecording(PeriodicRecording& other); void appendRecording(Recording& recording); @@ -485,7 +485,7 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename RelatedTypes<T::value_t>::fractional_t mean = 0; + typename RelatedTypes<T::value_t>::fractional_t mean(0); for (S32 i = 1; i <= num_periods; i++) { @@ -495,9 +495,9 @@ namespace LLTrace mean += recording.getSum(stat); } } - return RelatedTypes<T::value_t>::fractional_t(num_periods - ? mean / num_periods - : NaN); + return (num_periods + ? RelatedTypes<T::value_t>::fractional_t(mean / num_periods) + : RelatedTypes<T::value_t>::fractional_t(NaN)); } template<typename T> @@ -536,9 +536,9 @@ namespace LLTrace } } - return RelatedTypes<T::value_t>::fractional_t(num_periods - ? mean / num_periods - : NaN); + return (num_periods + ? RelatedTypes<T::value_t>::fractional_t(mean / num_periods) + : RelatedTypes<T::value_t>::fractional_t(NaN)); } template<typename T> diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index b135be48fa..9a367d9182 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -39,7 +39,7 @@ struct LLUnit typedef STORAGE_TYPE storage_t; // value initialization - LLUnit(storage_t value = storage_t()) + explicit LLUnit(storage_t value = storage_t()) : mValue(value) {} @@ -644,6 +644,54 @@ LL_DECLARE_DERIVED_UNIT(Bytes, * 1024, Kibibytes, "KiB"); LL_DECLARE_DERIVED_UNIT(Kibibytes, * 1024, Mibibytes, "MiB"); LL_DECLARE_DERIVED_UNIT(Mibibytes, * 1024, Gibibytes, "GiB"); +typedef LLUnit<F32, Bytes> F32Bytes; +typedef LLUnit<F32, Kilobytes> F32KiloBytes; +typedef LLUnit<F32, Megabytes> F32MegaBytes; +typedef LLUnit<F32, Gigabytes> F32GigaBytes; +typedef LLUnit<F32, Kibibytes> F32KibiBytes; +typedef LLUnit<F32, Mibibytes> F32MibiBytes; +typedef LLUnit<F32, Gibibytes> F32GibiBytes; + +typedef LLUnit<F64, Bytes> F64Bytes; +typedef LLUnit<F64, Kilobytes> F64KiloBytes; +typedef LLUnit<F64, Megabytes> F64MegaBytes; +typedef LLUnit<F64, Gigabytes> F64GigaBytes; +typedef LLUnit<F64, Kibibytes> F64KibiBytes; +typedef LLUnit<F64, Mibibytes> F64MibiBytes; +typedef LLUnit<F64, Gibibytes> F64GibiBytes; + +typedef LLUnit<S32, Bytes> S32Bytes; +typedef LLUnit<S32, Kilobytes> S32KiloBytes; +typedef LLUnit<S32, Megabytes> S32MegaBytes; +typedef LLUnit<S32, Gigabytes> S32GigaBytes; +typedef LLUnit<S32, Kibibytes> S32KibiBytes; +typedef LLUnit<S32, Mibibytes> S32MibiBytes; +typedef LLUnit<S32, Gibibytes> S32GibiBytes; + +typedef LLUnit<U32, Bytes> U32Bytes; +typedef LLUnit<U32, Kilobytes> U32KiloBytes; +typedef LLUnit<U32, Megabytes> U32MegaBytes; +typedef LLUnit<U32, Gigabytes> U32GigaBytes; +typedef LLUnit<U32, Kibibytes> U32KibiBytes; +typedef LLUnit<U32, Mibibytes> U32MibiBytes; +typedef LLUnit<U32, Gibibytes> U32GibiBytes; + +typedef LLUnit<S64, Bytes> S64Bytes; +typedef LLUnit<S64, Kilobytes> S64KiloBytes; +typedef LLUnit<S64, Megabytes> S64MegaBytes; +typedef LLUnit<S64, Gigabytes> S64GigaBytes; +typedef LLUnit<S64, Kibibytes> S64KibiBytes; +typedef LLUnit<S64, Mibibytes> S64MibiBytes; +typedef LLUnit<S64, Gibibytes> S64GibiBytes; + +typedef LLUnit<U64, Bytes> U64Bytes; +typedef LLUnit<U64, Kilobytes> U64KiloBytes; +typedef LLUnit<U64, Megabytes> U64MegaBytes; +typedef LLUnit<U64, Gigabytes> U64GigaBytes; +typedef LLUnit<U64, Kibibytes> U64KibiBytes; +typedef LLUnit<U64, Mibibytes> U64MibiBytes; +typedef LLUnit<U64, Gibibytes> U64GibiBytes; + LL_DECLARE_DERIVED_UNIT(Bytes, / 8, Bits, "b"); LL_DECLARE_DERIVED_UNIT(Bits, * 1000, Kilobits, "Kb"); LL_DECLARE_DERIVED_UNIT(Kilobits, * 1000, Megabits, "Mb"); @@ -652,6 +700,54 @@ LL_DECLARE_DERIVED_UNIT(Bits, * 1024, Kibibits, "Kib"); LL_DECLARE_DERIVED_UNIT(Kibibits, * 1024, Mibibits, "Mib"); LL_DECLARE_DERIVED_UNIT(Mibibits, * 1024, Gibibits, "Gib"); +typedef LLUnit<F32, Bits> F32Bits; +typedef LLUnit<F32, Kilobits> F32KiloBits; +typedef LLUnit<F32, Megabits> F32MegaBits; +typedef LLUnit<F32, Gigabits> F32GigaBits; +typedef LLUnit<F32, Kibibits> F32KibiBits; +typedef LLUnit<F32, Mibibits> F32MibiBits; +typedef LLUnit<F32, Gibibits> F32GibiBits; + +typedef LLUnit<F64, Bits> F64Bits; +typedef LLUnit<F64, Kilobits> F64KiloBits; +typedef LLUnit<F64, Megabits> F64MegaBits; +typedef LLUnit<F64, Gigabits> F64GigaBits; +typedef LLUnit<F64, Kibibits> F64KibiBits; +typedef LLUnit<F64, Mibibits> F64MibiBits; +typedef LLUnit<F64, Gibibits> F64GibiBits; + +typedef LLUnit<S32, Bits> S32Bits; +typedef LLUnit<S32, Kilobits> S32KiloBits; +typedef LLUnit<S32, Megabits> S32MegaBits; +typedef LLUnit<S32, Gigabits> S32GigaBits; +typedef LLUnit<S32, Kibibits> S32KibiBits; +typedef LLUnit<S32, Mibibits> S32MibiBits; +typedef LLUnit<S32, Gibibits> S32GibiBits; + +typedef LLUnit<U32, Bits> U32Bits; +typedef LLUnit<U32, Kilobits> U32KiloBits; +typedef LLUnit<U32, Megabits> U32MegaBits; +typedef LLUnit<U32, Gigabits> U32GigaBits; +typedef LLUnit<U32, Kibibits> U32KibiBits; +typedef LLUnit<U32, Mibibits> U32MibiBits; +typedef LLUnit<U32, Gibibits> U32GibiBits; + +typedef LLUnit<S64, Bits> S64Bits; +typedef LLUnit<S64, Kilobits> S64KiloBits; +typedef LLUnit<S64, Megabits> S64MegaBits; +typedef LLUnit<S64, Gigabits> S64GigaBits; +typedef LLUnit<S64, Kibibits> S64KibiBits; +typedef LLUnit<S64, Mibibits> S64MibiBits; +typedef LLUnit<S64, Gibibits> S64GibiBits; + +typedef LLUnit<U64, Bits> U64Bits; +typedef LLUnit<U64, Kilobits> U64KiloBits; +typedef LLUnit<U64, Megabits> U64MegaBits; +typedef LLUnit<U64, Gigabits> U64GigaBits; +typedef LLUnit<U64, Kibibits> U64KibiBits; +typedef LLUnit<U64, Mibibits> U64MibiBits; +typedef LLUnit<U64, Gibibits> U64GibiBits; + LL_DECLARE_BASE_UNIT(Seconds, "s"); LL_DECLARE_DERIVED_UNIT(Seconds, * 60, Minutes, "min"); LL_DECLARE_DERIVED_UNIT(Minutes, * 60, Hours, "h"); @@ -660,11 +756,90 @@ LL_DECLARE_DERIVED_UNIT(Seconds, / 1000, Milliseconds, "ms"); LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000, Microseconds, "\x09\x3cs"); LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000, Nanoseconds, "ns"); +typedef LLUnit<F32, Seconds> F32Seconds; +typedef LLUnit<F32, Minutes> F32Minutes; +typedef LLUnit<F32, Hours> F32Hours; +typedef LLUnit<F32, Days> F32Days; +typedef LLUnit<F32, Milliseconds> F32Milliseconds; +typedef LLUnit<F32, Microseconds> F32Microseconds; +typedef LLUnit<F32, Nanoseconds> F32Nanoseconds; + +typedef LLUnit<F64, Seconds> F64Seconds; +typedef LLUnit<F64, Minutes> F64Minutes; +typedef LLUnit<F64, Hours> F64Hours; +typedef LLUnit<F64, Days> F64Days; +typedef LLUnit<F64, Milliseconds> F64Milliseconds; +typedef LLUnit<F64, Microseconds> F64Microseconds; +typedef LLUnit<F64, Nanoseconds> F64Nanoseconds; + +typedef LLUnit<S32, Seconds> S32Seconds; +typedef LLUnit<S32, Minutes> S32Minutes; +typedef LLUnit<S32, Hours> S32Hours; +typedef LLUnit<S32, Days> S32Days; +typedef LLUnit<S32, Milliseconds> S32Milliseconds; +typedef LLUnit<S32, Microseconds> S32Microseconds; +typedef LLUnit<S32, Nanoseconds> S32Nanoseconds; + +typedef LLUnit<U32, Seconds> U32Seconds; +typedef LLUnit<U32, Minutes> U32Minutes; +typedef LLUnit<U32, Hours> U32Hours; +typedef LLUnit<U32, Days> U32Days; +typedef LLUnit<U32, Milliseconds> U32Milliseconds; +typedef LLUnit<U32, Microseconds> U32Microseconds; +typedef LLUnit<U32, Nanoseconds> U32Nanoseconds; + +typedef LLUnit<S64, Seconds> S64Seconds; +typedef LLUnit<S64, Minutes> S64Minutes; +typedef LLUnit<S64, Hours> S64Hours; +typedef LLUnit<S64, Days> S64Days; +typedef LLUnit<S64, Milliseconds> S64Milliseconds; +typedef LLUnit<S64, Microseconds> S64Microseconds; +typedef LLUnit<S64, Nanoseconds> S64Nanoseconds; + +typedef LLUnit<U64, Seconds> U64Seconds; +typedef LLUnit<U64, Minutes> U64Minutes; +typedef LLUnit<U64, Hours> U64Hours; +typedef LLUnit<U64, Days> U64Days; +typedef LLUnit<U64, Milliseconds> U64Milliseconds; +typedef LLUnit<U64, Microseconds> U64Microseconds; +typedef LLUnit<U64, Nanoseconds> U64Nanoseconds; + LL_DECLARE_BASE_UNIT(Meters, "m"); LL_DECLARE_DERIVED_UNIT(Meters, * 1000, Kilometers, "km"); LL_DECLARE_DERIVED_UNIT(Meters, / 100, Centimeters, "cm"); LL_DECLARE_DERIVED_UNIT(Meters, / 1000, Millimeters, "mm"); +typedef LLUnit<F32, Meters> F32Meters; +typedef LLUnit<F32, Kilometers> F32Kilometers; +typedef LLUnit<F32, Centimeters> F32Centimeters; +typedef LLUnit<F32, Millimeters> F32Millimeters; + +typedef LLUnit<F64, Meters> F64Meters; +typedef LLUnit<F64, Kilometers> F64Kilometers; +typedef LLUnit<F64, Centimeters> F64Centimeters; +typedef LLUnit<F64, Millimeters> F64Millimeters; + +typedef LLUnit<S32, Meters> S32Meters; +typedef LLUnit<S32, Kilometers> S32Kilometers; +typedef LLUnit<S32, Centimeters> S32Centimeters; +typedef LLUnit<S32, Millimeters> S32Millimeters; + +typedef LLUnit<U32, Meters> U32Meters; +typedef LLUnit<U32, Kilometers> U32Kilometers; +typedef LLUnit<U32, Centimeters> U32Centimeters; +typedef LLUnit<U32, Millimeters> U32Millimeters; + +typedef LLUnit<S64, Meters> S64Meters; +typedef LLUnit<S64, Kilometers> S64Kilometers; +typedef LLUnit<S64, Centimeters> S64Centimeters; +typedef LLUnit<S64, Millimeters> S64Millimeters; + +typedef LLUnit<U64, Meters> U64Meters; +typedef LLUnit<U64, Kilometers> U64Kilometers; +typedef LLUnit<U64, Centimeters> U64Centimeters; +typedef LLUnit<U64, Millimeters> U64Millimeters; + +// rare units LL_DECLARE_BASE_UNIT(Hertz, "Hz"); LL_DECLARE_DERIVED_UNIT(Hertz, * 1000, Kilohertz, "KHz"); LL_DECLARE_DERIVED_UNIT(Kilohertz, * 1000, Megahertz, "MHz"); diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp index b0309585aa..8546bcbc54 100644 --- a/indra/llcommon/tests/llunits_test.cpp +++ b/indra/llcommon/tests/llunits_test.cpp @@ -112,7 +112,7 @@ namespace tut void units_object_t::test<4>() { // exercise math operations - LLUnit<F32, Quatloos> quatloos = 1.f; + LLUnit<F32, Quatloos> quatloos(1.f); quatloos *= 4.f; ensure(quatloos == 4); quatloos = quatloos * 2; diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 18154d4b0d..25c7f58c91 100755 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -1082,7 +1082,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) mGroupID.setNull(); } mSaleTimerExpires.start(); - mSaleTimerExpires.setTimerExpirySec(LLUnits::Microseconds::fromValue(DEFAULT_USEC_SALE_TIMEOUT)); + mSaleTimerExpires.setTimerExpirySec(LLUnits::U64Microseconds(DEFAULT_USEC_SALE_TIMEOUT)); mStatus = OS_LEASE_PENDING; mClaimDate = time(NULL); setAuctionID(0); diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 2f83836501..fc30feaf80 100755 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -30,6 +30,7 @@ #include <cmath> #include <cstdlib> #include <vector> +#include <limits> #include "lldefs.h" //#include "llstl.h" // *TODO: Remove when LLString is gone //#include "llstring.h" // *TODO: Remove when LLString is gone diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 1d1beafff8..6a45ebc598 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -249,7 +249,7 @@ void LLImageGL::updateStats(F32 current_time) LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; - sCurBoundTextureMemory = LLUnits::Bytes::fromValue(0); + sCurBoundTextureMemory = LLUnits::S32Bytes(0); } //static diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index b564ad5cee..5857e32821 100755 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -44,12 +44,12 @@ // rate at which to update display of value that is rapidly changing const F32 MEAN_VALUE_UPDATE_TIME = 1.f / 4.f; // time between value changes that qualifies as a "rapid change" -const LLUnit<F32, LLUnits::Seconds> RAPID_CHANGE_THRESHOLD = 0.2f; +const LLUnits::F32Seconds RAPID_CHANGE_THRESHOLD(0.2f); // maximum number of rapid changes in RAPID_CHANGE_WINDOW before switching over to displaying the mean // instead of latest value const S32 MAX_RAPID_CHANGES_PER_SEC = 10; // period of time over which to measure rapid changes -const LLUnit<F32, LLUnits::Seconds> RAPID_CHANGE_WINDOW = 1.f; +const LLUnits::F32Seconds RAPID_CHANGE_WINDOW(1.f); F32 calc_tick_value(F32 min, F32 max) { @@ -250,12 +250,12 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) } template<typename T> -S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const T& stat, const LLUnit<F32, LLUnits::Seconds> time_period) +S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const T& stat, const LLUnits::F32Seconds time_period) { - LLUnit<F32, LLUnits::Seconds> elapsed_time, + LLUnits::F32Seconds elapsed_time, time_since_value_changed; S32 num_rapid_changes = 0; - const LLUnit<F32, LLUnits::Seconds> RAPID_CHANGE_THRESHOLD = LLUnits::Seconds::fromValue(0.3f); + const LLUnits::F32Seconds RAPID_CHANGE_THRESHOLD = LLUnits::F32Seconds(0.3f); F64 last_value = periodic_recording.getPrevRecording(1).getLastValue(stat); for (S32 i = 2; i < periodic_recording.getNumRecordedPeriods(); i++) @@ -277,9 +277,9 @@ S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const return num_rapid_changes; } -S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const LLTrace::TraceType<LLTrace::CountAccumulator>& stat, const LLUnit<F32, LLUnits::Seconds> time_period) +S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const LLTrace::TraceType<LLTrace::CountAccumulator>& stat, const LLUnits::F32Seconds time_period) { - LLUnit<F32, LLUnits::Seconds> elapsed_time, + LLUnits::F32Seconds elapsed_time, time_since_value_changed; S32 num_rapid_changes = 0; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 8dd148e304..a17a4e5e21 100755 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -132,7 +132,7 @@ const std::string LLConversation::createTimestamp(const LLUnit<U64, LLUnits::Sec bool LLConversation::isOlderThan(U32 days) const { - LLUnit<U64, LLUnits::Seconds> now = time_corrected(); + LLUnit<U64, LLUnits::Seconds> now(time_corrected()); LLUnit<U32, LLUnits::Days> age = now - mTime; return age > days; @@ -535,7 +535,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename) history_file_name); ConversationParams params; - params.time(time) + params.time(LLUnits::Seconds::fromValue(time)) .conversation_type((SessionType)stype) .has_offline_ims(has_offline_ims) .conversation_name(conv_name_buffer) diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index bb9e474098..11a9a70b18 100755 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -260,7 +260,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) TimerBarRow& row = mHoverBarIndex == 0 ? mAverageTimerRow : mTimerBarRows[mScrollIndex + mHoverBarIndex - 1]; TimerBar* hover_bar = NULL; - LLUnit<F32, LLUnits::Seconds> mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; + LLUnits::F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; for (int bar_index = 0, end_index = LLInstanceTracker<LLTrace::TimeBlock>::instanceCount(); bar_index < end_index; ++bar_index) @@ -996,7 +996,7 @@ void LLFastTimerView::printLineStats() } first = false; - LLUnit<F32, LLUnits::Seconds> ticks; + LLUnits::F32Seconds ticks; if (mStatsIndex == 0) { ticks = mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH); @@ -1029,7 +1029,7 @@ void LLFastTimerView::drawLineGraph() LLLocalClipRect clip(mGraphRect); //normalize based on last frame's maximum - static LLUnit<F32, LLUnits::Seconds> max_time = 0.000001; + static LLUnits::F32Seconds max_time(0.000001); static U32 max_calls = 0; static F32 alpha_interp = 0.f; @@ -1060,7 +1060,7 @@ void LLFastTimerView::drawLineGraph() } } - LLUnit<F32, LLUnits::Seconds> cur_max = 0; + LLUnits::F32Seconds cur_max(0); U32 cur_max_calls = 0; for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); it != end_timer_tree(); @@ -1101,7 +1101,7 @@ void LLFastTimerView::drawLineGraph() j--) { LLTrace::Recording& recording = mRecording.getPrevRecording(j); - LLUnit<F32, LLUnits::Seconds> time = llmax(recording.getSum(*idp), LLUnits::Seconds::fromValue(0.000001)); + LLUnits::F32Seconds time = llmax(recording.getSum(*idp), LLUnits::F64Seconds(0.000001)); U32 calls = recording.getSum(idp->callCount()); if (is_hover_timer) @@ -1146,7 +1146,7 @@ void LLFastTimerView::drawLineGraph() max_time = lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); if (llabs((max_time - cur_max).value()) <= 1) { - max_time = llmax(LLUnits::Microseconds::fromValue(1.f), LLUnits::Microseconds::fromValue(cur_max)); + max_time = llmax(LLUnits::F32Microseconds(1.f), LLUnits::F32Microseconds(cur_max)); } max_calls = llround(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f))); @@ -1230,7 +1230,7 @@ void LLFastTimerView::drawLegend() llassert(idp->getIndex() < sTimerColors.size()); gl_rect_2d(bar_rect, sTimerColors[idp->getIndex()]); - LLUnit<F32, LLUnits::Milliseconds> ms = 0; + LLUnit<F32, LLUnits::Milliseconds> ms(0); S32 calls = 0; if (mHoverBarIndex > 0 && mHoverID) { @@ -1240,7 +1240,7 @@ void LLFastTimerView::drawLegend() } else { - ms = LLUnit<F64, LLUnits::Seconds>(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH)); + ms = LLUnits::F64Seconds(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH)); calls = (S32)mRecording.getPeriodMean(idp->callCount(), RUNNING_AVERAGE_WIDTH); } @@ -1423,7 +1423,7 @@ void LLFastTimerView::updateTotalTime() mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME, 20); break; default: - mTotalTimeDisplay = LLUnits::Milliseconds::fromValue(100); + mTotalTimeDisplay = LLUnits::F64Milliseconds(100); break; } @@ -1511,14 +1511,14 @@ void LLFastTimerView::drawBars() static LLFastTimer::DeclareTimer FTM_UPDATE_TIMER_BAR_WIDTHS("Update timer bar widths"); -LLUnit<F32, LLUnits::Seconds> LLFastTimerView::updateTimerBarWidths(LLTrace::TimeBlock* time_block, TimerBarRow& row, S32 history_index, U32& bar_index) +LLUnits::F32Seconds LLFastTimerView::updateTimerBarWidths(LLTrace::TimeBlock* time_block, TimerBarRow& row, S32 history_index, U32& bar_index) { LLFastTimer _(FTM_UPDATE_TIMER_BAR_WIDTHS); - const LLUnit<F32, LLUnits::Seconds> self_time = history_index == -1 + const LLUnits::F32Seconds self_time = history_index == -1 ? mRecording.getPeriodMean(time_block->selfTime(), RUNNING_AVERAGE_WIDTH) : mRecording.getPrevRecording(history_index).getSum(time_block->selfTime()); - LLUnit<F32, LLUnits::Seconds> full_time = self_time; + LLUnits::F32Seconds full_time = self_time; // reserve a spot for this bar to be rendered before its children // even though we don't know its size yet @@ -1544,7 +1544,7 @@ S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::TimeBlock* time_block, Timer LLFastTimer _(FTM_UPDATE_TIMER_BAR_FRACTIONS); TimerBar& timer_bar = row.mBars[timer_bar_index]; - const LLUnit<F32, LLUnits::Seconds> bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime; + const LLUnits::F32Seconds bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime; timer_bar.mChildrenStart = timer_bar.mSelfStart + timer_bar.mSelfTime / 2; timer_bar.mChildrenEnd = timer_bar.mChildrenStart + timer_bar.mTotalTime - timer_bar.mSelfTime; diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 9d88bb2d3f..8f61a2fc87 100755 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -87,7 +87,7 @@ private: mFirstChild(false), mLastChild(false) {} - LLUnit<F32, LLUnits::Seconds> mTotalTime, + LLUnits::F32Seconds mTotalTime, mSelfTime, mChildrenStart, mChildrenEnd, @@ -113,7 +113,7 @@ private: TimerBar* mBars; }; - LLUnit<F32, LLUnits::Seconds> updateTimerBarWidths(LLTrace::TimeBlock* time_block, TimerBarRow& row, S32 history_index, U32& bar_index); + LLUnits::F32Seconds updateTimerBarWidths(LLTrace::TimeBlock* time_block, TimerBarRow& row, S32 history_index, U32& bar_index); S32 updateTimerBarOffsets(LLTrace::TimeBlock* time_block, TimerBarRow& row, S32 timer_bar_index = 0); S32 drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered = false, bool visible = true, S32 bar_index = 0); void setPauseState(bool pause_state); @@ -128,7 +128,7 @@ private: DISPLAY_HZ } mDisplayType; bool mPauseHistory; - LLUnit<F64, LLUnits::Seconds> mAllTimeMax, + LLUnits::F64Seconds mAllTimeMax, mTotalTimeDisplay; S32 mScrollIndex, mHoverBarIndex, diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index f0c7a220a4..d16c2d3984 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -525,7 +525,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - LLUnit<F64, LLUnits::Seconds> frame_time; + LLUnits::F64Seconds frame_time; os << "Stat"; for (S32 frame = 1; frame <= frame_count; frame++) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3335ff6631..3a3731d519 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1429,7 +1429,7 @@ bool idle_startup() LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL; gFrameTime = totalTime(); - LLUnit<F32, LLUnits::Seconds> last_time = gFrameTimeSeconds; + LLUnits::F32Seconds last_time = gFrameTimeSeconds; gFrameTimeSeconds = (gFrameTime - gStartTime); gFrameIntervalSeconds = gFrameTimeSeconds - last_time; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 17703fcc21..0e6ef76845 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1888,12 +1888,11 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (log_to_viewer_log || log_to_sim) { - U64 timeNow = LLTimer::getTotalTime(); mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime.value()); mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP); mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize); mFetcher->mTextureInfo.setRequestOffset(mID, mRequestedOffset); - mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); + mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, LLTimer::getTotalTime()); } bool success = true; @@ -2394,7 +2393,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mFetcherLocked(FALSE) { mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); - mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), LLUnits::Bytes::fromValue(gSavedSettings.getU32("TextureLoggingThreshold"))); + mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), LLUnits::U32Bytes(gSavedSettings.getU32("TextureLoggingThreshold"))); LLTextureFetchDebugger::sDebuggerEnabled = gSavedSettings.getBOOL("TextureFetchDebuggerEnabled"); if(LLTextureFetchDebugger::isEnabled()) @@ -2762,7 +2761,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, discard_level = worker->mDecodedDiscard; raw = worker->mRawImage; aux = worker->mAuxImage; - LLUnit<F32, LLUnits::Seconds> cache_read_time = worker->mCacheReadTime; + LLUnits::F32Seconds cache_read_time(worker->mCacheReadTime); if (cache_read_time != 0.f) { record(sCacheReadLatency, cache_read_time); diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index cd6e7ff464..9dee92bf12 100755 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -219,11 +219,11 @@ void LLTextureInfo::resetTextureStatistics() mCurrentStatsBundleStartTime = LLTimer::getTotalTime(); } -LLUnit<U32, LLUnits::Microseconds> LLTextureInfo::getRequestStartTime(const LLUUID& id) +LLUnits::U32Microseconds LLTextureInfo::getRequestStartTime(const LLUUID& id) { if (!has(id)) { - return 0; + return LLUnits::U32Microseconds(0); } else { @@ -236,7 +236,7 @@ LLUnit<U32, LLUnits::Bytes> LLTextureInfo::getRequestSize(const LLUUID& id) { if (!has(id)) { - return 0; + return LLUnits::U32Bytes(0); } else { @@ -275,7 +275,7 @@ LLUnit<U32, LLUnits::Microseconds> LLTextureInfo::getRequestCompleteTime(const L { if (!has(id)) { - return 0; + return LLUnits::U32Microseconds(0); } else { diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 501914a52f..c94064df5f 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -587,7 +587,7 @@ void LLGLTexMemBar::draw() left = 550; LLUnit<F32, LLUnits::Kibibits> bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); - LLUnit<F32, LLUnits::Kibibits> max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); + LLUnit<F32, LLUnits::Kibibits> max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS")); color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; color[VALPHA] = text_color[VALPHA]; text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value()); diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 579567bb14..b176c69691 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -233,7 +233,7 @@ namespace LLViewerAssetStatsFF &sDequeuedAssetRequestsOther }; - static LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> > sResponseAssetRequestsTempTextureHTTP ("assetresponsetimestemptexturehttp", + static LLTrace::EventStatHandle<LLUnits::F64Seconds > 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::EventStatHandle<LLUnit<F64, LLUnits::Seconds> >* sResponse[EVACCount] = { + static LLTrace::EventStatHandle<LLUnits::F64Seconds >* sResponse[EVACCount] = { &sResponseAssetRequestsTempTextureHTTP, &sResponseAssetRequestsTempTextureUDP, &sResponseAssetRequestsNonTempTextureHTTP, diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e8f68527e9..a8183e76b4 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -999,9 +999,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) // Time _can_ go backwards, for example if the user changes the system clock. // It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here. // llassert(time > gFrameTime); - LLUnit<F64, LLUnits::Seconds> time_diff = time - gFrameTime; + LLUnits::F64Seconds time_diff = time - gFrameTime; gFrameTime = time; - LLUnit<F64, LLUnits::Seconds> time_since_start = gFrameTime - gStartTime; + LLUnits::F64Seconds time_since_start = gFrameTime - gStartTime; gFrameTimeSeconds = time_since_start; gFrameIntervalSeconds = gFrameTimeSeconds - last_time; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 8cb519b098..568d4b42ca 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -104,7 +104,7 @@ LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibytes> > MESSAGE_SYSTEM_DATA_IN("messagedatain", "Incoming message system network data"), MESSAGE_SYSTEM_DATA_OUT("messagedataout", "Outgoing message system network data"); -LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> > +LLTrace::CountStatHandle<LLUnits::F64Seconds > 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%"); @@ -194,7 +194,7 @@ LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > REGION_CROSSING_TI REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), RENDER_STACKTIME("renderstacktime", "RENDER_SECS"); -LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"), +LLTrace::EventStatHandle<LLUnits::F64Seconds > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"), TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), FPS_10_TIME("fps10time", "Seconds below 10 FPS"), @@ -219,7 +219,7 @@ void LLViewerStats::resetStats() LLViewerStats::instance().mRecording.reset(); } -void LLViewerStats::updateFrameStats(const LLUnit<F64, LLUnits::Seconds> time_diff) +void LLViewerStats::updateFrameStats(const LLUnits::F64Seconds time_diff) { if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > 5.0) { @@ -299,13 +299,13 @@ F32 gAveLandCompression = 0.f, gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f; -LLUnit<U32, LLUnits::Bytes> gTotalWorldData = 0, - gTotalObjectData = 0, - gTotalTextureData = 0; +LLUnits::U32Bytes gTotalWorldData, + gTotalObjectData, + gTotalTextureData; U32 gSimPingCount = 0; -LLUnit<U32, LLUnits::Bits> gObjectData = 0; +LLUnits::U32Bits gObjectData; F32 gAvgSimPing = 0.f; -LLUnit<U32, LLUnits::Bytes> gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0}; +LLUnits::U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {LLUnits::U32Bytes(0)}; extern U32 gVisCompared; extern U32 gVisTested; @@ -345,8 +345,8 @@ void update_statistics() typedef LLInstanceTracker<LLTrace::TraceType<LLTrace::TimeBlockAccumulator>, std::string> trace_type_t; - LLUnit<F64, LLUnits::Seconds> idle_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Idle")); - LLUnit<F64, LLUnits::Seconds> network_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Network")); + LLUnits::F64Seconds idle_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Idle")); + LLUnits::F64Seconds network_secs = last_frame_recording.getSum(*trace_type_t::getInstance("Network")); record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*trace_type_t::getInstance("Frame"))); record(LLStatViewer::UPDATE_STACKTIME, idle_secs - network_secs); @@ -364,7 +364,7 @@ void update_statistics() } else { - sample(LLStatViewer::SIM_PING, LLUnits::Seconds::fromValue(10)); + sample(LLStatViewer::SIM_PING, LLUnits::U32Seconds(10)); } if (LLViewerStats::instance().getRecording().getSum(LLStatViewer::FPS)) diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index b580606326..2cea575252 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -150,7 +150,7 @@ extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibytes> > ACTIVE_MESSAGE MESSAGE_SYSTEM_DATA_IN, MESSAGE_SYSTEM_DATA_OUT; -extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> > SIM_20_FPS_TIME, +extern LLTrace::CountStatHandle<LLUnits::F64Seconds > SIM_20_FPS_TIME, SIM_PHYSICS_20_FPS_TIME, LOSS_5_PERCENT_TIME; @@ -233,7 +233,7 @@ extern LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > REGION_CROS REBUILD_STACKTIME, RENDER_STACKTIME; -extern LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> > AVATAR_EDIT_TIME, +extern LLTrace::EventStatHandle<LLUnits::F64Seconds > AVATAR_EDIT_TIME, TOOLBOX_TIME, MOUSELOOK_TIME, FPS_10_TIME, @@ -254,7 +254,7 @@ public: LLViewerStats(); ~LLViewerStats(); - void updateFrameStats(const LLUnit<F64, LLUnits::Seconds> time_diff); + void updateFrameStats(const LLUnits::F64Seconds time_diff); void addToMessage(LLSD &body); @@ -370,7 +370,7 @@ public: private: LLTrace::Recording mRecording; - LLUnit<F64, LLUnits::Seconds> mLastTimeDiff; // used for time stat updates + LLUnits::F64Seconds mLastTimeDiff; // used for time stat updates }; static const F32 SEND_STATS_PERIOD = 300.0f; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index eb8faacac2..c780814e50 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -63,8 +63,8 @@ /////////////////////////////////////////////////////////////////////////////// // extern -const LLUnit<S32, LLUnits::Mibibytes> gMinVideoRam = 32; -const LLUnit<S32, LLUnits::Mibibytes> gMaxVideoRam = 512; +const LLUnit<S32, LLUnits::Mibibytes> gMinVideoRam(32); +const LLUnit<S32, LLUnits::Mibibytes> gMaxVideoRam(512); // statics @@ -86,11 +86,11 @@ S32 LLViewerTexture::sAuxCount = 0; LLFrameTimer LLViewerTexture::sEvaluationTimer; F32 LLViewerTexture::sDesiredDiscardBias = 0.f; F32 LLViewerTexture::sDesiredDiscardScale = 1.1f; -LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sBoundTextureMemory = 0; -LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sTotalTextureMemory = 0; -LLUnit<S32, LLUnits::Mibibytes> LLViewerTexture::sMaxBoundTextureMem = 0; -LLUnit<S32, LLUnits::Mibibytes> LLViewerTexture::sMaxTotalTextureMem = 0; -LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sMaxDesiredTextureMem = 0 ; +LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sBoundTextureMemory; +LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sTotalTextureMemory; +LLUnit<S32, LLUnits::Mibibytes> LLViewerTexture::sMaxBoundTextureMem; +LLUnit<S32, LLUnits::Mibibytes> LLViewerTexture::sMaxTotalTextureMem; +LLUnit<S32, LLUnits::Bytes> LLViewerTexture::sMaxDesiredTextureMem; S8 LLViewerTexture::sCameraMovingDiscardBias = 0 ; F32 LLViewerTexture::sCameraMovingBias = 0.0f ; S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size @@ -530,10 +530,10 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity LLViewerMediaTexture::updateClass() ; } - sBoundTextureMemory = LLImageGL::sBoundTextureMemory;//in bytes - sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;//in bytes - sMaxBoundTextureMem = gTextureList.getMaxResidentTexMem();//in MB - sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem() ;//in MB + sBoundTextureMemory = LLImageGL::sBoundTextureMemory; + sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; + sMaxBoundTextureMem = gTextureList.getMaxResidentTexMem(); + sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem(); sMaxDesiredTextureMem = sMaxTotalTextureMem ; //in Bytes, by default and when total used texture memory is small. if (sBoundTextureMemory >= sMaxBoundTextureMem || diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 63debe0464..2030b490e4 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1327,7 +1327,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) mMaxTotalTextureMemInMegaBytes = mMaxResidentTexMemInMegaBytes * 2; if (mMaxResidentTexMemInMegaBytes > 640) { - mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2); + mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes / 4); } //system mem diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 5b6e927e32..673b55be69 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -101,8 +101,8 @@ public: void setUpdateStats(BOOL b) { mUpdateStats = b; } - S32 getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } - S32 getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} + LLUnit<S32, LLUnits::Mibibytes> getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } + LLUnit<S32, LLUnits::Mibibytes> getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} S32 getNumImages() { return mImageList.size(); } void updateMaxResidentTexMem(S32 mem); @@ -200,8 +200,8 @@ private: BOOL mInitialized ; BOOL mUpdateStats; - S32 mMaxResidentTexMemInMegaBytes; - S32 mMaxTotalTextureMemInMegaBytes; + LLUnit<S32, LLUnits::Mibibytes> mMaxResidentTexMemInMegaBytes; + LLUnit<S32, LLUnits::Mibibytes> mMaxTotalTextureMemInMegaBytes; LLFrameTimer mForceDecodeTimer; private: diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 916dec86aa..22de7e150b 100755 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -48,8 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f; const F32 MIN_BANDWIDTH = 50.f; const F32 MAX_BANDWIDTH = 3000.f; const F32 STEP_FRACTIONAL = 0.1f; -const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s -const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s +const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD(3.0f); // packet loss % per s +const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD(0.5f); // packet loss % per s const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds LLViewerThrottle gViewerThrottle; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 12b9744b24..66206fe53e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -899,7 +899,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) if (mLastRegionHandle != 0) { ++mRegionCrossingCount; - LLUnit<F64, LLUnits::Seconds> delta = mRegionCrossingTimer.getElapsedTimeF32(); + LLUnits::F64Seconds delta(mRegionCrossingTimer.getElapsedTimeF32()); record(LLStatViewer::REGION_CROSSING_TIME, delta); // Diagnostics diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5e8a771929..31b7e5a01c 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6547,7 +6547,7 @@ void LLVivoxVoiceClient::expireVoiceFonts() // Give a warning notification if any voice fonts are due to expire. if (will_expire) { - LLUnit<S32, LLUnits::Seconds> seconds = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); + LLUnit<S32, LLUnits::Seconds> seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime")); args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value()); LLNotificationsUtil::add("VoiceEffectsWillExpire", args); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 7e4e80240d..38818e242b 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -717,7 +717,7 @@ void LLWorld::renderPropertyLines() void LLWorld::updateNetStats() { - LLUnit<F64, LLUnits::Bits> bits = 0.f; + LLUnits::F64Bits bits; U32 packets = 0; for (region_list_t::iterator iter = mActiveRegionList.begin(); @@ -735,8 +735,8 @@ void LLWorld::updateNetStats() S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut; S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost; - LLUnit<F64, LLUnits::Bits> actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits(); - LLUnit<F64, LLUnits::Bits> actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); + LLUnit<F64, LLUnits::Bits> actual_in_bits(gMessageSystem->mPacketRing.getAndResetActualInBits()); + LLUnit<F64, LLUnits::Bits> actual_out_bits(gMessageSystem->mPacketRing.getAndResetActualOutBits()); add(LLStatViewer::MESSAGE_SYSTEM_DATA_IN, actual_in_bits); add(LLStatViewer::MESSAGE_SYSTEM_DATA_OUT, actual_out_bits); |