diff options
-rw-r--r-- | indra/llcommon/lltrace.h | 85 | ||||
-rw-r--r-- | indra/llcommon/lltraceaccumulators.h | 58 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 105 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.h | 55 | ||||
-rwxr-xr-x | indra/llui/llfolderview.cpp | 3 | ||||
-rwxr-xr-x | indra/llui/llfolderview.h | 32 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 8 | ||||
-rwxr-xr-x | indra/llui/llfolderviewmodel.h | 24 | ||||
-rwxr-xr-x | indra/llui/llstatview.h | 3 | ||||
-rwxr-xr-x | indra/llui/llviewmodel.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llinventorypanel.cpp | 6 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/floater_stats.xml | 38 |
12 files changed, 267 insertions, 155 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index bf1119d694..5c833ea287 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -200,7 +200,7 @@ void add(CountStatHandle<T>& count, VALUE_T value) } template<> -class TraceType<MemStatAccumulator::AllocationCountFacet> +class TraceType<MemStatAccumulator::AllocationFacet> : public TraceType<MemStatAccumulator> { public: @@ -211,7 +211,7 @@ public: }; template<> -class TraceType<MemStatAccumulator::DeallocationCountFacet> +class TraceType<MemStatAccumulator::DeallocationFacet> : public TraceType<MemStatAccumulator> { public: @@ -222,6 +222,28 @@ public: }; template<> +class TraceType<MemStatAccumulator::ShadowAllocationFacet> + : public TraceType<MemStatAccumulator> +{ +public: + + TraceType(const char* name, const char* description = "") + : TraceType<MemStatAccumulator>(name, description) + {} +}; + +template<> +class TraceType<MemStatAccumulator::ShadowDeallocationFacet> + : public TraceType<MemStatAccumulator> +{ +public: + + TraceType(const char* name, const char* description = "") + : TraceType<MemStatAccumulator>(name, description) + {} +}; + +template<> class TraceType<MemStatAccumulator::ShadowMemFacet> : public TraceType<MemStatAccumulator> { @@ -246,61 +268,60 @@ public: setKey(name); } - /*virtual*/ const char* getUnitLabel() const { return "B"; } + /*virtual*/ const char* getUnitLabel() const { return "KB"; } - TraceType<MemStatAccumulator::AllocationCountFacet>& allocationCount() + TraceType<MemStatAccumulator::AllocationFacet>& allocations() { - return static_cast<TraceType<MemStatAccumulator::AllocationCountFacet>&>(*(TraceType<MemStatAccumulator>*)this); + return static_cast<TraceType<MemStatAccumulator::AllocationFacet>&>(*(TraceType<MemStatAccumulator>*)this); } - TraceType<MemStatAccumulator::DeallocationCountFacet>& deallocationCount() + TraceType<MemStatAccumulator::DeallocationFacet>& deallocations() { - return static_cast<TraceType<MemStatAccumulator::DeallocationCountFacet>&>(*(TraceType<MemStatAccumulator>*)this); + return static_cast<TraceType<MemStatAccumulator::DeallocationFacet>&>(*(TraceType<MemStatAccumulator>*)this); } - TraceType<MemStatAccumulator::ShadowMemFacet>& childMem() + TraceType<MemStatAccumulator::ShadowAllocationFacet>& shadowAllocations() { - return static_cast<TraceType<MemStatAccumulator::ShadowMemFacet>&>(*(TraceType<MemStatAccumulator>*)this); + return static_cast<TraceType<MemStatAccumulator::ShadowAllocationFacet>&>(*(TraceType<MemStatAccumulator>*)this); } -}; -inline void track_alloc(MemStatHandle& measurement, size_t size) -{ - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); - accumulator.mAllocatedCount++; -} + TraceType<MemStatAccumulator::ShadowDeallocationFacet>& shadowDeallocations() + { + return static_cast<TraceType<MemStatAccumulator::ShadowDeallocationFacet>&>(*(TraceType<MemStatAccumulator>*)this); + } -inline void track_dealloc(MemStatHandle& measurement, size_t size) -{ - MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); - accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); - accumulator.mAllocatedCount--; - accumulator.mDeallocatedCount++; -} + TraceType<MemStatAccumulator::ShadowMemFacet>& shadowMem() + { + return static_cast<TraceType<MemStatAccumulator::ShadowMemFacet>&>(*(TraceType<MemStatAccumulator>*)this); + } +}; inline void claim_mem(MemStatHandle& measurement, size_t size) { MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); + accumulator.mAllocated.add(1); } inline void disclaim_mem(MemStatHandle& measurement, size_t size) { MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); + accumulator.mDeallocated.add(1); } inline void claim_shadow_mem(MemStatHandle& measurement, size_t size) { MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mShadowSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); + accumulator.mShadowAllocated.add(1); } inline void disclaim_shadow_mem(MemStatHandle& measurement, size_t size) { MemStatAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mShadowSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); + accumulator.mShadowDeallocated.add(1); } // measures effective memory footprint of specified type @@ -388,10 +409,12 @@ class MemTrackable typedef MemTrackable<DERIVED, ALIGNMENT> mem_trackable_t; static MemStatHandle sMemStat; + public: typedef void mem_trackable_tag_t; MemTrackable() + : mMemFootprint(0) { static bool name_initialized = false; if (!name_initialized) @@ -406,9 +429,14 @@ public: memDisclaim(mMemFootprint); } + static MemStatHandle& getMemStatHandle() + { + return sMemStat; + } + void* operator new(size_t size) { - track_alloc(sMemStat, size); + claim_mem(sMemStat, size); if (ALIGNMENT == LL_DEFAULT_HEAP_ALIGN) { @@ -430,7 +458,7 @@ public: void operator delete(void* ptr, size_t size) { - track_dealloc(sMemStat, size); + disclaim_mem(sMemStat, size); if (ALIGNMENT == LL_DEFAULT_HEAP_ALIGN) { @@ -452,7 +480,7 @@ public: void *operator new [](size_t size) { - track_alloc(sMemStat, size); + claim_mem(sMemStat, size); if (ALIGNMENT == LL_DEFAULT_HEAP_ALIGN) { @@ -474,10 +502,7 @@ public: void operator delete[](void* ptr, size_t size) { - MemStatAccumulator& accumulator = sMemStat.getCurrentAccumulator(); - accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); - accumulator.mAllocatedCount--; - accumulator.mDeallocatedCount++; + disclaim_mem(sMemStat, size); if (ALIGNMENT == LL_DEFAULT_HEAP_ALIGN) { diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index c5a0693fef..37a35f4e23 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -475,40 +475,62 @@ namespace LLTrace typedef MemStatAccumulator self_t; // fake classes that allows us to view different facets of underlying statistic - struct AllocationCountFacet + struct AllocationFacet { - typedef U32 value_t; + typedef F64Bytes value_t; }; - struct DeallocationCountFacet + struct DeallocationFacet { - typedef U32 value_t; + typedef F64Bytes value_t; }; - struct ShadowMemFacet + struct ShadowAllocationFacet { typedef F64Bytes value_t; }; - MemStatAccumulator() - : mAllocatedCount(0), - mDeallocatedCount(0) - {} + struct ShadowDeallocationFacet + { + typedef F64Bytes value_t; + }; + + struct ShadowMemFacet + { + typedef F64Bytes value_t; + }; void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type) { - mSize.addSamples(other.mSize, append_type); - mShadowSize.addSamples(other.mShadowSize, append_type); - mAllocatedCount += other.mAllocatedCount; - mDeallocatedCount += other.mDeallocatedCount; + mAllocated.addSamples(other.mAllocated, append_type); + mDeallocated.addSamples(other.mDeallocated, append_type); + if (append_type == SEQUENTIAL) + { + mSize.addSamples(other.mSize, SEQUENTIAL); + mShadowSize.addSamples(other.mShadowSize, SEQUENTIAL); + } + else + { + F64 allocation_delta(other.mAllocated.getSum() - other.mDeallocated.getSum()); + mSize.sample(mSize.hasValue() + ? mSize.getLastValue() + allocation_delta + : allocation_delta); + + F64 shadow_allocation_delta(other.mShadowAllocated.getSum() - other.mShadowDeallocated.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); - mAllocatedCount = 0; - mDeallocatedCount = 0; + mAllocated.reset(other ? &other->mAllocated : NULL); + mDeallocated.reset(other ? &other->mDeallocated : NULL); + mShadowAllocated.reset(other ? &other->mShadowAllocated : NULL); + mShadowDeallocated.reset(other ? &other->mShadowDeallocated : NULL); } void sync(F64SecondsImplicit time_stamp) @@ -519,8 +541,10 @@ namespace LLTrace SampleAccumulator mSize, mShadowSize; - int mAllocatedCount, - mDeallocatedCount; + CountAccumulator mAllocated, + mDeallocated, + mShadowAllocated, + mShadowDeallocated; }; struct AccumulatorBufferGroup : public LLRefCount diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 7155cfa40a..c606007d89 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -178,66 +178,115 @@ bool Recording::hasValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& st return mBuffers->mMemStats[stat.getIndex()].mShadowSize.hasValue(); } -F64Bytes Recording::getMin(const TraceType<MemStatAccumulator>& stat) +F64Kilobytes Recording::getMin(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); } -F64Bytes Recording::getMean(const TraceType<MemStatAccumulator>& stat) +F64Kilobytes Recording::getMean(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMean()); } -F64Bytes Recording::getMax(const TraceType<MemStatAccumulator>& stat) +F64Kilobytes Recording::getMax(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMax()); } -F64Bytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator>& stat) +F64Kilobytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation()); } -F64Bytes Recording::getLastValue(const TraceType<MemStatAccumulator>& stat) +F64Kilobytes Recording::getLastValue(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue()); } -F64Bytes Recording::getMin(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +F64Kilobytes Recording::getMin(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMin()); } -F64Bytes Recording::getMean(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +F64Kilobytes Recording::getMean(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMean()); } -F64Bytes Recording::getMax(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +F64Kilobytes Recording::getMax(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getMax()); } -F64Bytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +F64Kilobytes Recording::getStandardDeviation(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getStandardDeviation()); } -F64Bytes Recording::getLastValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +F64Kilobytes Recording::getLastValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowSize.getLastValue()); } -U32 Recording::getSum(const TraceType<MemStatAccumulator::AllocationCountFacet>& stat) +F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::AllocationFacet>& stat) { - return mBuffers->mMemStats[stat.getIndex()].mAllocatedCount; + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocated.getSum()); } -U32 Recording::getSum(const TraceType<MemStatAccumulator::DeallocationCountFacet>& stat) +F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::AllocationFacet>& stat) { - return mBuffers->mMemStats[stat.getIndex()].mAllocatedCount; + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocated.getSum() / mElapsedSeconds.value()); } +U32 Recording::getSampleCount(const TraceType<MemStatAccumulator::AllocationFacet>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mAllocated.getSampleCount(); +} + +F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::DeallocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSum()); +} + +F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::DeallocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType<MemStatAccumulator::DeallocationFacet>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSampleCount(); +} + +F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSum()); +} + +F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSampleCount(); +} + +F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSum()); +} + +F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSampleCount(); +} F64 Recording::getSum( const TraceType<CountAccumulator>& stat ) { @@ -718,12 +767,12 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<SampleAccumul } -F64Bytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - F64Bytes min_val(std::numeric_limits<F64>::max()); + F64Kilobytes min_val(std::numeric_limits<F64>::max()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -733,17 +782,17 @@ F64Bytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator>& s return min_val; } -F64Bytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, size_t num_periods) +F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, size_t num_periods) { return getPeriodMin(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); } -F64Bytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/) +F64Kilobytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - F64Bytes max_val(0.0); + F64Kilobytes max_val(0.0); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -753,17 +802,17 @@ F64Bytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>& st return max_val; } -F64Bytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, size_t num_periods) +F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, size_t num_periods) { return getPeriodMax(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); } -F64Bytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - F64Bytes mean(0); + F64Kilobytes mean(0); for (S32 i = 1; i <= num_periods; i++) { @@ -774,17 +823,17 @@ F64Bytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulator>& return mean / F64(num_periods); } -F64Bytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, size_t num_periods) +F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, size_t num_periods) { return getPeriodMean(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); } -F64Bytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - F64Bytes period_mean = getPeriodMean(stat, num_periods); + F64Kilobytes period_mean = getPeriodMean(stat, num_periods); S32 valid_period_count = 0; F64 sum_of_squares = 0; @@ -793,18 +842,18 @@ F64Bytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemStatA Recording& recording = getPrevRecording(i); if (recording.hasValue(stat)) { - F64Bytes delta = recording.getMean(stat) - period_mean; + F64Kilobytes delta = recording.getMean(stat) - period_mean; sum_of_squares += delta.value() * delta.value(); valid_period_count++; } } - return F64Bytes(valid_period_count + return F64Kilobytes(valid_period_count ? sqrt(sum_of_squares / (F64)valid_period_count) : NaN); } -F64Bytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods) +F64Kilobytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods) { return getPeriodStandardDeviation(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 2f5cefa8eb..3f7737b20b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -177,23 +177,36 @@ namespace LLTrace F32 getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& stat); // Memory accessors - bool hasValue(const TraceType<MemStatAccumulator>& stat);
+ bool hasValue(const TraceType<MemStatAccumulator>& stat); bool hasValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - F64Bytes getMin(const TraceType<MemStatAccumulator>& stat); - F64Bytes getMean(const TraceType<MemStatAccumulator>& stat); - F64Bytes getMax(const TraceType<MemStatAccumulator>& stat); - F64Bytes getStandardDeviation(const TraceType<MemStatAccumulator>& stat); - F64Bytes getLastValue(const TraceType<MemStatAccumulator>& stat); + F64Kilobytes getMin(const TraceType<MemStatAccumulator>& stat); + F64Kilobytes getMean(const TraceType<MemStatAccumulator>& stat); + F64Kilobytes getMax(const TraceType<MemStatAccumulator>& stat); + F64Kilobytes getStandardDeviation(const TraceType<MemStatAccumulator>& stat); + F64Kilobytes getLastValue(const TraceType<MemStatAccumulator>& stat); - F64Bytes getMin(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - F64Bytes getMean(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - F64Bytes getMax(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - F64Bytes getStandardDeviation(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - F64Bytes getLastValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Kilobytes getMin(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Kilobytes getMean(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Kilobytes getMax(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Kilobytes getStandardDeviation(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Kilobytes getLastValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); - U32 getSum(const TraceType<MemStatAccumulator::AllocationCountFacet>& stat); - U32 getSum(const TraceType<MemStatAccumulator::DeallocationCountFacet>& stat); + F64Kilobytes getSum(const TraceType<MemStatAccumulator::AllocationFacet>& stat); + F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::AllocationFacet>& stat); + U32 getSampleCount(const TraceType<MemStatAccumulator::AllocationFacet>& stat); + + F64Kilobytes getSum(const TraceType<MemStatAccumulator::DeallocationFacet>& stat); + F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::DeallocationFacet>& stat); + U32 getSampleCount(const TraceType<MemStatAccumulator::DeallocationFacet>& stat); + + F64Kilobytes getSum(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat); + F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat); + U32 getSampleCount(const TraceType<MemStatAccumulator::ShadowAllocationFacet>& stat); + + F64Kilobytes getSum(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat); + F64Kilobytes getPerSec(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat); + U32 getSampleCount(const TraceType<MemStatAccumulator::ShadowDeallocationFacet>& stat); // CountStatHandle accessors F64 getSum(const TraceType<CountAccumulator>& stat); @@ -397,8 +410,8 @@ namespace LLTrace return T(getPeriodMin(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } - F64Bytes getPeriodMin(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMin(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) @@ -461,8 +474,8 @@ namespace LLTrace return T(getPeriodMax(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } - F64Bytes getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) @@ -530,8 +543,8 @@ namespace LLTrace return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } - F64Bytes getPeriodMean(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMean(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) @@ -580,8 +593,8 @@ namespace LLTrace return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } - F64Bytes getPeriodStandardDeviation(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodStandardDeviation(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); private: // implementation for LLStopWatchControlsMixin diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 373b0e05ac..f0caba3e13 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -174,6 +174,7 @@ LLFolderView::LLFolderView(const Params& p) mShowItemLinkOverlays(p.show_item_link_overlays), mViewModel(p.view_model) { + memClaim(mViewModel); mViewModel->setFolderView(this); mRoot = this; @@ -1578,7 +1579,7 @@ BOOL LLFolderView::getShowSelectionContext() return FALSE; } -void LLFolderView::setShowSingleSelection(BOOL show) +void LLFolderView::setShowSingleSelection(bool show) { if (show != mShowSingleSelection) { diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 652e22c7bc..4ef685ba0c 100755 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -208,9 +208,9 @@ public: LLRect getVisibleRect(); BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); - void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; } + void setShowSelectionContext(bool show) { mShowSelectionContext = show; } BOOL getShowSelectionContext(); - void setShowSingleSelection(BOOL show); + void setShowSingleSelection(bool show); BOOL getShowSingleSelection() { return mShowSingleSelection; } F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } @@ -260,31 +260,32 @@ protected: LLHandle<LLView> mPopupMenuHandle; selected_items_t mSelectedItems; - BOOL mKeyboardSelection; - BOOL mAllowMultiSelect; - BOOL mShowEmptyMessage; - BOOL mShowFolderHierarchy; + bool mKeyboardSelection, + mAllowMultiSelect, + mShowEmptyMessage, + mShowFolderHierarchy, + mNeedsScroll, + mPinningSelectedItem, + mNeedsAutoSelect, + mAutoSelectOverride, + mNeedsAutoRename, + mUseLabelSuffix, + mDragAndDropThisFrame, + mShowItemLinkOverlays, + mShowSelectionContext, + mShowSingleSelection; // Renaming variables and methods LLFolderViewItem* mRenameItem; // The item currently being renamed LLLineEditor* mRenamer; - BOOL mNeedsScroll; - BOOL mPinningSelectedItem; LLRect mScrollConstraintRect; - BOOL mNeedsAutoSelect; - BOOL mAutoSelectOverride; - BOOL mNeedsAutoRename; - bool mUseLabelSuffix; - bool mShowItemLinkOverlays; LLDepthStack<LLFolderViewFolder> mAutoOpenItems; LLFolderViewFolder* mAutoOpenCandidate; LLFrameTimer mAutoOpenTimer; LLFrameTimer mSearchTimer; std::string mSearchString; - BOOL mShowSelectionContext; - BOOL mShowSingleSelection; LLFrameTimer mMultiSelectionFadeTimer; S32 mArrangeGeneration; @@ -292,7 +293,6 @@ protected: signal_t mReshapeSignal; S32 mSignalSelectCallback; S32 mMinWidth; - BOOL mDragAndDropThisFrame; LLPanel* mParentPanel; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index ac36cd1173..26ea9651b5 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1496,12 +1496,16 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) ft = std::find(mFolders.begin(), mFolders.end(), f); if (ft != mFolders.end()) { + memDisclaim(mFolders); mFolders.erase(ft); + memClaim(mFolders); } } else { + memDisclaim(mItems); mItems.erase(it); + memClaim(mItems); } //item has been removed, need to update filter getViewModelItem()->removeChild(item->getViewModelItem()); @@ -1578,7 +1582,9 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) } item->setParentFolder(this); + memDisclaim(mItems); mItems.push_back(item); + memClaim(mItems); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); item->setVisible(FALSE); @@ -1601,7 +1607,9 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) folder->mParentFolder->extractItem(folder); } folder->mParentFolder = this; + memDisclaim(mFolders); mFolders.push_back(folder); + memClaim(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 b1bcc8bbb4..3f62d133e4 100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -108,7 +108,7 @@ public: virtual S32 getFirstRequiredGeneration() const = 0; }; -class LLFolderViewModelInterface +class LLFolderViewModelInterface : public LLTrace::MemTrackable<LLFolderViewModelInterface> { public: virtual ~LLFolderViewModelInterface() {} @@ -128,7 +128,7 @@ public: // This is an abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data -class LLFolderViewModelItem : public LLRefCount +class LLFolderViewModelItem : public LLRefCount, public LLTrace::MemTrackable<LLFolderViewModelItem> { public: LLFolderViewModelItem() { } @@ -336,18 +336,18 @@ protected: virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } virtual bool hasParent() { return mParent != NULL; } - S32 mSortVersion; - bool mPassedFilter; - bool mPassedFolderFilter; - std::string::size_type mStringMatchOffsetFilter; - std::string::size_type mStringFilterSize; + S32 mSortVersion; + bool mPassedFilter; + bool mPassedFolderFilter; + std::string::size_type mStringMatchOffsetFilter; + std::string::size_type mStringFilterSize; - S32 mLastFilterGeneration; - S32 mLastFolderFilterGeneration; - S32 mMostFilteredDescendantGeneration; + S32 mLastFilterGeneration, + mLastFolderFilterGeneration, + mMostFilteredDescendantGeneration; - child_list_t mChildren; - LLFolderViewModelItem* mParent; + child_list_t mChildren; + LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index 5abdc42448..bc78d3b5fd 100755 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -46,7 +46,8 @@ public: Params() : setting("setting") { - changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT); + changeDefault(show_label, true); } }; diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 1b0ab6d92c..21c4e0fcac 100755 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -82,9 +82,12 @@ LLTextViewModel::LLTextViewModel(const LLSD& value) void LLTextViewModel::setValue(const LLSD& value) { LLViewModel::setValue(value); + // approximate LLSD storage usage + memDisclaim(mDisplay.size()); memDisclaim(mDisplay); mDisplay = utf8str_to_wstring(value.asString()); memClaim(mDisplay); + memClaim(mDisplay.size()); // mDisplay and mValue agree mUpdateFromDisplay = false; @@ -96,9 +99,11 @@ void LLTextViewModel::setDisplay(const LLWString& value) // and do the utf8str_to_wstring() to get the corresponding mDisplay // value. But a text editor might want to edit the display string // directly, then convert back to UTF8 on commit. + memDisclaim(mDisplay.size()); memDisclaim(mDisplay); mDisplay = value; memClaim(mDisplay); + memClaim(mDisplay.size()); mDirty = true; // Don't immediately convert to UTF8 -- do it lazily -- we expect many // more setDisplay() calls than getValue() calls. Just flag that it needs diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 3276985114..6358620f0b 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -653,16 +653,16 @@ void LLInventoryPanel::idle(void* user_data) EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) { - panel->mFolderRoot->setShowSingleSelection(TRUE); + panel->mFolderRoot->setShowSingleSelection(true); } else { - panel->mFolderRoot->setShowSingleSelection(FALSE); + panel->mFolderRoot->setShowSingleSelection(false); } } else { - panel->mFolderRoot->setShowSingleSelection(FALSE); + panel->mFolderRoot->setShowSingleSelection(false); } } diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index fa1823ed67..2291f81fcc 100755 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -26,8 +26,6 @@ width="245" > <stat_view name="basic" label="Basic" - follows="left|top|right" - show_label="true" setting="OpenDebugStatBasic"> <stat_bar name="fps" label="FPS" @@ -50,13 +48,9 @@ <stat_view name="advanced" label="Advanced" - follows="left|top|right" - show_label="true" setting="OpenDebugStatAdvanced"> <stat_view name="render" label="Render" - follows="left|top|right" - show_label="true" setting="OpenDebugStatRender"> <stat_bar name="ktrisframe" label="KTris per Frame" @@ -86,9 +80,7 @@ stat="unoccluded_objects"/> </stat_view> <stat_view name="texture" - label="Texture" - follows="left|top|right" - show_label="true"> + label="Texture"> <stat_bar name="texture_cache_hits" label="Cache Hit Rate" stat="texture_cache_hits" @@ -116,11 +108,15 @@ label="Bound Mem" stat="glboundmemstat"/> </stat_view> - + <stat_view name="memory" + label="Memory Usage"> + <stat_bar name="LLView" + label="LLView Memory" + stat="class LLView" + show_history="true"/> + </stat_view> <stat_view name="network" label="Network" - follows="left|top|right" - show_label="true" setting="OpenDebugStatNet"> <stat_bar name="packetsinstat" label="Packets In" @@ -164,8 +160,6 @@ <stat_view name="sim" label="Simulator" - follows="left|top|right" - show_label="true" setting="OpenDebugStatSim"> <stat_bar name="simtimedilation" label="Time Dilation" @@ -181,9 +175,7 @@ decimal_digits="1" bar_max="45" /> <stat_view name="physicsdetail" - label="Physics Details" - follows="left|top|right" - show_label="true"> + label="Physics Details"> <stat_bar name="physicspinnedtasks" label="Pinned Objects" stat="physicspinnedtasks"/> @@ -222,9 +214,7 @@ stat="simscripteps" unit_label="eps"/> <stat_view name="simpathfinding" - label="Pathfinding" - follows="left|top|right" - show_label="true"> + label="Pathfinding"> <stat_bar name="simsimaistepmsec" label="AI Step Time" stat="simsimaistepmsec"/> @@ -255,9 +245,7 @@ stat="simtotalunackedbytes" decimal_digits="1"/> <stat_view name="simperf" - label="Time" - follows="left|top|right" - show_label="true"> + label="Time"> <stat_bar name="simframemsec" label="Total Frame Time" stat="simframemsec"/> @@ -283,9 +271,7 @@ label="Spare Time" stat="simsparemsec"/> <stat_view name="timedetails" - label="Time Details" - follows="left|top|right" - show_label="true"> + label="Time Details"> <stat_bar name="simsimphysicsstepmsec" label="Physics Step" stat="simsimphysicsstepmsec"/> |