summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llcommon/llfasttimer.cpp2
-rwxr-xr-xindra/llcommon/llinstancetracker.cpp1
-rw-r--r--indra/llcommon/lltracerecording.cpp74
-rw-r--r--indra/llcommon/lltracerecording.h26
-rwxr-xr-xindra/llcommon/tests/llinstancetracker_test.cpp17
-rwxr-xr-xindra/llcommon/tests/wrapllerrs.h8
-rwxr-xr-xindra/newview/llappviewer.cpp2
-rwxr-xr-xindra/newview/llviewerassetstats.cpp8
-rwxr-xr-xindra/newview/llviewerassetstats.h4
9 files changed, 59 insertions, 83 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index d97fa74c24..4744be7236 100755
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -193,7 +193,7 @@ TimeBlockTreeNode& BlockTimerStatHandle::getTreeNode() const
void BlockTimerStatHandle::bootstrapTimerTree()
{
- for (BlockTimerStatHandle::instance_tracker_t::instance_iter begin_it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), end_it = BlockTimerStatHandle::instance_tracker_t::endInstances(), it = begin_it;
+ for (BlockTimerStatHandle::instance_tracker_t::instance_iter it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), end_it = BlockTimerStatHandle::instance_tracker_t::endInstances();
it != end_it;
++it)
{
diff --git a/indra/llcommon/llinstancetracker.cpp b/indra/llcommon/llinstancetracker.cpp
index 7ff8324fe3..11fc53f8c8 100755
--- a/indra/llcommon/llinstancetracker.cpp
+++ b/indra/llcommon/llinstancetracker.cpp
@@ -41,6 +41,7 @@ void LLInstanceTrackerBase::StaticBase::incrementDepth()
void LLInstanceTrackerBase::StaticBase::decrementDepth()
{
+ llassert(sIterationNestDepth);
apr_atomic_dec32(&sIterationNestDepth);
}
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 6ad6bbe356..5ec7ce56b9 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -139,13 +139,11 @@ void Recording::appendRecording( Recording& other )
bool Recording::hasValue(const StatType<TimeBlockAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mStackTimers[stat.getIndex()].hasValue();
}
F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator>& stat)
{
- llassert(!isStarted());
const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
return F64Seconds((F64)(accumulator.mTotalTimeCounter)
/ (F64)LLTrace::BlockTimerStatHandle::countsPerSecond());
@@ -153,7 +151,6 @@ F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator>& stat)
F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat)
{
- llassert(!isStarted());
const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
return F64Seconds((F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::BlockTimerStatHandle::countsPerSecond());
}
@@ -161,13 +158,11 @@ F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>
S32 Recording::getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat)
{
- llassert(!isStarted());
return mBuffers->mStackTimers[stat.getIndex()].mCalls;
}
F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator>& stat)
{
- llassert(!isStarted());
const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
return F64Seconds((F64)(accumulator.mTotalTimeCounter)
@@ -176,7 +171,6 @@ F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator>& stat)
F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat)
{
- llassert(!isStarted());
const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()];
return F64Seconds((F64)(accumulator.mSelfTimeCounter)
@@ -185,207 +179,173 @@ F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFac
F32 Recording::getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& stat)
{
- llassert(!isStarted());
return (F32)mBuffers->mStackTimers[stat.getIndex()].mCalls / mElapsedSeconds.value();
}
bool Recording::hasValue(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mMemStats[stat.getIndex()].mSize.hasValue();
}
F64Kilobytes Recording::getMin(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin());
}
F64Kilobytes Recording::getMean(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMean());
}
F64Kilobytes Recording::getMax(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMax());
}
F64Kilobytes Recording::getStandardDeviation(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getStandardDeviation());
}
F64Kilobytes Recording::getLastValue(const StatType<MemAccumulator>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getLastValue());
}
bool Recording::hasValue(const StatType<MemAccumulator::AllocationFacet>& stat)
{
- llassert(!isStarted());
return mBuffers->mMemStats[stat.getIndex()].mAllocations.hasValue();
}
F64Kilobytes Recording::getSum(const StatType<MemAccumulator::AllocationFacet>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum());
}
F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum() / mElapsedSeconds.value());
}
S32 Recording::getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat)
{
- llassert(!isStarted());
return mBuffers->mMemStats[stat.getIndex()].mAllocations.getSampleCount();
}
bool Recording::hasValue(const StatType<MemAccumulator::DeallocationFacet>& stat)
{
- llassert(!isStarted());
return mBuffers->mMemStats[stat.getIndex()].mDeallocations.hasValue();
}
F64Kilobytes Recording::getSum(const StatType<MemAccumulator::DeallocationFacet>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum());
}
F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat)
{
- llassert(!isStarted());
return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum() / mElapsedSeconds.value());
}
S32 Recording::getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat)
{
- llassert(!isStarted());
return mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSampleCount();
}
bool Recording::hasValue(const StatType<CountAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mCounts[stat.getIndex()].hasValue();
}
F64 Recording::getSum(const StatType<CountAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mCounts[stat.getIndex()].getSum();
}
F64 Recording::getSum( const StatType<EventAccumulator>& stat)
{
- llassert(!isStarted());
return (F64)mBuffers->mEvents[stat.getIndex()].getSum();
}
F64 Recording::getPerSec( const StatType<CountAccumulator>& stat )
{
- llassert(!isStarted());
F64 sum = mBuffers->mCounts[stat.getIndex()].getSum();
return sum / mElapsedSeconds.value();
}
S32 Recording::getSampleCount( const StatType<CountAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mCounts[stat.getIndex()].getSampleCount();
}
bool Recording::hasValue(const StatType<SampleAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].hasValue();
}
F64 Recording::getMin( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getMin();
}
F64 Recording::getMax( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getMax();
}
F64 Recording::getMean( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getMean();
}
F64 Recording::getStandardDeviation( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getStandardDeviation();
}
F64 Recording::getLastValue( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getLastValue();
}
S32 Recording::getSampleCount( const StatType<SampleAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mSamples[stat.getIndex()].getSampleCount();
}
bool Recording::hasValue(const StatType<EventAccumulator>& stat)
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].hasValue();
}
F64 Recording::getMin( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getMin();
}
F64 Recording::getMax( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getMax();
}
F64 Recording::getMean( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getMean();
}
F64 Recording::getStandardDeviation( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getStandardDeviation();
}
F64 Recording::getLastValue( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getLastValue();
}
S32 Recording::getSampleCount( const StatType<EventAccumulator>& stat )
{
- llassert(!isStarted());
return mBuffers->mEvents[stat.getIndex()].getSampleCount();
}
@@ -964,9 +924,11 @@ void LLStopWatchControlsMixinCommon::start()
case STOPPED:
handleReset();
handleStart();
+ mPlayState = STARTED;
break;
case PAUSED:
handleStart();
+ mPlayState = STARTED;
break;
case STARTED:
break;
@@ -974,7 +936,6 @@ void LLStopWatchControlsMixinCommon::start()
llassert(false);
break;
}
- mPlayState = STARTED;
}
void LLStopWatchControlsMixinCommon::stop()
@@ -984,15 +945,16 @@ void LLStopWatchControlsMixinCommon::stop()
case STOPPED:
break;
case PAUSED:
+ mPlayState = STOPPED;
break;
case STARTED:
handleStop();
+ mPlayState = STOPPED;
break;
default:
llassert(false);
break;
}
- mPlayState = STOPPED;
}
void LLStopWatchControlsMixinCommon::pause()
@@ -1000,17 +962,37 @@ void LLStopWatchControlsMixinCommon::pause()
switch (mPlayState)
{
case STOPPED:
+ // stay stopped, don't go to pause
break;
case PAUSED:
break;
case STARTED:
handleStop();
+ mPlayState = PAUSED;
+ break;
+ default:
+ llassert(false);
+ break;
+ }
+}
+
+void LLStopWatchControlsMixinCommon::unpause()
+{
+ switch (mPlayState)
+ {
+ case STOPPED:
+ // stay stopped, don't start
+ break;
+ case PAUSED:
+ handleStart();
+ mPlayState = STARTED;
+ break;
+ case STARTED:
break;
default:
llassert(false);
break;
}
- mPlayState = PAUSED;
}
void LLStopWatchControlsMixinCommon::resume()
@@ -1019,9 +1001,11 @@ void LLStopWatchControlsMixinCommon::resume()
{
case STOPPED:
handleStart();
+ mPlayState = STARTED;
break;
case PAUSED:
handleStart();
+ mPlayState = STARTED;
break;
case STARTED:
break;
@@ -1029,7 +1013,6 @@ void LLStopWatchControlsMixinCommon::resume()
llassert(false);
break;
}
- mPlayState = STARTED;
}
void LLStopWatchControlsMixinCommon::restart()
@@ -1039,10 +1022,12 @@ void LLStopWatchControlsMixinCommon::restart()
case STOPPED:
handleReset();
handleStart();
+ mPlayState = STARTED;
break;
case PAUSED:
handleReset();
handleStart();
+ mPlayState = STARTED;
break;
case STARTED:
handleReset();
@@ -1051,7 +1036,6 @@ void LLStopWatchControlsMixinCommon::restart()
llassert(false);
break;
}
- mPlayState = STARTED;
}
void LLStopWatchControlsMixinCommon::reset()
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 4b7a5ef0da..b045aafa11 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -46,16 +46,18 @@ public:
STARTED
};
- void start();
- void stop();
- void pause();
- void resume();
- void restart();
- void reset();
+ void start(); // moves to started state, resetting if stopped
+ void stop(); // moves to stopped state
+ void pause(); // moves to paused state, unless stopped
+ void unpause(); // moves to started state if paused
+ void resume(); // moves to started state, without resetting
+ void restart(); // moves to started state, always resetting
+ void reset(); // resets
bool isStarted() const { return mPlayState == STARTED; }
bool isPaused() const { return mPlayState == PAUSED; }
bool isStopped() const { return mPlayState == STOPPED; }
+
EPlayState getPlayState() const { return mPlayState; }
// force play state to specific value by calling appropriate handle* methods
void setPlayState(EPlayState state);
@@ -66,11 +68,13 @@ protected:
{}
private:
- // trigger active behavior (without reset)
+ // override these methods to provide started/stopped semantics
+
+ // activate behavior (without reset)
virtual void handleStart() = 0;
- // stop active behavior
+ // deactivate behavior
virtual void handleStop() = 0;
- // clear accumulated state, can be called while started
+ // clear accumulated state, may be called while started
virtual void handleReset() = 0;
EPlayState mPlayState;
@@ -371,7 +375,7 @@ namespace LLTrace
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
bool has_value = false;
- T::value_t min_val(std::numeric_limits<T::value_t>::max());
+ typename T::value_t min_val(std::numeric_limits<typename T::value_t>::max());
for (S32 i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
@@ -443,7 +447,7 @@ namespace LLTrace
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
bool has_value = false;
- T::value_t max_val(std::numeric_limits<T::value_t>::min());
+ typename T::value_t max_val(std::numeric_limits<typename T::value_t>::min());
for (S32 i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp
index e769c3e22c..601d28ea3e 100755
--- a/indra/llcommon/tests/llinstancetracker_test.cpp
+++ b/indra/llcommon/tests/llinstancetracker_test.cpp
@@ -194,20 +194,21 @@ namespace tut
{
set_test_name("delete Keyed with outstanding instance_iter");
std::string what;
- Keyed* keyed = new Keyed("one");
+ Keyed* keyed = new Keyed("delete Keyed with outstanding instance_iter");
{
- WrapLL_ERRS wrapper;
+ WrapLLErrs wrapper;
Keyed::instance_iter i(Keyed::beginInstances());
try
{
delete keyed;
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
what = e.what();
}
}
ensure(! what.empty());
+ delete keyed;
}
template<> template<>
@@ -215,15 +216,15 @@ namespace tut
{
set_test_name("delete Keyed with outstanding key_iter");
std::string what;
- Keyed* keyed = new Keyed("one");
+ Keyed* keyed = new Keyed("delete Keyed with outstanding key_it");
{
- WrapLL_ERRS wrapper;
+ WrapLLErrs wrapper;
Keyed::key_iter i(Keyed::beginKeys());
try
{
delete keyed;
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
what = e.what();
}
@@ -238,13 +239,13 @@ namespace tut
std::string what;
Unkeyed* unkeyed = new Unkeyed;
{
- WrapLL_ERRS wrapper;
+ WrapLLErrs wrapper;
Unkeyed::instance_iter i(Unkeyed::beginInstances());
try
{
delete unkeyed;
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
what = e.what();
}
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index a4d3a4e026..3137bd8fea 100755
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -46,9 +46,9 @@
// replicate, but better to reuse
extern void wouldHaveCrashed(const std::string& message);
-struct WrapLL_ERRS
+struct WrapLLErrs
{
- WrapLL_ERRS():
+ WrapLLErrs():
// Resetting Settings discards the default Recorder that writes to
// stderr. Otherwise, expected llerrs (LL_ERRS) messages clutter the
// console output of successful tests, potentially confusing things.
@@ -57,10 +57,10 @@ struct WrapLL_ERRS
mPriorFatal(LLError::getFatalFunction())
{
// Make LL_ERRS call our own operator() method
- LLError::setFatalFunction(boost::bind(&WrapLL_ERRS::operator(), this, _1));
+ LLError::setFatalFunction(boost::bind(&WrapLLErrs::operator(), this, _1));
}
- ~WrapLL_ERRS()
+ ~WrapLLErrs()
{
LLError::setFatalFunction(mPriorFatal);
LLError::restoreSettings(mPriorErrorSettings);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 037a9bda86..0c9baec00a 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -5601,8 +5601,6 @@ void LLAppViewer::metricsSend(bool enable_reporting)
LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats));
main_stats->stop();
- main_stats->updateStats();
-
// Send a report request into 'thread1' to get the rest of the data
// and provide some additional parameters while here.
LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index e009863002..54ac29723f 100755
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -353,14 +353,6 @@ void LLViewerAssetStats::setRegion(region_handle_t region_handle)
mRegionHandle = region_handle;
}
-void LLViewerAssetStats::updateStats()
-{
- if (mCurRecording && mCurRecording->isStarted())
- {
- mCurRecording->update();
- }
-}
-
void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
{
using namespace LLViewerAssetStatsFF;
diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h
index aaa299bf4b..9d425c82fc 100755
--- a/indra/newview/llviewerassetstats.h
+++ b/indra/newview/llviewerassetstats.h
@@ -162,10 +162,6 @@ public:
// collection calls.
void setRegion(region_handle_t region_handle);
- // gather latest metrics data
- // call from main thread
- void updateStats();
-
// Retrieve current metrics for all visited regions (NULL region UUID/handle excluded)
// Uses AssetStats structure seen above
void getStats(AssetStats& stats, bool compact_output);