summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-10-18 09:14:53 -0700
committerRichard Linden <none@none>2013-10-18 09:14:53 -0700
commit9f097380b85a307db472726175c3515fdeb5aed5 (patch)
treef826df84d9ae357b817bcd17e9e24097b8917af6 /indra/llcommon
parent18aedf0241ba893e12140c0a3855f328d2b4eded (diff)
removed asserts in order to get testable builds again
added unpause() behavior and changed pause() to do nothing when already stopped
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/lltracerecording.cpp74
-rw-r--r--indra/llcommon/lltracerecording.h22
2 files changed, 42 insertions, 54 deletions
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..4e94c2110b 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;