From 075a7bcc980b0ca0d2888d344b6afa8ab5b52d85 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 18 Jul 2013 15:09:45 -0700 Subject: SH-4297 WIP interesting: viewer-interesting starts loading cached scene late dependency cleanup - removed a lot of unecessary includes --- indra/llimage/llimagej2c.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llimage/llimagej2c.cpp') diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5412f98ee5..65cdcd6923 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -24,6 +24,7 @@ */ #include "linden_common.h" +#include "llapr.h" #include "lldir.h" #include "llimagej2c.h" #include "lltimer.h" -- cgit v1.3 From e40065f82c797eab41006a448c838f4f1089a2e8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Jul 2013 15:03:05 -0700 Subject: BUILDFIX: #include and dependency cleanup --- indra/llcommon/llcommonutils.h | 2 + indra/llcommon/llcriticaldamp.cpp | 2 +- indra/llcommon/llcriticaldamp.h | 4 +- indra/llcommon/lldate.cpp | 2 +- indra/llcommon/lldate.h | 2 +- indra/llcommon/llfasttimer.cpp | 22 +++---- indra/llcommon/llinitparam.h | 1 + indra/llcommon/llsdutil.h | 2 +- indra/llcommon/llstring.cpp | 1 + indra/llcommon/llstring.h | 6 +- indra/llcommon/llsys.cpp | 6 +- indra/llcommon/lltraceaccumulators.h | 1 + indra/llcommon/lltracerecording.cpp | 38 ++++++------ indra/llcommon/llunit.h | 110 ++++++++++++++++++++--------------- indra/llcommon/lluuid.h | 1 + indra/llimage/llimagej2c.cpp | 1 + indra/llmath/llcalcparser.h | 5 +- indra/llprimitive/llmaterialid.h | 1 + indra/llrender/llimagegl.cpp | 8 +-- indra/llui/llnotificationsutil.h | 1 + indra/llui/lltrans.h | 1 + indra/llxml/llxmlnode.h | 3 +- indra/newview/llscenemonitor.cpp | 14 ++--- indra/newview/llscenemonitor.h | 36 ++++++------ 24 files changed, 144 insertions(+), 126 deletions(-) (limited to 'indra/llimage/llimagej2c.cpp') diff --git a/indra/llcommon/llcommonutils.h b/indra/llcommon/llcommonutils.h index 755dc41fb4..20ada27830 100755 --- a/indra/llcommon/llcommonutils.h +++ b/indra/llcommon/llcommonutils.h @@ -27,6 +27,8 @@ #ifndef LL_LLCOMMONUTILS_H #define LL_LLCOMMONUTILS_H +#include "lluuid.h" + namespace LLCommonUtils { /** diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp index 575fc4149e..5ffad88973 100755 --- a/indra/llcommon/llcriticaldamp.cpp +++ b/indra/llcommon/llcriticaldamp.cpp @@ -81,7 +81,7 @@ void LLSmoothInterpolation::updateInterpolants() //----------------------------------------------------------------------------- // getInterpolant() //----------------------------------------------------------------------------- -F32 LLSmoothInterpolation::getInterpolant(LLUnit time_constant, bool use_cache) +F32 LLSmoothInterpolation::getInterpolant(LLUnitImplicit time_constant, bool use_cache) { if (time_constant == 0.f) { diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h index e174643cd0..7b2a414459 100755 --- a/indra/llcommon/llcriticaldamp.h +++ b/indra/llcommon/llcriticaldamp.h @@ -42,10 +42,10 @@ public: static void updateInterpolants(); // ACCESSORS - static F32 getInterpolant(LLUnit time_constant, bool use_cache = true); + static F32 getInterpolant(LLUnitImplicit time_constant, bool use_cache = true); template - static T lerp(T a, T b, LLUnit time_constant, bool use_cache = true) + static T lerp(T a, T b, LLUnitImplicit time_constant, bool use_cache = true) { F32 interpolant = getInterpolant(time_constant, use_cache); return ((a * (1.f - interpolant)) diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 7892269e35..cec4047c1f 100755 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -55,7 +55,7 @@ LLDate::LLDate(const LLDate& date) : mSecondsSinceEpoch(date.mSecondsSinceEpoch) {} -LLDate::LLDate(LLUnit seconds_since_epoch) : +LLDate::LLDate(LLUnitImplicit seconds_since_epoch) : mSecondsSinceEpoch(seconds_since_epoch.value()) {} diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 1067ac5280..816bc62b14 100755 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -59,7 +59,7 @@ public: * * @param seconds_since_epoch The number of seconds since UTC epoch. */ - LLDate(LLUnit seconds_since_epoch); + LLDate(LLUnitImplicit seconds_since_epoch); /** * @brief Construct a date from a string representation diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 79aa0c8722..6f046c18ff 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -111,9 +111,9 @@ static timer_tree_dfs_iterator_t end_timer_tree() struct SortTimerByName { bool operator()(const TimeBlock* i1, const TimeBlock* i2) - { + { return i1->getName() < i2->getName(); - } + } }; TimeBlock& TimeBlock::getRootTimeBlock() @@ -227,17 +227,17 @@ void TimeBlock::incrementalUpdateTimerTree() if (accumulator->mMoveUpTree) { - // since ancestors have already been visited, re-parenting won't affect tree traversal + // since ancestors have already been visited, re-parenting won't affect tree traversal //step up tree, bringing our descendants with us LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() << " to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL; timerp->setParent(timerp->getParent()->getParent()); - accumulator->mParent = timerp->getParent(); - accumulator->mMoveUpTree = false; + accumulator->mParent = timerp->getParent(); + accumulator->mMoveUpTree = false; // don't bubble up any ancestors until descendants are done bubbling up - // as ancestors may call this timer only on certain paths, so we want to resolve - // child-most block locations before their parents + // as ancestors may call this timer only on certain paths, so we want to resolve + // child-most block locations before their parents it.skipAncestors(); } } @@ -357,7 +357,7 @@ void TimeBlock::logStats() // doesn't work correctly on the first frame total_time += frame_recording.getLastRecording().getSum(timer); } - } +} sd["Total"]["Time"] = (LLSD::Real) total_time.value(); sd["Total"]["Calls"] = (LLSD::Integer) 1; @@ -366,7 +366,7 @@ void TimeBlock::logStats() LLMutexLock lock(sLogLock); sLogQueue.push(sd); } - } +} } @@ -413,7 +413,7 @@ void TimeBlock::writeLog(std::ostream& os) LLSDSerialize::toXML(sd, os); LLMutexLock lock(sLogLock); sLogQueue.pop(); - } + } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -470,7 +470,7 @@ LLUnit BlockTimer::getElapsedTime() { U64 total_time = TimeBlock::getCPUClockCount64() - mStartTime; - return (F64)total_time / (F64)TimeBlock::countsPerSecond(); + return LLUnits::Seconds::fromValue((F64)total_time / (F64)TimeBlock::countsPerSecond()); } diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 879ea4fe2a..812071efdd 100755 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -38,6 +38,7 @@ #include "llerror.h" #include "llstl.h" #include "llpredicate.h" +#include "llsd.h" namespace LLTypeTags { diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 532d3f9341..d0b536c39a 100755 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -29,7 +29,7 @@ #ifndef LL_LLSDUTIL_H #define LL_LLSDUTIL_H -class LLSD; +#include "llsd.h" // U32 LL_COMMON_API LLSD ll_sd_from_U32(const U32); diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 66c416bfdd..6f92c7d5d4 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -29,6 +29,7 @@ #include "llstring.h" #include "llerror.h" #include "llfasttimer.h" +#include "llsd.h" #if LL_WINDOWS #include "llwin32headerslean.h" diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 17893c1910..fdf9f3ce89 100755 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -29,10 +29,11 @@ #include #include -#include +//#include #include #include -#include "llsd.h" +#include +#include #include "llformat.h" #if LL_LINUX || LL_SOLARIS @@ -50,6 +51,7 @@ #endif const char LL_UNKNOWN_CHAR = '?'; +class LLSD; #if LL_DARWIN || LL_LINUX || LL_SOLARIS // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 5d805ba841..8d2045dfa0 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1396,13 +1396,13 @@ public: << " seconds "; } - S32 precision = LL_CONT.precision(); + S32 precision = LL_CONT.precision(); LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' << LLMemoryInfo(); - LL_CONT.precision(precision); - LL_CONT << LL_ENDL; + LL_CONT.precision(precision); + LL_CONT << LL_ENDL; return false; } diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index a2f9f4c090..efc8b43f6a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -34,6 +34,7 @@ #include "lltimer.h" #include "llrefcount.h" #include "llthreadlocalstorage.h" +#include namespace LLTrace { diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 48b5a7c3fa..2150a44f12 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -95,7 +95,7 @@ void Recording::handleReset() { mBuffers.write()->reset(); - mElapsedSeconds = 0.0; + mElapsedSeconds = LLUnits::Seconds::fromValue(0.0); mSamplingTimer.reset(); } @@ -131,14 +131,14 @@ void Recording::appendRecording( Recording& other ) LLUnit Recording::getSum(const TraceType& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) - / (F64)LLTrace::TimeBlock::countsPerSecond(); + return LLUnits::Seconds::fromValue((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) + / (F64)LLTrace::TimeBlock::countsPerSecond()); } LLUnit Recording::getSum(const TraceType& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return (F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond(); + return LLUnits::Seconds::fromValue((F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond()); } @@ -151,16 +151,16 @@ LLUnit Recording::getPerSec(const TraceTypemStackTimers[stat.getIndex()]; - return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) - / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value()); + return LLUnits::Seconds::fromValue((F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter) + / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value())); } LLUnit Recording::getPerSec(const TraceType& stat) { const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - return (F64)(accumulator.mSelfTimeCounter) - / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value()); + return LLUnits::Seconds::fromValue((F64)(accumulator.mSelfTimeCounter) + / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds.value())); } F32 Recording::getPerSec(const TraceType& stat) @@ -170,52 +170,52 @@ F32 Recording::getPerSec(const TraceType& LLUnit Recording::getMin(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mSize.getMin(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); } LLUnit Recording::getMean(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mSize.getMean(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMean()); } LLUnit Recording::getMax(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mSize.getMax(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getMax()); } LLUnit Recording::getStandardDeviation(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation()); } LLUnit Recording::getLastValue(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue()); } LLUnit Recording::getMin(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mChildSize.getMin(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMin()); } LLUnit Recording::getMean(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mChildSize.getMean(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMean()); } LLUnit Recording::getMax(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mChildSize.getMax(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getMax()); } LLUnit Recording::getStandardDeviation(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mChildSize.getStandardDeviation(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getStandardDeviation()); } LLUnit Recording::getLastValue(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mChildSize.getLastValue(); + return LLUnits::Bytes::fromValue(mBuffers->mMemStats[stat.getIndex()].mChildSize.getLastValue()); } U32 Recording::getSum(const TraceType& stat) @@ -603,7 +603,7 @@ F64 PeriodicRecording::getPeriodMean( const TraceType& stat, size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - LLUnit total_duration = 0.f; + LLUnit total_duration(0.f); F64 mean = 0; if (num_periods <= 0) { return mean; } diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 51f14a5948..f81e746c77 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -141,8 +141,17 @@ protected: template std::ostream& operator <<(std::ostream& s, const LLUnit& unit) { - s << unit.value() << UNIT_TYPE::getUnitLabel(); - return s; + s << unit.value() << UNIT_TYPE::getUnitLabel(); + return s; +} + +template +std::istream& operator >>(std::istream& s, LLUnit& unit) +{ + STORAGE_TYPE val; + s >> val; + unit = val; + return s; } template @@ -172,8 +181,17 @@ struct LLUnitImplicit : public LLUnit template std::ostream& operator <<(std::ostream& s, const LLUnitImplicit& unit) { - s << unit.value() << UNIT_TYPE::getUnitLabel(); - return s; + s << unit.value() << UNIT_TYPE::getUnitLabel(); + return s; +} + +template +std::istream& operator >>(std::istream& s, LLUnitImplicit& unit) +{ + STORAGE_TYPE val; + s >> val; + unit = val; + return s; } template @@ -201,7 +219,7 @@ LL_FORCE_INLINE void ll_convert_units(LLUnit in, LLUnit& out, .. { // T1 and T2 fully reduced and equal...just copy - out = (S2)in.value(); + out = LLUnit((S2)in.value()); } else { @@ -447,33 +465,33 @@ template struct LLUnitLinearOps { typedef LLUnitLinearOps self_t; - LLUnitLinearOps(VALUE_TYPE val) : mValue (val) {} + LLUnitLinearOps(VALUE_TYPE val) : mResult (val) {} - operator VALUE_TYPE() const { return mValue; } - VALUE_TYPE mValue; + operator VALUE_TYPE() const { return mResult; } + VALUE_TYPE mResult; template self_t operator * (T other) { - return mValue * other; + return mResult * other; } template self_t operator / (T other) { - return mValue / other; + return mResult / other; } template self_t operator + (T other) { - return mValue + other; + return mResult + other; } template self_t operator - (T other) { - return mValue - other; + return mResult - other; } }; @@ -482,32 +500,32 @@ struct LLUnitInverseLinearOps { typedef LLUnitInverseLinearOps self_t; - LLUnitInverseLinearOps(VALUE_TYPE val) : mValue (val) {} - operator VALUE_TYPE() const { return mValue; } - VALUE_TYPE mValue; + LLUnitInverseLinearOps(VALUE_TYPE val) : mResult (val) {} + operator VALUE_TYPE() const { return mResult; } + VALUE_TYPE mResult; template self_t operator * (T other) { - return mValue / other; + return mResult / other; } template self_t operator / (T other) { - return mValue * other; + return mResult * other; } template self_t operator + (T other) { - return mValue - other; + return mResult - other; } template self_t operator - (T other) { - return mValue + other; + return mResult + other; } }; @@ -521,35 +539,31 @@ struct base_unit_name template \ static LLUnit fromValue(LLUnit value) \ { return LLUnit(value); } \ -}; \ -template std::ostream& operator<<(std::ostream& s, const LLUnit& 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 \ - static LLUnit fromValue(T value) { return LLUnit(value); } \ - template \ - static LLUnit fromValue(LLUnit value) \ - { return LLUnit(value); } \ -}; \ -template std::ostream& operator<<(std::ostream& s, const LLUnit& val) \ -{ s << val.value() << unit_name::getUnitLabel; return s; } \ - \ -template \ -void ll_convert_units(LLUnit in, LLUnit& out) \ -{ \ - out = (S2)(LLUnitLinearOps(in.value()) conversion_operation).mValue; \ -} \ - \ -template \ -void ll_convert_units(LLUnit in, LLUnit& out) \ -{ \ - out = (S2)(LLUnitInverseLinearOps(in.value()) conversion_operation).mValue; \ +} + + +#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 \ + static LLUnit fromValue(T value) { return LLUnit(value); } \ + template \ + static LLUnit fromValue(LLUnit value) \ + { return LLUnit(value); } \ +}; \ + \ +template \ +void ll_convert_units(LLUnit in, LLUnit& out) \ +{ \ + out = LLUnit((S2)(LLUnitLinearOps(in.value()) conversion_operation)); \ +} \ + \ +template \ +void ll_convert_units(LLUnit in, LLUnit& out) \ +{ \ + out = LLUnit((S2)(LLUnitInverseLinearOps(in.value()) conversion_operation)); \ } // diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 7889828c85..0699dcda83 100755 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -28,6 +28,7 @@ #include #include +#include #include "stdtypes.h" #include "llpreprocessor.h" diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 65cdcd6923..8e2bcc3f94 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -30,6 +30,7 @@ #include "lltimer.h" #include "llmath.h" #include "llmemory.h" +#include "llsd.h" typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index e0ad270266..faa699ff7b 100755 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -163,7 +163,7 @@ private: bool checkNaN(const F32& a) const { return !llisnan(a); } - //FIX* non ambigious function fix making SIN() work for calc -Cryogenic Blitz + //FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); } F32 _cos(const F32& a) const { return cos(DEG_TO_RAD * a); } F32 _tan(const F32& a) const { return tan(DEG_TO_RAD * a); } @@ -176,11 +176,8 @@ private: F32 _fabs(const F32& a) const { return fabs(a); } F32 _floor(const F32& a) const { return (F32)llfloor(a); } F32 _ceil(const F32& a) const { return llceil(a); } - F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } - - LLCalc::calc_map_t* mConstants; LLCalc::calc_map_t* mVariables; // LLCalc::calc_map_t* mUserVariables; diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 0a95204085..b4c82d3b7b 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -30,6 +30,7 @@ #define MATERIAL_ID_SIZE 16 #include +#include "llsd.h" class LLMaterialID { diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 01ed946d40..1d4be1f53c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -LLUnit LLImageGL::sGlobalTextureMemory = 0; -LLUnit LLImageGL::sBoundTextureMemory = 0; -LLUnit LLImageGL::sCurBoundTextureMemory = 0; +LLUnit LLImageGL::sGlobalTextureMemory(0); +LLUnit LLImageGL::sBoundTextureMemory(0); +LLUnit LLImageGL::sCurBoundTextureMemory(0); S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; @@ -249,7 +249,7 @@ void LLImageGL::updateStats(F32 current_time) LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; - sCurBoundTextureMemory = 0; + sCurBoundTextureMemory = LLUnits::Bytes::fromValue(0); } //static diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index 4093324d0c..9f29087b4a 100755 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -30,6 +30,7 @@ // to avoid including the heavyweight llnotifications.h #include "llnotificationptr.h" +#include "lluuid.h" #include diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h index 128b51d383..a47ce94f08 100755 --- a/indra/llui/lltrans.h +++ b/indra/llui/lltrans.h @@ -28,6 +28,7 @@ #define LL_TRANS_H #include +#include #include "llpointer.h" #include "llstring.h" diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index d7681c54a0..f7c32c4cf5 100755 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -42,12 +42,11 @@ #include "llstring.h" #include "llstringtable.h" #include "llfile.h" - +#include "lluuid.h" class LLVector3; class LLVector3d; class LLQuaternion; -class LLUUID; class LLColor4; class LLColor4U; diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3f4f872174..29dd140158 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -89,6 +89,7 @@ void LLSceneMonitor::reset() mMonitorRecording.reset(); mSceneLoadRecording.reset(); + mRecordingTimer.reset(); unfreezeScene(); @@ -259,7 +260,6 @@ void LLSceneMonitor::capture() static U32 last_capture_frame = 0; static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); - static LLFrameTimer timer; static bool force_capture = true; bool enabled = monitor_enabled || mDebugViewerVisible; @@ -288,7 +288,7 @@ void LLSceneMonitor::capture() force_capture = true; } - if((timer.getElapsedTimeF32() > scene_load_sample_time() + if((mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) && mEnabled && LLGLSLShader::sNoFixedFunction @@ -299,8 +299,6 @@ void LLSceneMonitor::capture() mSceneLoadRecording.resume(); mMonitorRecording.resume(); - timer.reset(); - last_capture_frame = gFrameCount; LLRenderTarget& cur_target = getCaptureTarget(); @@ -467,7 +465,6 @@ void LLSceneMonitor::fetchQueryResult() // also throttle timing here, to avoid going below sample time due to phasing with frame capture static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); - static LLFrameTimer timer; if(mDiffState == WAIT_ON_RESULT && !LLAppViewer::instance()->quitRequested()) @@ -483,11 +480,11 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) - LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; + LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); - F32 elapsed_time = timer.getElapsedTimeF32(); + F32 elapsed_time = mRecordingTimer.getElapsedTimeF32(); if (elapsed_time > scene_load_sample_time) { @@ -501,10 +498,9 @@ void LLSceneMonitor::fetchQueryResult() { mSceneLoadRecording.nextPeriod(); } + mRecordingTimer.reset(); } } - - timer.reset(); } } diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 7088d529d6..b857389243 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -72,8 +72,8 @@ private: void generateDitheringTexture(S32 width, S32 height); private: - bool mEnabled; - bool mDebugViewerVisible; + bool mEnabled, + mDebugViewerVisible; enum EDiffState { @@ -82,27 +82,27 @@ private: EXECUTE_DIFF, WAIT_ON_RESULT, VIEWER_QUITTING - } mDiffState; + } mDiffState; - LLRenderTarget* mFrames[2]; - LLRenderTarget* mDiff; + LLRenderTarget* mFrames[2]; + LLRenderTarget* mDiff; - GLuint mQueryObject; //used for glQuery - F32 mDiffResult; //aggregate results of mDiff. - F32 mDiffTolerance; //pixels are filtered out when R+G+B < mDiffTolerance + GLuint mQueryObject; //used for glQuery + F32 mDiffResult, //aggregate results of mDiff. + mDiffTolerance, //pixels are filtered out when R+G+B < mDiffTolerance + mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension - F32 mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension + LLPointer mDitheringTexture; + S32 mDitherMatrixWidth; + F32 mDitherScale, + mDitherScaleS, + mDitherScaleT; - LLPointer mDitheringTexture; - S32 mDitherMatrixWidth; - F32 mDitherScale; - F32 mDitherScaleS; - F32 mDitherScaleT; + std::vector mAvatarPauseHandles; - std::vector mAvatarPauseHandles; - - LLTrace::ExtendablePeriodicRecording mSceneLoadRecording; - LLTrace::Recording mMonitorRecording; + LLFrameTimer mRecordingTimer; + LLTrace::ExtendablePeriodicRecording mSceneLoadRecording; + LLTrace::Recording mMonitorRecording; }; class LLSceneMonitorView : public LLFloater -- cgit v1.3 From 12f0f8cb72f789e21b01b45063dcc5f1f5292087 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 13:46:43 -0700 Subject: changed over to manual naming of MemTrackable stats changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats --- indra/llcommon/lltrace.h | 298 +++++---------------- indra/llcommon/lltraceaccumulators.cpp | 5 + indra/llcommon/lltraceaccumulators.h | 36 +-- indra/llcommon/lltracerecording.cpp | 60 ----- indra/llcommon/lltracerecording.h | 16 -- indra/llcommon/llunittype.h | 1 + indra/llimage/llimage.cpp | 29 +- indra/llimage/llimagej2c.cpp | 1 + indra/llimage/llimagejpeg.cpp | 10 +- indra/llinventory/llinventory.cpp | 23 +- indra/llinventory/llinventory.h | 3 +- indra/llrender/llfontbitmapcache.cpp | 20 +- indra/llrender/llfontbitmapcache.h | 3 +- indra/llrender/llfontfreetype.cpp | 20 +- indra/llrender/llfontfreetype.h | 6 +- indra/llrender/llimagegl.cpp | 18 +- indra/llrender/llimagegl.h | 2 +- indra/llrender/llvertexbuffer.cpp | 7 +- indra/llrender/llvertexbuffer.h | 6 +- indra/llui/llfolderviewitem.cpp | 8 - indra/llui/llfolderviewmodel.h | 9 +- indra/llui/lltextbase.cpp | 16 +- indra/llui/lltextbase.h | 8 +- indra/llui/lluictrl.cpp | 40 ++- indra/llui/llview.cpp | 3 +- indra/llui/llview.h | 2 +- indra/llui/llviewmodel.cpp | 10 +- indra/newview/lldrawable.cpp | 5 +- indra/newview/lldrawable.h | 4 +- indra/newview/llviewerobject.cpp | 3 +- indra/newview/llviewerwindow.cpp | 3 + indra/newview/llvocache.cpp | 10 +- .../newview/skins/default/xui/en/floater_stats.xml | 37 +-- 33 files changed, 290 insertions(+), 432 deletions(-) (limited to 'indra/llimage/llimagej2c.cpp') diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index da4bf6e36b..226f64d0c7 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -35,6 +35,8 @@ #include "lltraceaccumulators.h" #include "llthreadlocalstorage.h" #include "lltimer.h" +#include "llpointer.h" +#include "llunits.h" #include @@ -206,39 +208,6 @@ public: {} }; -template<> -class TraceType - : public TraceType -{ -public: - - TraceType(const char* name, const char* description = "") - : TraceType(name, description) - {} -}; - -template<> -class TraceType - : public TraceType -{ -public: - - TraceType(const char* name, const char* description = "") - : TraceType(name, description) - {} -}; - -template<> -class TraceType - : public TraceType -{ -public: - - TraceType(const char* name, const char* description = "") - : TraceType(name, description) - {} -}; - class MemStatHandle : public TraceType { public: @@ -264,109 +233,40 @@ public: { return static_cast&>(*(TraceType*)this); } - - TraceType& shadowAllocations() - { - return static_cast&>(*(TraceType*)this); - } - - TraceType& shadowDeallocations() - { - return static_cast&>(*(TraceType*)this); - } - - TraceType& shadowMem() - { - return static_cast&>(*(TraceType*)this); - } }; -inline void claim_footprint(MemStatHandle& measurement, S32 size) -{ - if(size == 0) return; - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); - accumulator.mFootprintAllocations.record(size); -} - -inline void disclaim_footprint(MemStatHandle& measurement, S32 size) -{ - if(size == 0) return; - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); - accumulator.mFootprintDeallocations.add(size); -} - -inline void claim_shadow(MemStatHandle& measurement, S32 size) -{ - if(size == 0) return; - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mShadowSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); - accumulator.mShadowAllocations.record(size); -} - -inline void disclaim_shadow(MemStatHandle& measurement, S32 size) -{ - if(size == 0) return; - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mShadowSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); - accumulator.mShadowDeallocations.add(size); -} // measures effective memory footprint of specified type // specialize to cover different types - -template +template struct MeasureMem { static size_t measureFootprint(const T& value) { return sizeof(T); } - - static size_t measureFootprint() - { - return sizeof(T); - } - - static size_t measureShadow(const T& value) - { - return 0; - } - - static size_t measureShadow() - { - return 0; - } }; -template -struct MeasureMem +template +struct MeasureMem { static size_t measureFootprint(const T& value) { return sizeof(T) + value.getMemFootprint(); } +}; - static size_t measureFootprint() - { - return sizeof(T); - } - - static size_t measureShadow(const T& value) - { - return value.getMemShadow(); - } - - static size_t measureShadow() +template +struct MeasureMem +{ + static size_t measureFootprint(const T& value) { - return MeasureMem::measureShadow(); + return U32Bytes(value).value(); } }; - -template -struct MeasureMem +template +struct MeasureMem { static size_t measureFootprint(const T* value) { @@ -376,46 +276,68 @@ struct MeasureMem } return MeasureMem::measureFootprint(*value); } +}; - static size_t measureFootprint() +template +struct MeasureMem, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(const LLPointer value) { - return MeasureMem::measureFootprint(); + if (value.isNull()) + { + return 0; + } + return MeasureMem::measureFootprint(*value); } +}; - static size_t measureShadow(const T* value) +template +struct MeasureMem +{ + static size_t measureFootprint(S32 value) { - return MeasureMem::measureShadow(*value); + return value; } +}; - static size_t measureShadow() +template +struct MeasureMem +{ + static size_t measureFootprint(U32 value) { - return MeasureMem::measureShadow(); + return value; } }; -template -struct MeasureMem, IS_MEM_TRACKABLE> +template +struct MeasureMem, IS_MEM_TRACKABLE, IS_BYTES> { static size_t measureFootprint(const std::basic_string& value) { return value.capacity() * sizeof(T); } +}; - static size_t measureFootprint() - { - return sizeof(std::basic_string); - } - static size_t measureShadow(const std::basic_string& value) - { - return 0; - } +template +inline void claim_footprint(MemStatHandle& measurement, const T& value) +{ + S32 size = MeasureMem::measureFootprint(value); + if(size == 0) return; + MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); + accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); + accumulator.mFootprintAllocations.record(size); +} - static size_t measureShadow() - { - return 0; - } -}; +template +inline void disclaim_footprint(MemStatHandle& measurement, const T& value) +{ + S32 size = MeasureMem::measureFootprint(value); + if(size == 0) return; + MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); + accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); + accumulator.mFootprintDeallocations.add(size); +} template class MemTrackable @@ -423,28 +345,20 @@ class MemTrackable public: typedef void mem_trackable_tag_t; - enum EMemType - { - MEM_FOOTPRINT, - MEM_SHADOW - }; - - MemTrackable() - : mMemFootprint(0), - mMemShadow(0) + MemTrackable(const char* name) + : mMemFootprint(0) { static bool name_initialized = false; if (!name_initialized) { name_initialized = true; - sMemStat.setName(typeid(DERIVED).name()); + sMemStat.setName(name); } } virtual ~MemTrackable() { - disclaimMem(mMemFootprint, MEM_FOOTPRINT); - disclaimMem(mMemShadow, MEM_SHADOW); + disclaimMem(mMemFootprint); } static MemStatHandle& getMemStatHandle() @@ -453,7 +367,6 @@ public: } S32 getMemFootprint() const { return mMemFootprint; } - S32 getMemShadow() const { return mMemShadow; } void* operator new(size_t size) { @@ -467,7 +380,7 @@ public: ll_aligned_free(ALIGNMENT, ptr); } - void *operator new [](size_t size) + void* operator new [](size_t size) { claim_footprint(sMemStat, size); return ll_aligned_malloc(ALIGNMENT, size); @@ -481,98 +394,27 @@ public: // claim memory associated with other objects/data as our own, adding to our calculated footprint template - CLAIM_T& claimMem(CLAIM_T& value, EMemType mem_type = MEM_FOOTPRINT) - { - trackAlloc(MeasureMem::measureFootprint(value), mem_type); - trackAlloc(MeasureMem::measureShadow(value), MEM_SHADOW); - return value; - } - - template - const CLAIM_T& claimMem(const CLAIM_T& value, EMemType mem_type = MEM_FOOTPRINT) - { - trackAlloc(MeasureMem::measureFootprint(value), mem_type); - trackAlloc(MeasureMem::measureShadow(value), MEM_SHADOW); - return value; - } - - size_t& claimMem(size_t& size, EMemType mem_type = MEM_FOOTPRINT) - { - trackAlloc(size, mem_type); - return size; - } - - S32& claimMem(S32& size, EMemType mem_type = MEM_FOOTPRINT) + void claimMem(const CLAIM_T& value) const { - trackAlloc(size, mem_type); - return size; + S32 size = MeasureMem::measureFootprint(value); + claim_footprint(sMemStat, size); + mMemFootprint += size; } // remove memory we had claimed from our calculated footprint template - CLAIM_T& disclaimMem(CLAIM_T& value, EMemType mem_type = MEM_FOOTPRINT) - { - trackDealloc(MeasureMem::measureFootprint(value), mem_type); - trackDealloc(MeasureMem::measureShadow(value), MEM_SHADOW); - return value; - } - - template - const CLAIM_T& disclaimMem(const CLAIM_T& value, EMemType mem_type = MEM_FOOTPRINT) - { - trackDealloc(MeasureMem::measureFootprint(value), mem_type); - trackDealloc(MeasureMem::measureShadow(value), MEM_SHADOW); - return value; - } - - size_t& disclaimMem(size_t& size, EMemType mem_type = MEM_FOOTPRINT) + void disclaimMem(const CLAIM_T& value) const { - trackDealloc(size, mem_type); - return size; - } - - S32& disclaimMem(S32& size, EMemType mem_type = MEM_FOOTPRINT) - { - trackDealloc(size, mem_type); - return size; - } - -private: - - void trackAlloc(S32 size, EMemType mem_type) - { - if (mem_type == MEM_FOOTPRINT) - { - claim_footprint(sMemStat, size); - mMemFootprint += size; - } - else - { - claim_shadow(sMemStat, size); - mMemShadow += size; - } - } - - void trackDealloc(S32 size, EMemType mem_type) - { - if (mem_type == MEM_FOOTPRINT) - { - disclaim_footprint(sMemStat, size); - mMemFootprint -= size; - } - else - { - disclaim_shadow(sMemStat, size); - mMemShadow -= size; - } + S32 size = MeasureMem::measureFootprint(value); + disclaim_footprint(sMemStat, size); + mMemFootprint -= size; } private: // use signed values so that we can temporarily go negative // and reconcile in destructor // NB: this assumes that no single class is responsible for > 2GB of allocations - S32 mMemFootprint, - mMemShadow; + mutable S32 mMemFootprint; static MemStatHandle sMemStat; }; diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index a7bd04415e..f5f2e7df1c 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -125,6 +125,11 @@ void AccumulatorBufferGroup::sync() void SampleAccumulator::addSamples( const SampleAccumulator& other, EBufferAppendType append_type ) { + if (append_type == NON_SEQUENTIAL) + { + return; + } + if (!mHasValue) { *this = other; diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 5cba3e5360..ecc569f5d6 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -498,32 +498,14 @@ namespace LLTrace typedef F64Bytes value_t; }; - struct ShadowAllocationFacet - { - typedef F64Bytes value_t; - }; - - struct ShadowDeallocationFacet - { - typedef F64Bytes value_t; - }; - - struct ShadowMemFacet - { - typedef F64Bytes value_t; - }; - void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { mFootprintAllocations.addSamples(other.mFootprintAllocations, append_type); mFootprintDeallocations.addSamples(other.mFootprintDeallocations, append_type); - mShadowAllocations.addSamples(other.mShadowAllocations, append_type); - mShadowDeallocations.addSamples(other.mShadowDeallocations, append_type); if (append_type == SEQUENTIAL) { mSize.addSamples(other.mSize, SEQUENTIAL); - mShadowSize.addSamples(other.mShadowSize, SEQUENTIAL); } else { @@ -531,36 +513,24 @@ namespace LLTrace mSize.sample(mSize.hasValue() ? mSize.getLastValue() + allocation_delta : allocation_delta); - - F64 shadow_allocation_delta(other.mShadowAllocations.getSum() - other.mShadowDeallocations.getSum()); - mShadowSize.sample(mShadowSize.hasValue() - ? mShadowSize.getLastValue() + shadow_allocation_delta - : shadow_allocation_delta); } } void reset(const MemStatAccumulator* other) { mSize.reset(other ? &other->mSize : NULL); - mShadowSize.reset(other ? &other->mShadowSize : NULL); mFootprintAllocations.reset(other ? &other->mFootprintAllocations : NULL); mFootprintDeallocations.reset(other ? &other->mFootprintDeallocations : NULL); - mShadowAllocations.reset(other ? &other->mShadowAllocations : NULL); - mShadowDeallocations.reset(other ? &other->mShadowDeallocations : NULL); } void sync(F64SecondsImplicit time_stamp) { mSize.sync(time_stamp); - mShadowSize.sync(time_stamp); } - SampleAccumulator mSize, - mShadowSize; - EventAccumulator mFootprintAllocations, - mShadowAllocations; - CountAccumulator mFootprintDeallocations, - mShadowDeallocations; + SampleAccumulator mSize; + EventAccumulator mFootprintAllocations; + CountAccumulator mFootprintDeallocations; }; struct AccumulatorBufferGroup : public LLRefCount diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index fb2293844a..ce4a433cca 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -173,11 +173,6 @@ bool Recording::hasValue(const TraceType& stat) return mBuffers->mMemStats[stat.getIndex()].mSize.hasValue(); } -bool Recording::hasValue(const TraceType& stat) -{ - return mBuffers->mMemStats[stat.getIndex()].mShadowSize.hasValue(); -} - F64Kilobytes Recording::getMin(const TraceType& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); @@ -203,31 +198,6 @@ F64Kilobytes Recording::getLastValue(const TraceType& stat) return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue()); } -F64Kilobytes Recording::getMin(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMin()); -} - -F64Kilobytes Recording::getMean(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMean()); -} - -F64Kilobytes Recording::getMax(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMax()); -} - -F64Kilobytes Recording::getStandardDeviation(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getStandardDeviation()); -} - -F64Kilobytes Recording::getLastValue(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getLastValue()); -} - F64Kilobytes Recording::getSum(const TraceType& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mFootprintAllocations.getSum()); @@ -258,36 +228,6 @@ S32 Recording::getSampleCount(const TraceTypemMemStats[stat.getIndex()].mFootprintDeallocations.getSampleCount(); } -F64Kilobytes Recording::getSum(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocations.getSum()); -} - -F64Kilobytes Recording::getPerSec(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocations.getSum() / mElapsedSeconds.value()); -} - -S32 Recording::getSampleCount(const TraceType& stat) -{ - return mBuffers->mMemStats[stat.getIndex()].mShadowAllocations.getSampleCount(); -} - -F64Kilobytes Recording::getSum(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocations.getSum()); -} - -F64Kilobytes Recording::getPerSec(const TraceType& stat) -{ - return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocations.getSum() / mElapsedSeconds.value()); -} - -S32 Recording::getSampleCount(const TraceType& stat) -{ - return mBuffers->mMemStats[stat.getIndex()].mShadowDeallocations.getSampleCount(); -} - F64 Recording::getSum( const TraceType& stat ) { return mBuffers->mCounts[stat.getIndex()].getSum(); diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 13dffdc701..085780198d 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -30,7 +30,6 @@ #include "stdtypes.h" #include "llpreprocessor.h" -#include "llpointer.h" #include "lltimer.h" #include "lltraceaccumulators.h" @@ -178,7 +177,6 @@ namespace LLTrace // Memory accessors bool hasValue(const TraceType& stat); - bool hasValue(const TraceType& stat); F64Kilobytes getMin(const TraceType& stat); F64Kilobytes getMean(const TraceType& stat); @@ -186,12 +184,6 @@ namespace LLTrace F64Kilobytes getStandardDeviation(const TraceType& stat); F64Kilobytes getLastValue(const TraceType& stat); - F64Kilobytes getMin(const TraceType& stat); - F64Kilobytes getMean(const TraceType& stat); - F64Kilobytes getMax(const TraceType& stat); - F64Kilobytes getStandardDeviation(const TraceType& stat); - F64Kilobytes getLastValue(const TraceType& stat); - F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); S32 getSampleCount(const TraceType& stat); @@ -200,14 +192,6 @@ namespace LLTrace F64Kilobytes getPerSec(const TraceType& stat); S32 getSampleCount(const TraceType& stat); - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); - - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); - // CountStatHandle accessors F64 getSum(const TraceType& stat); template diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index fb72d6d8a9..0e05ecd683 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -80,6 +80,7 @@ struct LLUnit { typedef LLUnit self_t; typedef STORAGE_TYPE storage_t; + typedef void is_unit_t; // value initialization LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t()) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 326f477504..1ca1bf55a6 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -89,15 +89,15 @@ void LLImage::setLastError(const std::string& message) //--------------------------------------------------------------------------- LLImageBase::LLImageBase() - : mData(NULL), - mDataSize(0), - mWidth(0), - mHeight(0), - mComponents(0), - mBadBufferAllocation(false), - mAllowOverSize(false) -{ -} +: LLTrace::MemTrackable("LLImage"), + mData(NULL), + mDataSize(0), + mWidth(0), + mHeight(0), + mComponents(0), + mBadBufferAllocation(false), + mAllowOverSize(false) +{} // virtual LLImageBase::~LLImageBase() @@ -158,7 +158,8 @@ void LLImageBase::sanityCheck() void LLImageBase::deleteData() { FREE_MEM(sPrivatePoolp, mData) ; - disclaimMem(mDataSize) = 0; + disclaimMem(mDataSize); + mDataSize = 0; mData = NULL; } @@ -223,7 +224,9 @@ U8* LLImageBase::reallocateData(S32 size) FREE_MEM(sPrivatePoolp, mData) ; } mData = new_datap; - claimMem(disclaimMem(mDataSize) = size); + disclaimMem(mDataSize); + mDataSize = size; + claimMem(mDataSize); return mData; } @@ -1618,7 +1621,9 @@ void LLImageBase::setDataAndSize(U8 *data, S32 size) { ll_assert_aligned(data, 16); mData = data; - claimMem(disclaimMem(mDataSize) = size); + disclaimMem(mDataSize); + mDataSize = size; + claimMem(mDataSize); } //static diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 8e2bcc3f94..7cd59a2983 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -62,6 +62,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mAreaUsedForDataSizeCalcs(0) { mImpl = fallbackCreateLLImageJ2CImpl(); + claimMem(mImpl); // Clear data size table for( S32 i = 0; i <= MAX_DISCARD_LEVEL; i++) diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index a25794dab4..e419c77ff2 100755 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -32,8 +32,7 @@ jmp_buf LLImageJPEG::sSetjmpBuffer ; LLImageJPEG::LLImageJPEG(S32 quality) - : - LLImageFormatted(IMG_CODEC_JPEG), +: LLImageFormatted(IMG_CODEC_JPEG), mOutputBuffer( NULL ), mOutputBufferSize( 0 ), mEncodeQuality( quality ) // on a scale from 1 to 100 @@ -383,7 +382,9 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) cinfo->dest->next_output_byte = self->mOutputBuffer + self->mOutputBufferSize; cinfo->dest->free_in_buffer = self->mOutputBufferSize; + self->disclaimMem(self->mOutputBufferSize); self->mOutputBufferSize = new_buffer_size; + self->claimMem(new_buffer_size); return TRUE; } @@ -489,7 +490,9 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // Allocate a temporary buffer big enough to hold the entire compressed image (and then some) // (Note: we make it bigger in emptyOutputBuffer() if we need to) delete[] mOutputBuffer; + disclaimMem(mOutputBufferSize); mOutputBufferSize = getWidth() * getHeight() * getComponents() + 1024; + claimMem(mOutputBufferSize); mOutputBuffer = new U8[ mOutputBufferSize ]; const U8* raw_image_data = NULL; @@ -526,6 +529,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; return FALSE; } @@ -628,6 +632,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // After finish_compress, we can release the temp output buffer. delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; //////////////////////////////////////// @@ -640,6 +645,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; return FALSE; } diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index d2efda8612..61ba0939bf 100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -72,17 +72,20 @@ const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); LLInventoryObject::LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType type, - const std::string& name) : + const std::string& name) +: LLTrace::MemTrackable("LLInventoryObject"), mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name), mCreationDate(0) { + claimMem(mName); correctInventoryName(mName); } -LLInventoryObject::LLInventoryObject() : +LLInventoryObject::LLInventoryObject() +: LLTrace::MemTrackable("LLInventoryObject"), mType(LLAssetType::AT_NONE), mCreationDate(0) { @@ -97,7 +100,9 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mUUID = other->mUUID; mParentUUID = other->mParentUUID; mType = other->mType; + disclaimMem(mName); mName = other->mName; + claimMem(mName); } const LLUUID& LLInventoryObject::getUUID() const @@ -150,7 +155,9 @@ void LLInventoryObject::rename(const std::string& n) correctInventoryName(new_name); if( !new_name.empty() && new_name != mName ) { + disclaimMem(mName); mName = new_name; + claimMem(mName); } } @@ -326,6 +333,8 @@ LLInventoryItem::LLInventoryItem(const LLUUID& uuid, LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); + claimMem(mDescription); + mPermissions.initMasks(inv_type); } @@ -357,7 +366,9 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) copyObject(other); mPermissions = other->mPermissions; mAssetUUID = other->mAssetUUID; + disclaimMem(mDescription); mDescription = other->mDescription; + claimMem(mDescription); mSaleInfo = other->mSaleInfo; mInventoryType = other->mInventoryType; mFlags = other->mFlags; @@ -432,7 +443,9 @@ void LLInventoryItem::setDescription(const std::string& d) LLStringUtil::replaceChar(new_desc, '|', ' '); if( new_desc != mDescription ) { + disclaimMem(mDescription); mDescription = new_desc; + claimMem(mDescription); } } @@ -713,7 +726,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) valuestr[0] = '\000'; } + disclaimMem(mDescription); mDescription.assign(valuestr); + claimMem(mDescription); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); @@ -919,8 +934,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) valuestr[0] = '\000'; } + disclaimMem(mDescription); mDescription.assign(valuestr); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + claimMem(mDescription); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -1160,8 +1177,10 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd) w = INV_DESC_LABEL; if (sd.has(w)) { + disclaimMem(mDescription); mDescription = sd[w].asString(); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + claimMem(mDescription); } w = INV_CREATION_DATE_LABEL; if (sd.has(w)) diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 47b06af5b8..aa0b4cc24c 100755 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -34,6 +34,7 @@ #include "llsaleinfo.h" #include "llsd.h" #include "lluuid.h" +#include "lltrace.h" class LLMessageSystem; @@ -43,7 +44,7 @@ class LLMessageSystem; // Base class for anything in the user's inventory. Handles the common code // between items and categories. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryObject : public LLRefCount +class LLInventoryObject : public LLRefCount, public LLTrace::MemTrackable { public: typedef std::list > object_list_t; diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index c985f6b959..f128636ab2 100755 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -29,7 +29,8 @@ #include "llgl.h" #include "llfontbitmapcache.h" -LLFontBitmapCache::LLFontBitmapCache(): +LLFontBitmapCache::LLFontBitmapCache() +: LLTrace::MemTrackable("LLFontBitmapCache"), mNumComponents(0), mBitmapWidth(0), mBitmapHeight(0), @@ -81,6 +82,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm { // We're out of space in the current image, or no image // has been allocated yet. Make a new one. + mImageRawVec.push_back(new LLImageRaw); mBitmapNum = mImageRawVec.size()-1; LLImageRaw *image_raw = getImageRaw(mBitmapNum); @@ -122,6 +124,9 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm image_gl->createGLTexture(0, image_raw); gGL.getTexUnit(0)->bind(image_gl); image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE); + + claimMem(image_raw); + claimMem(image_gl); } else { @@ -151,7 +156,20 @@ void LLFontBitmapCache::destroyGL() void LLFontBitmapCache::reset() { + for (std::vector >::iterator it = mImageRawVec.begin(), end_it = mImageRawVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageRawVec.clear(); + + for (std::vector >::iterator it = mImageGLVec.begin(), end_it = mImageGLVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageGLVec.clear(); mBitmapWidth = 0; diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index c93b0c7320..75df3a94a7 100755 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -28,10 +28,11 @@ #define LL_LLFONTBITMAPCACHE_H #include +#include "lltrace.h" // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. -class LLFontBitmapCache: public LLRefCount +class LLFontBitmapCache : public LLTrace::MemTrackable { public: LLFontBitmapCache(); diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 4cc5b78b63..bde62f89b3 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -101,7 +101,8 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index) } LLFontFreetype::LLFontFreetype() -: mFontBitmapCachep(new LLFontBitmapCache), +: LLTrace::MemTrackable("LLFontFreetype"), + mFontBitmapCachep(new LLFontBitmapCache), mValid(FALSE), mAscender(0.f), mDescender(0.f), @@ -126,7 +127,7 @@ LLFontFreetype::~LLFontFreetype() // Delete glyph info std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); - // mFontBitmapCachep will be cleaned up by LLPointer destructor. + delete mFontBitmapCachep; // mFallbackFonts cleaned up by LLPointer destructor } @@ -186,6 +187,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v S32 max_char_height = llround(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); + claimMem(mFontBitmapCachep); + if (!mFTFace->charmap) { @@ -200,6 +203,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v } mName = filename; + claimMem(mName); mPointSize = point_size; mStyle = LLFontGL::NORMAL; @@ -476,6 +480,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const } else { + claimMem(gi); mCharGlyphInfoMap[wch] = gi; } } @@ -517,8 +522,15 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi) void LLFontFreetype::resetBitmapCache() { - for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); + for (char_glyph_info_map_t::iterator it = mCharGlyphInfoMap.begin(), end_it = mCharGlyphInfoMap.end(); + it != end_it; + ++it) + { + disclaimMem(it->second); + delete it->second; + } mCharGlyphInfoMap.clear(); + disclaimMem(mFontBitmapCachep); mFontBitmapCachep->reset(); // Adding default glyph is skipped for fallback fonts here as well as in loadFace(). @@ -540,7 +552,7 @@ const std::string &LLFontFreetype::getName() const return mName; } -const LLPointer LLFontFreetype::getFontBitmapCache() const +const LLFontBitmapCache* LLFontFreetype::getFontBitmapCache() const { return mFontBitmapCachep; } diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index f1b23f22d5..2963fbd43d 100755 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -74,7 +74,7 @@ struct LLFontGlyphInfo extern LLFontManager *gFontManagerp; -class LLFontFreetype : public LLRefCount +class LLFontFreetype : public LLRefCount, public LLTrace::MemTrackable { public: LLFontFreetype(); @@ -134,7 +134,7 @@ public: const std::string& getName() const; - const LLPointer getFontBitmapCache() const; + const LLFontBitmapCache* getFontBitmapCache() const; void setStyle(U8 style); U8 getStyle() const; @@ -167,7 +167,7 @@ private: typedef boost::unordered_map char_glyph_info_map_t; mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap - mutable LLPointer mFontBitmapCachep; + mutable LLFontBitmapCache* mFontBitmapCachep; mutable S32 mRenderGlyphCount; mutable S32 mAddGlyphCount; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index d66b6d8432..4330a9891e 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -279,8 +279,10 @@ void LLImageGL::destroyGL(BOOL save_state) if (save_state && glimage->isGLTextureCreated() && glimage->mComponents) { glimage->mSaveData = new LLImageRaw; + glimage->claimMem(glimage->mSaveData); if(!glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false)) //necessary, keep it. { + glimage->disclaimMem(glimage->mSaveData); glimage->mSaveData = NULL ; } } @@ -354,7 +356,8 @@ BOOL LLImageGL::create(LLPointer& dest, const LLImageRaw* imageraw, B //---------------------------------------------------------------------------- LLImageGL::LLImageGL(BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -363,7 +366,8 @@ LLImageGL::LLImageGL(BOOL usemipmaps) } LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { llassert( components <= 4 ); init(usemipmaps); @@ -373,7 +377,8 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) } LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -387,6 +392,7 @@ LLImageGL::~LLImageGL() { LLImageGL::cleanup(); sImageList.erase(this); + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; sCount--; @@ -500,6 +506,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve } // pickmask validity depends on old image size, delete it + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -1460,7 +1467,9 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ stop_glerror(); } + disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)getMipBytes(discard_level); + claimMem(mTextureMemory); sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight() ; @@ -1621,6 +1630,7 @@ void LLImageGL::destroyGLTexture() if(mTextureMemory != S32Bytes(0)) { sGlobalTextureMemory -= mTextureMemory; + disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)0; } @@ -1970,6 +1980,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) return ; } + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -1987,6 +1998,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) U32 size = pick_width * pick_height; size = (size + 7) / 8; // pixelcount-to-bits mPickMask = new U8[size]; + claimMem(size); mPickMaskWidth = pick_width - 1; mPickMaskHeight = pick_height - 1; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 09ea8a1124..816169a30c 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -42,7 +42,7 @@ class LLTextureAtlas ; #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) //============================================================================ -class LLImageGL : public LLRefCount +class LLImageGL : public LLRefCount, public LLTrace::MemTrackable { friend class LLTexUnit; public: diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b1a5a194be..38351dd9ae 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -959,7 +959,8 @@ S32 LLVertexBuffer::determineUsage(S32 usage) return ret_usage; } -LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : +LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) +: LLTrace::MemTrackable("LLVertexBuffer"), LLRefCount(), mNumVerts(0), @@ -1096,7 +1097,9 @@ void LLVertexBuffer::waitFence() const void LLVertexBuffer::genBuffer(U32 size) { + disclaimMem(mSize); mSize = vbo_block_size(size); + claimMem(mSize); if (mUsage == GL_STREAM_DRAW_ARB) { @@ -1185,7 +1188,9 @@ void LLVertexBuffer::createGLBuffer(U32 size) static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + disclaimMem(mSize); mSize = size; + disclaimMem(mSize); } } diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 0b4b87f338..92ea3bfc8e 100755 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -34,6 +34,7 @@ #include "v4coloru.h" #include "llstrider.h" #include "llrender.h" +#include "lltrace.h" #include #include #include @@ -98,7 +99,7 @@ public: //============================================================================ // base class class LLPrivateMemoryPool; -class LLVertexBuffer : public LLRefCount +class LLVertexBuffer : public LLRefCount, public LLTrace::MemTrackable { public: class MappedRegion @@ -112,7 +113,8 @@ public: }; LLVertexBuffer(const LLVertexBuffer& rhs) - : mUsage(rhs.mUsage) + : LLTrace::MemTrackable("LLVertexBuffer"), + mUsage(rhs.mUsage) { *this = rhs; } diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 802cb783ed..ac36cd1173 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1496,16 +1496,12 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) ft = std::find(mFolders.begin(), mFolders.end(), f); if (ft != mFolders.end()) { - disclaimMem(mFolders); mFolders.erase(ft); - claimMem(mFolders); } } else { - disclaimMem(mItems); mItems.erase(it); - claimMem(mItems); } //item has been removed, need to update filter getViewModelItem()->removeChild(item->getViewModelItem()); @@ -1582,9 +1578,7 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) } item->setParentFolder(this); - disclaimMem(mItems); mItems.push_back(item); - claimMem(mItems); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); item->setVisible(FALSE); @@ -1607,9 +1601,7 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) folder->mParentFolder->extractItem(folder); } folder->mParentFolder = this; - disclaimMem(mFolders); mFolders.push_back(folder); - claimMem(mFolders); folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 3f62d133e4..c665dce509 100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -111,6 +111,10 @@ public: class LLFolderViewModelInterface : public LLTrace::MemTrackable { public: + LLFolderViewModelInterface() + : LLTrace::MemTrackable("LLFolderViewModelInterface") + {} + virtual ~LLFolderViewModelInterface() {} virtual void requestSortAll() = 0; @@ -131,7 +135,10 @@ public: class LLFolderViewModelItem : public LLRefCount, public LLTrace::MemTrackable { public: - LLFolderViewModelItem() { } + LLFolderViewModelItem() + : LLTrace::MemTrackable("LLFolderViewModelItem") + {} + virtual ~LLFolderViewModelItem() { } virtual void update() {} //called when drawing diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 5c221edea7..730c3b2ada 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -576,7 +576,7 @@ void LLTextBase::drawText() if ( (mSpellCheckStart != start) || (mSpellCheckEnd != end) ) { const LLWString& wstrText = getWText(); - disclaimMem(mMisspellRanges).clear(); + mMisspellRanges.clear(); segment_set_t::const_iterator seg_it = getSegIterContaining(start); while (mSegments.end() != seg_it) @@ -652,7 +652,6 @@ void LLTextBase::drawText() mSpellCheckStart = start; mSpellCheckEnd = end; - claimMem(mMisspellRanges); } } else @@ -922,11 +921,9 @@ void LLTextBase::createDefaultSegment() if (mSegments.empty()) { LLStyleConstSP sp(new LLStyle(getStyleParams())); - disclaimMem(mSegments); LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this); mSegments.insert(default_segment); default_segment->linkToDocument(this); - claimMem(mSegments); } } @@ -937,8 +934,6 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) return; } - disclaimMem(mSegments); - segment_set_t::iterator cur_seg_iter = getSegIterContaining(segment_to_insert->getStart()); S32 reflow_start_index = 0; @@ -1011,7 +1006,6 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) // layout potentially changed needsReflow(reflow_start_index); - claimMem(mSegments); } BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) @@ -1322,10 +1316,8 @@ void LLTextBase::replaceWithSuggestion(U32 index) removeStringNoUndo(it->first, it->second - it->first); // Insert the suggestion in its place - disclaimMem(mSuggestionList); LLWString suggestion = utf8str_to_wstring(mSuggestionList[index]); insertStringNoUndo(it->first, utf8str_to_wstring(mSuggestionList[index])); - claimMem(mSuggestionList); setCursorPos(it->first + (S32)suggestion.length()); @@ -1388,7 +1380,7 @@ bool LLTextBase::isMisspelledWord(U32 pos) const void LLTextBase::onSpellCheckSettingsChange() { // Recheck the spelling on every change - disclaimMem(mMisspellRanges).clear(); + mMisspellRanges.clear(); mSpellCheckStart = mSpellCheckEnd = -1; } @@ -1666,7 +1658,7 @@ LLRect LLTextBase::getTextBoundingRect() void LLTextBase::clearSegments() { - disclaimMem(mSegments).clear(); + mSegments.clear(); createDefaultSegment(); } @@ -3210,9 +3202,7 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip) LL_WARNS() << "LLTextSegment::setToolTip: cannot replace keyword tooltip." << LL_ENDL; return; } - disclaimMem(mTooltip); mTooltip = tooltip; - claimMem(mTooltip); } bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index b1558a7abe..87f1a10cc5 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -53,11 +53,13 @@ class LLUrlMatch; /// class LLTextSegment : public LLRefCount, - public LLMouseHandler, - public LLTrace::MemTrackable + public LLMouseHandler { public: - LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){}; + LLTextSegment(S32 start, S32 end) + : mStart(start), + mEnd(end) + {} virtual ~LLTextSegment(); virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 9a81c91e0d..546cd6fc46 100755 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -941,7 +941,9 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function cb ) { - if (!mValidateSignal) mValidateSignal = claimMem(new enable_signal_t()); + if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + claimMem(mValidateSignal); + return mValidateSignal->connect(boost::bind(cb, _2)); } @@ -1004,55 +1006,73 @@ boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackPa boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) { - if (!mCommitSignal) mCommitSignal = claimMem(new commit_signal_t()); + if (!mCommitSignal) mCommitSignal = new commit_signal_t(); + claimMem(mCommitSignal); + return mCommitSignal->connect(cb); } boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb ) { - if (!mValidateSignal) mValidateSignal = claimMem(new enable_signal_t()); + if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + claimMem(mValidateSignal); + return mValidateSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { - if (!mMouseEnterSignal) mMouseEnterSignal = claimMem(new commit_signal_t()); + if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t(); + claimMem(mMouseEnterSignal); + return mMouseEnterSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { - if (!mMouseLeaveSignal) mMouseLeaveSignal = claimMem(new commit_signal_t()); + if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t(); + claimMem(mMouseLeaveSignal); + return mMouseLeaveSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { - if (!mMouseDownSignal) mMouseDownSignal = claimMem(new mouse_signal_t()); + if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t(); + claimMem(mMouseDownSignal); + return mMouseDownSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { - if (!mMouseUpSignal) mMouseUpSignal = claimMem(new mouse_signal_t()); + if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t(); + claimMem(mMouseUpSignal); + return mMouseUpSignal->connect(cb); } boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) { - if (!mRightMouseDownSignal) mRightMouseDownSignal = claimMem(new mouse_signal_t()); + if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t(); + claimMem(mRightMouseDownSignal); + return mRightMouseDownSignal->connect(cb); } boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) { - if (!mRightMouseUpSignal) mRightMouseUpSignal = claimMem(new mouse_signal_t()); + if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t(); + claimMem(mRightMouseUpSignal); + return mRightMouseUpSignal->connect(cb); } boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) { - if (!mDoubleClickSignal) mDoubleClickSignal = claimMem(new mouse_signal_t()); + if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); + claimMem(mDoubleClickSignal); + return mDoubleClickSignal->connect(cb); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e81d19ae3a..e3b3444a00 100755 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -131,7 +131,8 @@ LLView::Params::Params() } LLView::LLView(const LLView::Params& p) -: mVisible(p.visible), +: LLTrace::MemTrackable("LLView"), + mVisible(p.visible), mInDraw(false), mName(p.name), mParentView(NULL), diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 3a0dfb5f42..665aad70cf 100755 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -167,7 +167,7 @@ protected: private: // widgets in general are not copyable - LLView(const LLView& other) {}; + LLView(const LLView& other); public: //#if LL_DEBUG static BOOL sIsDrawing; diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 6459ade027..282addf692 100755 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -37,13 +37,15 @@ /// LLViewModel::LLViewModel() - : mDirty(false) +: LLTrace::MemTrackable("LLViewModel"), + mDirty(false) { } /// Instantiate an LLViewModel with an existing data value LLViewModel::LLViewModel(const LLSD& value) - : mDirty(false) +: LLTrace::MemTrackable("LLViewModel"), + mDirty(false) { setValue(value); } @@ -79,12 +81,14 @@ LLTextViewModel::LLTextViewModel(const LLSD& value) /// Update the stored value void LLTextViewModel::setValue(const LLSD& value) { - LLViewModel::setValue(value); // approximate LLSD storage usage disclaimMem(mDisplay.size()); + LLViewModel::setValue(value); disclaimMem(mDisplay); mDisplay = utf8str_to_wstring(value.asString()); + claimMem(mDisplay); + // approximate LLSD storage usage claimMem(mDisplay.size()); // mDisplay and mValue agree diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5baebab5a3..2890d3f61c 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -90,8 +90,9 @@ void LLDrawable::incrementVisible() } LLDrawable::LLDrawable(LLViewerObject *vobj, bool new_entry) - : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), - mVObjp(vobj) +: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), + LLTrace::MemTrackable("LLDrawable"), + mVObjp(vobj) { init(new_entry); } diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index a0ac417b24..067cee6838 100755 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -64,7 +64,9 @@ class LLDrawable public LLTrace::MemTrackable { public: - LLDrawable(const LLDrawable& rhs) : LLViewerOctreeEntryData(rhs) + LLDrawable(const LLDrawable& rhs) + : LLTrace::MemTrackable("LLDrawable"), + LLViewerOctreeEntryData(rhs) { *this = rhs; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 394b11b759..e65f99c452 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -206,7 +206,8 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco } LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) -: LLPrimitive(), +: LLTrace::MemTrackable("LLViewerObject"), + LLPrimitive(), mChildList(), mID(id), mLocalID(0), diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 34b0f450ab..ecb1fd696a 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -287,6 +287,8 @@ public: // LLDebugText // +static LLTrace::TimeBlock FTM_DISPLAY_DEBUG_TEXT("Display Debug Text"); + class LLDebugText { private: @@ -799,6 +801,7 @@ public: void draw() { + LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); for (line_list_t::iterator iter = mLineList.begin(); iter != mLineList.end(); ++iter) { diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 7ba0c31ffc..01666778b1 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -56,7 +56,8 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) //--------------------------------------------------------------------------- LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp) - : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), +: LLTrace::MemTrackable("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(local_id), mCRC(crc), mUpdateFlags(-1), @@ -74,7 +75,8 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & } LLVOCacheEntry::LLVOCacheEntry() - : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), +: LLTrace::MemTrackable("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(0), mCRC(0), mUpdateFlags(-1), @@ -91,7 +93,8 @@ LLVOCacheEntry::LLVOCacheEntry() } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) - : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), +: LLTrace::MemTrackable("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mBuffer(NULL), mUpdateFlags(-1), mState(INACTIVE), @@ -471,6 +474,7 @@ void LLVOCacheEntry::updateParentBoundingInfo(const LLVOCacheEntry* child) //LLVOCachePartition //------------------------------------------------------------------- LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) +: LLTrace::MemTrackable("LLVOCachePartition") { mLODPeriod = 16; mRegionp = regionp; diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index f0a464dfc9..d4decf383d 100755 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -111,25 +111,32 @@ + label="UI" + stat="LLView"/> + + + label="Viewer Objects" + stat="LLViewerObject"/> + label="Viewer Object Cache" + stat="LLVOCacheEntry"/> + label="Drawables" + stat="LLDrawable"/> + label="Image Data" + stat="LLImage"/> + +