From e25b5a359faaf4bb51186235567fcb1fea15e440 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Sep 2013 16:07:32 -0700 Subject: refactored lltrace mem tracking to store allocation and deallocation sizes at the same time and work better with threads --- indra/llcommon/lltracerecording.cpp | 57 ++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.cpp') diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 7155cfa40a..5728997676 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -228,16 +228,65 @@ F64Bytes Recording::getLastValue(const TraceTypemMemStats[stat.getIndex()].mShadowSize.getLastValue()); } -U32 Recording::getSum(const TraceType& stat) +F64Bytes Recording::getSum(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mAllocatedCount; + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocated.getSum()); } -U32 Recording::getSum(const TraceType& stat) +F64Bytes Recording::getPerSec(const TraceType& stat) { - return mBuffers->mMemStats[stat.getIndex()].mAllocatedCount; + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocated.getSum() / mElapsedSeconds.value()); } +U32 Recording::getSampleCount(const TraceType& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mAllocated.getSampleCount(); +} + +F64Bytes Recording::getSum(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSum()); +} + +F64Bytes Recording::getPerSec(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mDeallocated.getSampleCount(); +} + +F64Bytes Recording::getSum(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSum()); +} + +F64Bytes Recording::getPerSec(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mShadowAllocated.getSampleCount(); +} + +F64Bytes Recording::getSum(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSum()); +} + +F64Bytes Recording::getPerSec(const TraceType& stat) +{ + return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSum() / mElapsedSeconds.value()); +} + +U32 Recording::getSampleCount(const TraceType& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mShadowDeallocated.getSampleCount(); +} F64 Recording::getSum( const TraceType& stat ) { -- cgit v1.2.3