fix for assert at runtime (reading stats from recording while it was active)
fix for bad values returns from getPeriodMin and getPeriodMax on count stats when no counts recorded fix for gcc compile time error (typename ftw)master
parent
ec17869024
commit
18aedf0241
|
|
@ -215,7 +215,7 @@ private:
|
|||
{
|
||||
mInstanceKey = key;
|
||||
InstanceMap& map = getMap_();
|
||||
InstanceMap::iterator insertion_point_it = map.lower_bound(key);
|
||||
typename InstanceMap::iterator insertion_point_it = map.lower_bound(key);
|
||||
if (ALLOW_KEY_COLLISIONS == InstanceTrackerDisallowKeyCollisions
|
||||
&& insertion_point_it != map.end()
|
||||
&& insertion_point_it->first == key)
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ namespace LLTrace
|
|||
{
|
||||
public:
|
||||
typedef F64 value_t;
|
||||
static F64 getDefaultValue() { return NaN; }
|
||||
|
||||
EventAccumulator()
|
||||
: mSum(0),
|
||||
|
|
@ -293,6 +294,7 @@ namespace LLTrace
|
|||
{
|
||||
public:
|
||||
typedef F64 value_t;
|
||||
static F64 getDefaultValue() { return NaN; }
|
||||
|
||||
SampleAccumulator()
|
||||
: mSum(0),
|
||||
|
|
@ -385,6 +387,7 @@ namespace LLTrace
|
|||
{
|
||||
public:
|
||||
typedef F64 value_t;
|
||||
static F64 getDefaultValue() { return 0; }
|
||||
|
||||
CountAccumulator()
|
||||
: mSum(0),
|
||||
|
|
@ -415,6 +418,8 @@ namespace LLTrace
|
|||
|
||||
S32 getSampleCount() const { return mNumSamples; }
|
||||
|
||||
bool hasValue() const { return true; }
|
||||
|
||||
private:
|
||||
F64 mSum;
|
||||
|
||||
|
|
@ -425,6 +430,8 @@ namespace LLTrace
|
|||
{
|
||||
public:
|
||||
typedef F64Seconds value_t;
|
||||
static F64Seconds getDefaultValue() { return F64Seconds(0); }
|
||||
|
||||
typedef TimeBlockAccumulator self_t;
|
||||
|
||||
// fake classes that allows us to view different facets of underlying statistic
|
||||
|
|
@ -453,6 +460,7 @@ namespace LLTrace
|
|||
void addSamples(const self_t& other, EBufferAppendType append_type);
|
||||
void reset(const self_t* other);
|
||||
void sync(F64SecondsImplicit) {}
|
||||
bool hasValue() const { return true; }
|
||||
|
||||
//
|
||||
// members
|
||||
|
|
@ -493,17 +501,22 @@ namespace LLTrace
|
|||
|
||||
struct MemAccumulator
|
||||
{
|
||||
typedef F64Bytes value_t;
|
||||
static F64Bytes getDefaultValue() { return F64Bytes(0); }
|
||||
|
||||
typedef MemAccumulator self_t;
|
||||
|
||||
// fake classes that allows us to view different facets of underlying statistic
|
||||
struct AllocationFacet
|
||||
{
|
||||
typedef F64Bytes value_t;
|
||||
static F64Bytes getDefaultValue() { return F64Bytes(0); }
|
||||
};
|
||||
|
||||
struct DeallocationFacet
|
||||
{
|
||||
typedef F64Bytes value_t;
|
||||
static F64Bytes getDefaultValue() { return F64Bytes(0); }
|
||||
};
|
||||
|
||||
void addSamples(const MemAccumulator& other, EBufferAppendType append_type)
|
||||
|
|
@ -536,6 +549,8 @@ namespace LLTrace
|
|||
mSize.sync(time_stamp);
|
||||
}
|
||||
|
||||
bool hasValue() const { return mSize.hasValue(); }
|
||||
|
||||
SampleAccumulator mSize;
|
||||
EventAccumulator mAllocations;
|
||||
CountAccumulator mDeallocations;
|
||||
|
|
|
|||
|
|
@ -137,6 +137,12 @@ void Recording::appendRecording( Recording& other )
|
|||
mElapsedSeconds += other.mElapsedSeconds;
|
||||
}
|
||||
|
||||
bool Recording::hasValue(const StatType<TimeBlockAccumulator>& stat)
|
||||
{
|
||||
llassert(!isStarted());
|
||||
return mBuffers->mStackTimers[stat.getIndex()].hasValue();
|
||||
}
|
||||
|
||||
F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator>& stat)
|
||||
{
|
||||
llassert(!isStarted());
|
||||
|
|
@ -219,6 +225,12 @@ F64Kilobytes Recording::getLastValue(const StatType<MemAccumulator>& stat)
|
|||
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());
|
||||
|
|
@ -237,6 +249,13 @@ S32 Recording::getSampleCount(const StatType<MemAccumulator::AllocationFacet>& s
|
|||
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());
|
||||
|
|
@ -255,13 +274,19 @@ S32 Recording::getSampleCount(const StatType<MemAccumulator::DeallocationFacet>&
|
|||
return mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSampleCount();
|
||||
}
|
||||
|
||||
F64 Recording::getSum( const StatType<CountAccumulator>& stat )
|
||||
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 )
|
||||
F64 Recording::getSum( const StatType<EventAccumulator>& stat)
|
||||
{
|
||||
llassert(!isStarted());
|
||||
return (F64)mBuffers->mEvents[stat.getIndex()].getSum();
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ namespace LLTrace
|
|||
void makeUnique() { mBuffers.makeUnique(); }
|
||||
|
||||
// Timer accessors
|
||||
bool hasValue(const StatType<TimeBlockAccumulator>& stat);
|
||||
F64Seconds getSum(const StatType<TimeBlockAccumulator>& stat);
|
||||
F64Seconds getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat);
|
||||
S32 getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat);
|
||||
|
|
@ -178,22 +179,24 @@ namespace LLTrace
|
|||
|
||||
// Memory accessors
|
||||
bool hasValue(const StatType<MemAccumulator>& stat);
|
||||
|
||||
F64Kilobytes getMin(const StatType<MemAccumulator>& stat);
|
||||
F64Kilobytes getMean(const StatType<MemAccumulator>& stat);
|
||||
F64Kilobytes getMax(const StatType<MemAccumulator>& stat);
|
||||
F64Kilobytes getStandardDeviation(const StatType<MemAccumulator>& stat);
|
||||
F64Kilobytes getLastValue(const StatType<MemAccumulator>& stat);
|
||||
|
||||
bool hasValue(const StatType<MemAccumulator::AllocationFacet>& stat);
|
||||
F64Kilobytes getSum(const StatType<MemAccumulator::AllocationFacet>& stat);
|
||||
F64Kilobytes getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat);
|
||||
S32 getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat);
|
||||
|
||||
bool hasValue(const StatType<MemAccumulator::DeallocationFacet>& stat);
|
||||
F64Kilobytes getSum(const StatType<MemAccumulator::DeallocationFacet>& stat);
|
||||
F64Kilobytes getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat);
|
||||
S32 getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat);
|
||||
|
||||
// CountStatHandle accessors
|
||||
bool hasValue(const StatType<CountAccumulator>& stat);
|
||||
F64 getSum(const StatType<CountAccumulator>& stat);
|
||||
template <typename T>
|
||||
typename RelatedTypes<T>::sum_t getSum(const CountStatHandle<T>& stat)
|
||||
|
|
@ -367,13 +370,21 @@ namespace LLTrace
|
|||
S32 total_periods = mNumPeriods;
|
||||
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
|
||||
|
||||
typename T::value_t min_val = std::numeric_limits<typename T::value_t>::max();
|
||||
bool has_value = false;
|
||||
T::value_t min_val(std::numeric_limits<T::value_t>::max());
|
||||
for (S32 i = 1; i <= num_periods; i++)
|
||||
{
|
||||
Recording& recording = getPrevRecording(i);
|
||||
min_val = llmin(min_val, recording.getSum(stat));
|
||||
if (recording.hasValue(stat))
|
||||
{
|
||||
min_val = llmin(min_val, recording.getSum(stat));
|
||||
has_value = true;
|
||||
}
|
||||
}
|
||||
return min_val;
|
||||
|
||||
return has_value
|
||||
? min_val
|
||||
: T::getDefaultValue();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -405,7 +416,7 @@ namespace LLTrace
|
|||
S32 total_periods = mNumPeriods;
|
||||
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
|
||||
|
||||
typename RelatedTypes<typename T::value_t>::fractional_t min_val = std::numeric_limits<F64>::max();
|
||||
typename RelatedTypes<typename T::value_t>::fractional_t min_val(std::numeric_limits<F64>::max());
|
||||
for (S32 i = 1; i <= num_periods; i++)
|
||||
{
|
||||
Recording& recording = getPrevRecording(i);
|
||||
|
|
@ -431,13 +442,21 @@ namespace LLTrace
|
|||
S32 total_periods = mNumPeriods;
|
||||
num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods);
|
||||
|
||||
typename T::value_t max_val = std::numeric_limits<typename T::value_t>::min();
|
||||
bool has_value = false;
|
||||
T::value_t max_val(std::numeric_limits<T::value_t>::min());
|
||||
for (S32 i = 1; i <= num_periods; i++)
|
||||
{
|
||||
Recording& recording = getPrevRecording(i);
|
||||
max_val = llmax(max_val, recording.getSum(stat));
|
||||
if (recording.hasValue(stat))
|
||||
{
|
||||
max_val = llmax(max_val, recording.getSum(stat));
|
||||
has_value = true;
|
||||
}
|
||||
}
|
||||
return max_val;
|
||||
|
||||
return has_value
|
||||
? max_val
|
||||
: T::getDefaultValue();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT_RATE("
|
|||
LLViewerStats::LLViewerStats()
|
||||
: mLastTimeDiff(0.0)
|
||||
{
|
||||
mRecording.start();
|
||||
getRecording().start();
|
||||
}
|
||||
|
||||
LLViewerStats::~LLViewerStats()
|
||||
|
|
@ -216,7 +216,7 @@ LLViewerStats::~LLViewerStats()
|
|||
|
||||
void LLViewerStats::resetStats()
|
||||
{
|
||||
LLViewerStats::instance().mRecording.reset();
|
||||
getRecording().reset();
|
||||
}
|
||||
|
||||
void LLViewerStats::updateFrameStats(const F64Seconds time_diff)
|
||||
|
|
@ -457,6 +457,8 @@ void send_stats()
|
|||
return;
|
||||
}
|
||||
|
||||
LLViewerStats::instance().getRecording().pause();
|
||||
|
||||
body["session_id"] = gAgentSessionID;
|
||||
|
||||
LLSD &agent = body["agent"];
|
||||
|
|
@ -616,6 +618,8 @@ void send_stats()
|
|||
|
||||
LLViewerStats::getInstance()->addToMessage(body);
|
||||
LLHTTPClient::post(url, body, new ViewerStatsResponder());
|
||||
|
||||
LLViewerStats::instance().getRecording().resume();
|
||||
}
|
||||
|
||||
LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue