SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics console

added percentage/ratio units
added auto-range and auto tick calculation to stat bar to automate display stats
master
Richard Linden 2013-07-08 00:55:17 -07:00
parent bc7d2b7696
commit d122318bef
27 changed files with 717 additions and 1316 deletions

View File

@ -27,9 +27,7 @@
#include "linden_common.h"
//#if MEM_TRACK_MEM
#include "llthread.h"
//#endif
#if defined(LL_WINDOWS)
# include <psapi.h>
@ -421,141 +419,6 @@ U32 LLMemory::getWorkingSetSize()
#endif
//--------------------------------------------------------------------------------------------------
#if MEM_TRACK_MEM
#include "llframetimer.h"
//static
LLMemTracker* LLMemTracker::sInstance = NULL ;
LLMemTracker::LLMemTracker()
{
mLastAllocatedMem = LLMemory::getWorkingSetSize() ;
mCapacity = 128 ;
mCurIndex = 0 ;
mCounter = 0 ;
mDrawnIndex = 0 ;
mPaused = FALSE ;
mMutexp = new LLMutex() ;
mStringBuffer = new char*[128] ;
mStringBuffer[0] = new char[mCapacity * 128] ;
for(S32 i = 1 ; i < mCapacity ; i++)
{
mStringBuffer[i] = mStringBuffer[i-1] + 128 ;
}
}
LLMemTracker::~LLMemTracker()
{
delete[] mStringBuffer[0] ;
delete[] mStringBuffer;
delete mMutexp ;
}
//static
LLMemTracker* LLMemTracker::getInstance()
{
if(!sInstance)
{
sInstance = new LLMemTracker() ;
}
return sInstance ;
}
//static
void LLMemTracker::release()
{
if(sInstance)
{
delete sInstance ;
sInstance = NULL ;
}
}
//static
void LLMemTracker::track(const char* function, const int line)
{
static const S32 MIN_ALLOCATION = 0 ; //1KB
if(mPaused)
{
return ;
}
U32 allocated_mem = LLMemory::getWorkingSetSize() ;
LLMutexLock lock(mMutexp) ;
S32 delta_mem = allocated_mem - mLastAllocatedMem ;
mLastAllocatedMem = allocated_mem ;
if(delta_mem <= 0)
{
return ; //occupied memory does not grow
}
if(delta_mem < MIN_ALLOCATION)
{
return ;
}
char* buffer = mStringBuffer[mCurIndex++] ;
F32 time = (F32)LLFrameTimer::getElapsedSeconds() ;
S32 hours = (S32)(time / (60*60));
S32 mins = (S32)((time - hours*(60*60)) / 60);
S32 secs = (S32)((time - hours*(60*60) - mins*60));
strcpy(buffer, function) ;
sprintf(buffer + strlen(function), " line: %d DeltaMem: %d (bytes) Time: %d:%02d:%02d", line, delta_mem, hours,mins,secs) ;
if(mCounter < mCapacity)
{
mCounter++ ;
}
if(mCurIndex >= mCapacity)
{
mCurIndex = 0 ;
}
}
//static
void LLMemTracker::preDraw(BOOL pause)
{
mMutexp->lock() ;
mPaused = pause ;
mDrawnIndex = mCurIndex - 1;
mNumOfDrawn = 0 ;
}
//static
void LLMemTracker::postDraw()
{
mMutexp->unlock() ;
}
//static
const char* LLMemTracker::getNextLine()
{
if(mNumOfDrawn >= mCounter)
{
return NULL ;
}
mNumOfDrawn++;
if(mDrawnIndex < 0)
{
mDrawnIndex = mCapacity - 1 ;
}
return mStringBuffer[mDrawnIndex--] ;
}
#endif //MEM_TRACK_MEM
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//minimum slot size and minimal slot size interval

View File

@ -184,51 +184,6 @@ private:
static BOOL sEnableMemoryFailurePrevention;
};
//----------------------------------------------------------------------------
#if MEM_TRACK_MEM
class LLMutex ;
class LL_COMMON_API LLMemTracker
{
private:
LLMemTracker() ;
~LLMemTracker() ;
public:
static void release() ;
static LLMemTracker* getInstance() ;
void track(const char* function, const int line) ;
void preDraw(BOOL pause) ;
void postDraw() ;
const char* getNextLine() ;
private:
static LLMemTracker* sInstance ;
char** mStringBuffer ;
S32 mCapacity ;
U32 mLastAllocatedMem ;
S32 mCurIndex ;
S32 mCounter;
S32 mDrawnIndex;
S32 mNumOfDrawn;
BOOL mPaused;
LLMutex* mMutexp ;
};
#define MEM_TRACK_RELEASE LLMemTracker::release() ;
#define MEM_TRACK LLMemTracker::getInstance()->track(__FUNCTION__, __LINE__) ;
#else // MEM_TRACK_MEM
#define MEM_TRACK_RELEASE
#define MEM_TRACK
#endif // MEM_TRACK_MEM
//----------------------------------------------------------------------------
//
//class LLPrivateMemoryPool defines a private memory pool for an application to use, so the application does not
//need to access the heap directly fro each memory allocation. Throught this, the allocation speed is faster,

View File

@ -61,6 +61,7 @@ public:
virtual const char* getUnitLabel();
const std::string& getName() const { return mName; }
const std::string& getDescription() const { return mDescription; }
protected:
const std::string mName;
@ -169,7 +170,7 @@ public:
typedef TraceType<CountAccumulator> trace_t;
CountStatHandle(const char* name, const char* description = NULL)
: trace_t(name)
: trace_t(name, description)
{}
/*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); }

View File

@ -571,6 +571,11 @@ LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, * 1000);
LL_DECLARE_BASE_UNIT(Radians, "rad");
LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 0.01745329251994);
LL_DECLARE_BASE_UNIT(Percent, "%");
LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100);
LL_DECLARE_BASE_UNIT(Triangles, "tris");
LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, * 1000);
} // namespace LLUnits

View File

@ -75,6 +75,8 @@ const F32 OO_SQRT2 = 0.7071067811865475244008443621049f;
const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f;
const F32 RAD_TO_DEG = 57.295779513082320876798154814105f;
const F32 F_APPROXIMATELY_ZERO = 0.00001f;
const F32 F_LN10 = 2.3025850929940456840179914546844f;
const F32 OO_LN10 = 0.43429448190325182765112891891661;
const F32 F_LN2 = 0.69314718056f;
const F32 OO_LN2 = 1.4426950408889634073599246810019f;

View File

@ -34,7 +34,7 @@
#include "llthread.h"
#include <iterator>
#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked());
#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED() llassert(!mMutexp || mMutexp->isSelfLocked())
/**
* LLSegment
@ -287,7 +287,7 @@ LLChannelDescriptors LLBufferArray::nextChannel()
//mMutexp should be locked before calling this.
S32 LLBufferArray::capacity() const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
S32 total = 0;
const_buffer_iterator_t iter = mBuffers.begin();
@ -315,7 +315,7 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
//mMutexp should be locked before calling this.
bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
std::vector<LLSegment> segments;
if(copyIntoBuffers(channel, src, len, segments))
@ -350,7 +350,7 @@ bool LLBufferArray::insertAfter(
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t end = mSegments.end();
segment_iterator_t it = getSegment(address);
@ -382,14 +382,14 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::beginSegment()
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
return mSegments.begin();
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::endSegment()
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
return mSegments.end();
}
@ -398,7 +398,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
U8* address,
LLSegment& segment)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t rv = mSegments.begin();
segment_iterator_t end = mSegments.end();
if(!address)
@ -447,7 +447,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t end = mSegments.end();
if(!address)
{
@ -469,7 +469,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment(
U8* address) const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
const_segment_iterator_t end = mSegments.end();
if(!address)
{
@ -624,7 +624,7 @@ U8* LLBufferArray::seek(
U8* start,
S32 delta) const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
const_segment_iterator_t it;
const_segment_iterator_t end = mSegments.end();
U8* rv = start;
@ -792,7 +792,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
S32 channel,
S32 len)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
// start at the end of the buffers, because it is the most likely
// to have free space.
LLSegment segment;
@ -830,7 +830,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
//mMutexp should be locked before calling this.
bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
// Find out which buffer contains the segment, and if it is found,
// ask it to reclaim the memory.
@ -862,7 +862,7 @@ bool LLBufferArray::copyIntoBuffers(
S32 len,
std::vector<LLSegment>& segments)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
if(!src || !len) return false;
S32 copied = 0;
LLSegment segment;

View File

@ -167,7 +167,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent)
//LLView *childp;
// These will be used for the children
left = 4;
left = 10;
top = getRect().getHeight() - 4;
right = width - 2;
bottom = top;

View File

@ -37,32 +37,137 @@
#include "lluictrlfactory.h"
#include "lltracerecording.h"
#include "llcriticaldamp.h"
#include "lltooltip.h"
#include <iostream>
F32 calc_reasonable_tick_value(F32 min, F32 max)
{
F32 range = max - min;
const S32 DIVISORS[] = {6, 8, 10, 4, 5};
// try storing
S32 best_decimal_digit_count = S32_MAX;
S32 best_divisor = 10;
for (U32 divisor_idx = 0; divisor_idx < LL_ARRAY_SIZE(DIVISORS); divisor_idx++)
{
S32 divisor = DIVISORS[divisor_idx];
F32 possible_tick_value = range / divisor;
S32 num_whole_digits = llceil(logf(min + possible_tick_value) * OO_LN10);
for (S32 digit_count = -(num_whole_digits - 1); digit_count < 6; digit_count++)
{
F32 test_tick_value = min + (possible_tick_value * pow(10.0, digit_count));
if (is_approx_equal((F32)(S32)test_tick_value, (F32)test_tick_value))
{
if (digit_count < best_decimal_digit_count)
{
best_decimal_digit_count = digit_count;
best_divisor = divisor;
}
break;
}
}
}
return is_approx_equal(range, 0.f) ? 1.f : range / best_divisor;
}
void calc_display_range(F32& min, F32& max)
{
const F32 RANGES[] = {1.f, 1.5f, 2.f, 3.f, 5.f, 10.f};
const S32 num_digits_max = is_approx_equal(fabs(max), 0.f)
? S32_MIN + 1
: llceil(logf(fabs(max)) * OO_LN10);
const S32 num_digits_min = is_approx_equal(fabs(min), 0.f)
? S32_MIN + 1
: llceil(logf(fabs(min)) * OO_LN10);
const S32 num_digits = llmax(num_digits_max, num_digits_min);
const F32 starting_max = pow(10.0, num_digits - 1) * ((max < 0.f) ? -1 : 1);
const F32 starting_min = pow(10.0, num_digits - 1) * ((min < 0.f) ? -1 : 1);
F32 new_max = starting_max;
F32 new_min = starting_min;
F32 out_max = max;
F32 out_min = min;
for (S32 range_idx = 0; range_idx < LL_ARRAY_SIZE(RANGES); range_idx++)
{
new_max = starting_max * RANGES[range_idx];
new_min = starting_min * RANGES[range_idx];
if (min > 0.f && new_min < min)
{
out_min = new_min;
}
if (max < 0.f && new_max > max)
{
out_max = new_max;
}
}
new_max = starting_max;
new_min = starting_min;
for (S32 range_idx = LL_ARRAY_SIZE(RANGES) - 1; range_idx >= 0; range_idx--)
{
new_max = starting_max * RANGES[range_idx];
new_min = starting_min * RANGES[range_idx];
if (min < 0.f && new_min < min)
{
out_min = new_min;
}
if (max > 0.f && new_max > max)
{
out_max = new_max;
}
}
min = out_min;
max = out_max;
}
///////////////////////////////////////////////////////////////////////////////////
LLStatBar::LLStatBar(const Params& p)
: LLView(p),
mLabel(p.label),
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
mCurMaxBar(p.bar_max),
mTickSpacing(p.tick_spacing),
mPrecision(p.precision),
mUpdatesPerSec(p.update_rate),
mUnitScale(p.unit_scale),
mNumFrames(p.num_frames),
mMaxHeight(p.max_height),
mPerSec(p.show_per_sec),
mDisplayBar(p.show_bar),
mDisplayHistory(p.show_history),
mDisplayMean(p.show_mean),
mOrientation(p.orientation),
mScaleRange(p.scale_range)
: LLView(p),
mLabel(p.label),
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
mCurMaxBar(p.bar_max),
mTickValue(p.tick_spacing.isProvided() ? p.tick_spacing : calc_reasonable_tick_value(p.bar_min, p.bar_max)),
mDecimalDigits(p.decimal_digits),
mNumFrames(p.num_frames),
mMaxHeight(p.max_height),
mPerSec(p.show_per_sec),
mDisplayBar(p.show_bar),
mDisplayHistory(p.show_history),
mDisplayMean(p.show_mean),
mOrientation(p.orientation),
mScaleMax(!p.bar_max.isProvided()),
mScaleMin(!p.bar_min.isProvided())
{
setStat(p.stat);
}
BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask)
{
if (mCountFloatp)
{
LLToolTipMgr::instance().show(LLToolTip::Params().message(mCountFloatp->getDescription()).sticky_rect(calcScreenRect()));
}
else if ( mEventFloatp)
{
LLToolTipMgr::instance().show(LLToolTip::Params().message(mEventFloatp->getDescription()).sticky_rect(calcScreenRect()));
}
else if (mSampleFloatp)
{
LLToolTipMgr::instance().show(LLToolTip::Params().message(mSampleFloatp->getDescription()).sticky_rect(calcScreenRect()));
}
return TRUE;
}
BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseDown(x, y, mask);
@ -96,23 +201,27 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
void LLStatBar::draw()
{
F32 current = 0.f,
min = 0.f,
max = 0.f,
mean = 0.f;
F32 current = 0,
min = 0,
max = 0,
mean = 0,
value = 0;
LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
std::string unit_label;
if (mCountFloatp)
{
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
unit_label = mUnitLabel.empty() ? mCountFloatp->getUnitLabel() : mUnitLabel;
if (mPerSec)
{
unit_label += "/s";
current = last_frame_recording.getPerSec(*mCountFloatp);
min = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
max = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp, mNumFrames);
value = mDisplayMean ? mean : current;
}
else
{
@ -120,43 +229,30 @@ void LLStatBar::draw()
min = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames);
mean = frame_recording.getPeriodMean(*mCountFloatp, mNumFrames);
value = mDisplayMean ? mean : current;
}
}
else if (mEventFloatp)
{
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
unit_label = mUnitLabel.empty() ? mEventFloatp->getUnitLabel() : mUnitLabel;
current = last_frame_recording.getMean(*mEventFloatp);
min = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames);
mean = frame_recording.getPeriodMean(*mEventFloatp, mNumFrames);
value = mDisplayMean ? mean : current;
}
else if (mSampleFloatp)
{
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();
unit_label = mUnitLabel.empty() ? mSampleFloatp->getUnitLabel() : mUnitLabel;
current = last_frame_recording.getLastValue(*mSampleFloatp);
min = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames);
max = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames);
mean = frame_recording.getPeriodMean(*mSampleFloatp, mNumFrames);
}
current *= mUnitScale;
min *= mUnitScale;
max *= mUnitScale;
mean *= mUnitScale;
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
if (mDisplayMean)
{
mValue = mean;
}
else
{
mValue = current;
}
mUpdateTimer.reset();
value = mDisplayMean ? mean : current;
}
S32 bar_top, bar_left, bar_right, bar_bottom;
@ -177,39 +273,40 @@ void LLStatBar::draw()
const S32 tick_length = 4;
const S32 tick_width = 1;
if (mScaleRange && min < max)
if ((mScaleMax && max >= mCurMaxBar)|| (mScaleMin && min <= mCurMinBar))
{
F32 cur_max = mTickSpacing;
while(max > cur_max && mMaxBar > cur_max)
{
cur_max += mTickSpacing;
}
mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f);
F32 range_min = min;
F32 range_max = max;
calc_display_range(range_min, range_max);
if (mScaleMax) { mMaxBar = llmax(mMaxBar, range_max); }
if (mScaleMin) { mMinBar = llmin(mMinBar, range_min); }
mTickValue = calc_reasonable_tick_value(mMinBar, mMaxBar);
}
mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, mMaxBar, 0.05f);
mCurMinBar = LLSmoothInterpolation::lerp(mCurMinBar, mMinBar, 0.05f);
F32 value_scale;
if (mCurMaxBar == mCurMinBar)
{
value_scale = 0.f;
}
else
{
mCurMaxBar = mMaxBar;
value_scale = (mOrientation == HORIZONTAL)
? (bar_top - bar_bottom)/(mCurMaxBar - mCurMinBar)
: (bar_right - bar_left)/(mCurMaxBar - mCurMinBar);
}
F32 value_scale = (mOrientation == HORIZONTAL)
? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar)
: (bar_right - bar_left)/(mCurMaxBar - mMinBar);
LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
std::string value_format;
std::string value_str;
if (!mUnitLabel.empty())
S32 decimal_digits = mDecimalDigits;
if (is_approx_equal((F32)(S32)value, value))
{
value_format = llformat( "%%.%df%%s", mPrecision);
value_str = llformat( value_format.c_str(), mValue, mUnitLabel.c_str());
}
else
{
value_format = llformat( "%%.%df", mPrecision);
value_str = llformat( value_format.c_str(), mValue);
decimal_digits = 0;
}
std::string value_str = llformat("%10.*f %s", decimal_digits, value, unit_label.c_str());
// Draw the value.
if (mOrientation == HORIZONTAL)
@ -225,11 +322,8 @@ void LLStatBar::draw()
LLFontGL::RIGHT, LLFontGL::TOP);
}
value_format = llformat( "%%.%df", mPrecision);
if (mDisplayBar && (mCountFloatp || mEventFloatp || mSampleFloatp))
{
std::string tick_label;
// Draw the tick marks.
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@ -237,9 +331,10 @@ void LLStatBar::draw()
S32 last_label = 0;
const S32 MIN_TICK_SPACING = mOrientation == HORIZONTAL ? 20 : 30;
const S32 MIN_LABEL_SPACING = mOrientation == HORIZONTAL ? 40 : 60;
for (F32 tick_value = mMinBar + mTickSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
// start counting from actual min, not current, animating min, so that ticks don't float between numbers
for (F32 tick_value = mMinBar; tick_value <= mCurMaxBar; tick_value += mTickValue)
{
const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
const S32 begin = llfloor((tick_value - mCurMinBar)*value_scale);
const S32 end = begin + tick_width;
if (begin - last_tick < MIN_TICK_SPACING)
{
@ -247,14 +342,19 @@ void LLStatBar::draw()
}
last_tick = begin;
tick_label = llformat( value_format.c_str(), tick_value);
S32 decimal_digits = mDecimalDigits;
if (is_approx_equal((F32)(S32)tick_value, tick_value))
{
decimal_digits = 0;
}
std::string tick_string = llformat("%10.*f", decimal_digits, tick_value);
if (mOrientation == HORIZONTAL)
{
if (begin - last_label > MIN_LABEL_SPACING)
{
gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin,
LLFontGL::getFontMonospace()->renderUTF8(tick_string, 0, bar_right, begin,
LLColor4(1.f, 1.f, 1.f, 0.5f),
LLFontGL::LEFT, LLFontGL::VCENTER);
last_label = begin;
@ -269,7 +369,7 @@ void LLStatBar::draw()
if (begin - last_label > MIN_LABEL_SPACING)
{
gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length,
LLFontGL::getFontMonospace()->renderUTF8(tick_string, 0, begin - 1, bar_bottom - tick_length,
LLColor4(1.f, 1.f, 1.f, 0.5f),
LLFontGL::RIGHT, LLFontGL::TOP);
last_label = begin;
@ -291,7 +391,7 @@ void LLStatBar::draw()
}
// draw min and max
S32 begin = (S32) ((min - mMinBar) * value_scale);
S32 begin = (S32) ((min - mCurMinBar) * value_scale);
if (begin < 0)
{
@ -299,7 +399,7 @@ void LLStatBar::draw()
llwarns << "Min:" << min << llendl;
}
S32 end = (S32) ((max - mMinBar) * value_scale);
S32 end = (S32) ((max - mCurMinBar) * value_scale);
if (mOrientation == HORIZONTAL)
{
gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 0.25f));
@ -327,47 +427,30 @@ void LLStatBar::draw()
{
F32 offset = ((F32)i / (F32)mNumFrames) * span;
LLTrace::Recording& recording = frame_recording.getPrevRecording(i);
if (mPerSec)
if (mPerSec && mCountFloatp)
{
if (mCountFloatp)
{
begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale);
end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mCountFloatp);
}
else if (mEventFloatp)
{
//rate isn't defined for measurement stats, so use mean
begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mEventFloatp);
}
else if (mSampleFloatp)
{
//rate isn't defined for sample stats, so use mean
begin = ((recording.getMean(*mSampleFloatp) - mMinBar) * value_scale);
end = ((recording.getMean(*mSampleFloatp) - mMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mSampleFloatp);
}
begin = ((recording.getPerSec(*mCountFloatp) - mCurMinBar) * value_scale);
end = ((recording.getPerSec(*mCountFloatp) - mCurMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mCountFloatp);
}
else
{
if (mCountFloatp)
{
begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale);
end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
begin = ((recording.getSum(*mCountFloatp) - mCurMinBar) * value_scale);
end = ((recording.getSum(*mCountFloatp) - mCurMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mCountFloatp);
}
else if (mEventFloatp)
{
begin = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale);
end = ((recording.getMean(*mEventFloatp) - mMinBar) * value_scale) + 1;
begin = ((recording.getMean(*mEventFloatp) - mCurMinBar) * value_scale);
end = ((recording.getMean(*mEventFloatp) - mCurMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mEventFloatp);
}
else if (mSampleFloatp)
{
begin = ((recording.getMean(*mSampleFloatp) - mMinBar) * value_scale);
end = ((recording.getMean(*mSampleFloatp) - mMinBar) * value_scale) + 1;
begin = ((recording.getMean(*mSampleFloatp) - mCurMinBar) * value_scale);
end = ((recording.getMean(*mSampleFloatp) - mCurMinBar) * value_scale) + 1;
num_samples = recording.getSampleCount(*mSampleFloatp);
}
}
@ -393,8 +476,8 @@ void LLStatBar::draw()
}
else
{
S32 begin = (S32) ((current - mMinBar) * value_scale) - 1;
S32 end = (S32) ((current - mMinBar) * value_scale) + 1;
S32 begin = (S32) ((current - mCurMinBar) * value_scale) - 1;
S32 end = (S32) ((current - mCurMinBar) * value_scale) + 1;
// draw current
if (mOrientation == HORIZONTAL)
{
@ -408,8 +491,8 @@ void LLStatBar::draw()
// draw mean bar
{
const S32 begin = (S32) ((mean - mMinBar) * value_scale) - 1;
const S32 end = (S32) ((mean - mMinBar) * value_scale) + 1;
const S32 begin = (S32) ((mean - mCurMinBar) * value_scale) - 1;
const S32 end = (S32) ((mean - mCurMinBar) * value_scale) + 1;
if (mOrientation == HORIZONTAL)
{
gl_rect_2d(bar_left - 2, begin, bar_right + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f));
@ -432,11 +515,11 @@ void LLStatBar::setStat(const std::string& stat_name)
}
void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing)
void LLStatBar::setRange(F32 bar_min, F32 bar_max)
{
mMinBar = bar_min;
mMaxBar = bar_max;
mTickSpacing = tick_spacing;
mMinBar = bar_min;
mMaxBar = bar_max;
mTickValue = calc_reasonable_tick_value(mMinBar, mMaxBar);
}
LLRect LLStatBar::getRequiredRect()

View File

@ -42,11 +42,9 @@ public:
Optional<F32> bar_min,
bar_max,
tick_spacing,
update_rate,
unit_scale;
tick_spacing;
Optional<U32> precision;
Optional<U32> decimal_digits;
Optional<bool> show_per_sec,
show_bar,
@ -60,23 +58,21 @@ public:
Optional<EOrientation> orientation;
Params()
: label("label"),
unit_label("unit_label"),
bar_min("bar_min", 0.0f),
bar_max("bar_max", 50.0f),
tick_spacing("tick_spacing", 10.0f),
precision("precision", 0),
update_rate("update_rate", 5.0f),
unit_scale("unit_scale", 1.f),
show_per_sec("show_per_sec", true),
show_bar("show_bar", true),
show_history("show_history", false),
show_mean("show_mean", true),
scale_range("scale_range", true),
num_frames("num_frames", 300),
max_height("max_height", 200),
stat("stat"),
orientation("orientation", VERTICAL)
: label("label"),
unit_label("unit_label"),
bar_min("bar_min", 0.0f),
bar_max("bar_max", 0.0f),
tick_spacing("tick_spacing", 10.0f),
decimal_digits("decimal_digits", 3),
show_per_sec("show_per_sec", true),
show_bar("show_bar", false),
show_history("show_history", false),
show_mean("show_mean", true),
scale_range("scale_range", true),
num_frames("num_frames", 200),
max_height("max_height", 100),
stat("stat"),
orientation("orientation", VERTICAL)
{
changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
}
@ -85,40 +81,39 @@ public:
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
void setStat(const std::string& stat_name);
void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing);
void setRange(F32 bar_min, F32 bar_max);
void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
/*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
F32 mMinBar;
F32 mMaxBar;
F32 mCurMaxBar;
F32 mTickSpacing;
F32 mLabelSpacing;
U32 mPrecision;
F32 mUpdatesPerSec;
F32 mUnitScale;
F32 mMinBar,
mMaxBar,
mCurMaxBar,
mCurMinBar,
mLabelSpacing;
F32 mTickValue;
U32 mDecimalDigits;
S32 mNumFrames;
S32 mMaxHeight;
bool mPerSec; // Use the per sec stats.
bool mDisplayBar; // Display the bar graph.
bool mDisplayHistory;
bool mDisplayMean; // If true, display mean, if false, display current value
bool mScaleRange;
bool mPerSec, // Use the per sec stats.
mDisplayBar, // Display the bar graph.
mDisplayHistory,
mDisplayMean, // If true, display mean, if false, display current value
mScaleMax,
mScaleMin;
EOrientation mOrientation;
LLTrace::TraceType<LLTrace::CountAccumulator>* mCountFloatp;
LLTrace::TraceType<LLTrace::EventAccumulator>* mEventFloatp;
LLTrace::TraceType<LLTrace::SampleAccumulator>* mSampleFloatp;
LLTrace::TraceType<LLTrace::CountAccumulator>* mCountFloatp;
LLTrace::TraceType<LLTrace::EventAccumulator>* mEventFloatp;
LLTrace::TraceType<LLTrace::SampleAccumulator>* mSampleFloatp;
LLFrameTimer mUpdateTimer;
LLUIString mLabel;
std::string mUnitLabel;
F32 mValue;
};
#endif

View File

@ -476,6 +476,9 @@ void LLToolTipMgr::show(const std::string& msg)
void LLToolTipMgr::show(const LLToolTip::Params& params)
{
if (!params.styled_message.isProvided()
&& (!params.message.isProvided() || params.message().empty())) return;
// fill in default tooltip params from tool_tip.xml
LLToolTip::Params params_with_defaults(params);
params_with_defaults.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLToolTip>());

View File

@ -2070,8 +2070,6 @@ bool LLAppViewer::cleanup()
ll_close_fail_log();
MEM_TRACK_RELEASE
llinfos << "Goodbye!" << llendflush;
// return 0;
@ -2099,11 +2097,7 @@ void watchdog_killer_callback()
bool LLAppViewer::initThreads()
{
#if MEM_TRACK_MEM
static const bool enable_threads = false;
#else
static const bool enable_threads = true;
#endif
LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));

View File

@ -55,7 +55,6 @@ static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
LLDebugView::LLDebugView(const LLDebugView::Params& p)
: LLView(p),
mFastTimerView(NULL),
mMemoryView(NULL),
mDebugConsolep(NULL),
mFloaterSnapRegion(NULL)
{}

View File

@ -36,7 +36,6 @@
class LLButton;
class LLStatusPanel;
class LLFastTimerView;
class LLMemoryView;
class LLConsole;
class LLTextureView;
class LLFloaterStats;
@ -61,7 +60,6 @@ public:
void setStatsVisible(BOOL visible);
LLFastTimerView* mFastTimerView;
LLMemoryView* mMemoryView;
LLConsole* mDebugConsolep;
LLView* mFloaterSnapRegion;
};

View File

@ -85,7 +85,7 @@ void LLFloaterJoystick::draw()
if (llabs(value) > maxbar)
{
F32 range = llabs(value);
mAxisStatsBar[i]->setRange(-range, range, range * 0.25f);
mAxisStatsBar[i]->setRange(-range, range);
}
}
}
@ -106,7 +106,7 @@ BOOL LLFloaterJoystick::postBuild()
if (mAxisStatsBar[i])
{
mAxisStatsBar[i]->setStat(stat_name);
mAxisStatsBar[i]->setRange(-range, range, range * 0.25f);
mAxisStatsBar[i]->setRange(-range, range);
}
}

View File

@ -784,7 +784,7 @@ void LLFloaterReporter::takeScreenshot()
image_in_list->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER);
// the texture picker then uses that texture
LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot");
LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot");
if (texture)
{
texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid);

View File

@ -227,8 +227,4 @@ private:
S32 mLabelWidth;
};
// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp
// and class to LLTexturePicker
#define LLTexturePicker LLTextureCtrl
#endif // LL_LLTEXTURECTRL_H

View File

@ -64,9 +64,9 @@
#include "bufferarray.h"
#include "bufferstream.h"
bool LLTextureFetchDebugger::sDebuggerEnabled = false ;
LLTrace::SampleStatHandle<> LLTextureFetch::sCacheHitRate("texture_cache_hits");
LLTrace::SampleStatHandle<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
bool LLTextureFetchDebugger::sDebuggerEnabled = false;
LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > LLTextureFetch::sCacheHitRate("texture_cache_hits");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
//////////////////////////////////////////////////////////////////////////////
@ -1251,7 +1251,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
LL_DEBUGS("Texture") << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize()
<< " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight())
<< " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
sample(LLTextureFetch::sCacheHitRate, 100.f);
record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1));
}
else
{
@ -1269,7 +1269,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
// fall through
sample(LLTextureFetch::sCacheHitRate, 0.f);
record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0));
}
}
@ -2762,10 +2762,10 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
discard_level = worker->mDecodedDiscard;
raw = worker->mRawImage;
aux = worker->mAuxImage;
F32 cache_read_time = worker->mCacheReadTime;
LLUnit<F32, LLUnits::Seconds> cache_read_time = worker->mCacheReadTime;
if (cache_read_time != 0.f)
{
sample(sCacheReadLatency, cache_read_time * 1000.f);
record(sCacheReadLatency, cache_read_time);
}
res = true;
LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;

View File

@ -309,8 +309,8 @@ private:
LLMutex mQueueMutex; //to protect mRequestMap and mCommands only
LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue.
static LLTrace::SampleStatHandle<> sCacheHitRate;
static LLTrace::SampleStatHandle<> sCacheReadLatency;
static LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate;
static LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > sCacheReadLatency;
LLTextureCache* mTextureCache;
LLImageDecodeThread* mImageDecodeThread;

View File

@ -475,14 +475,12 @@ void init_menus()
gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
#if !MEM_TRACK_MEM
// Don't display the Memory console menu if the feature is turned off
LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
if (memoryMenu)
{
memoryMenu->setVisible(FALSE);
}
#endif
gMenuBarView->createJumpKeys();
@ -528,12 +526,6 @@ class LLAdvancedToggleConsole : public view_listener_t
toggle_visibility( (void*)gSceneView);
}
#if MEM_TRACK_MEM
else if ("memory view" == console_type)
{
toggle_visibility( (void*)gDebugView->mMemoryView );
}
#endif
return true;
}
};
@ -559,12 +551,6 @@ class LLAdvancedCheckConsole : public view_listener_t
{
new_value = get_visibility( (void*) gSceneView);
}
#if MEM_TRACK_MEM
else if ("memory view" == console_type)
{
new_value = get_visibility( (void*)gDebugView->mMemoryView );
}
#endif
return new_value;
}

View File

@ -95,12 +95,10 @@ extern LLPipeline gPipeline;
U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID;
LLTrace::SampleStatHandle<> LLViewerObjectList::sCacheHitRate("object_cache_hits");
LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > LLViewerObjectList::sCacheHitRate("object_cache_hits");
LLViewerObjectList::LLViewerObjectList()
{
mNumVisCulled = 0;
mNumSizeCulled = 0;
mCurLazyUpdateIndex = 0;
mCurBin = 0;
mNumDeadObjects = 0;
@ -358,7 +356,7 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
}
justCreated = true;
mNumNewObjects++;
sample(sCacheHitRate, 100.f);
sample(sCacheHitRate, LLUnits::Percent::fromValue(100.f));
}
if (objectp->isDead())
@ -1091,9 +1089,6 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
fetchObjectCosts();
fetchPhysicsFlags();
mNumSizeCulled = 0;
mNumVisCulled = 0;
// update max computed render cost
LLVOVolume::updateRenderComplexity();
@ -1155,8 +1150,6 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
sample(LLStatViewer::NUM_OBJECTS, mObjects.size());
sample(LLStatViewer::NUM_ACTIVE_OBJECTS, idle_count);
sample(LLStatViewer::NUM_SIZE_CULLED, mNumSizeCulled);
sample(LLStatViewer::NUM_VIS_CULLED, mNumVisCulled);
}
void LLViewerObjectList::fetchObjectCosts()

View File

@ -170,8 +170,6 @@ public:
// Statistics data (see also LLViewerStats)
S32 mNumNewObjects;
S32 mNumSizeCulled;
S32 mNumVisCulled;
// if we paused in the last frame
// used to discount stats from this frame
@ -198,7 +196,7 @@ protected:
std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
S32 mNumOrphans;
static LLTrace::SampleStatHandle<> sCacheHitRate;
static LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate;
typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;

View File

@ -64,15 +64,14 @@
namespace LLStatViewer
{
LLTrace::CountStatHandle<> FPS("framesrendered"),
PACKETS_IN("packetsinstat"),
PACKETS_LOST("packetsloststat"),
PACKETS_OUT("packetsoutstat"),
TEXTURE_PACKETS("texturepacketsstat"),
TRIANGLES_DRAWN("trianglesdrawnstat"),
LLTrace::CountStatHandle<> FPS("FPS", "Frames rendered"),
PACKETS_IN("Packets In", "Packets received"),
PACKETS_LOST("packetsloststat", "Packets lost"),
PACKETS_OUT("packetsoutstat", "Packets sent"),
TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
CHAT_COUNT("chatcount", "Chat messages sent"),
IM_COUNT("imcount", "IMs sent"),
OBJECT_CREATE("objectcreate"),
OBJECT_CREATE("objectcreate", "Number of objects created"),
OBJECT_REZ("objectrez", "Object rez count"),
LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"),
LSL_SAVES("lslsaves", "Number of times user has saved a script"),
@ -86,34 +85,35 @@ LLTrace::CountStatHandle<> FPS("framesrendered"),
EDIT_TEXTURE("edittexture", "Changes to textures on objects"),
KILLED("killed", "Number of times killed"),
FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"),
TEX_BAKES("texbakes"),
TEX_REBAKES("texrebakes"),
NUM_NEW_OBJECTS("numnewobjectsstat");
LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibits> > KBIT("kbitstat"),
LAYERS_KBIT("layerskbitstat"),
OBJECT_KBIT("objectkbitstat"),
ASSET_KBIT("assetkbitstat"),
TEXTURE_KBIT("texturekbitstat"),
ACTUAL_IN_KBIT("actualinkbitstat"),
ACTUAL_OUT_KBIT("actualoutkbitstat");
TEX_BAKES("texbakes", "Number of times avatar textures have been baked"),
TEX_REBAKES("texrebakes", "Number of times avatar textures have been forced to rebake"),
NUM_NEW_OBJECTS("numnewobjectsstat", "Number of objects in scene that were not previously in cache");
LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN("trianglesdrawnstat");
LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibits> > KBIT("Bandwidth", "Network data received"),
LAYERS_KBIT("layerskbitstat", "Network data received for layer data (terrain)"),
OBJECT_KBIT("objectkbitstat", "Network data received for objects"),
ASSET_KBIT("assetkbitstat", "Network data received for assets (animations, sounds)"),
TEXTURE_KBIT("texturekbitstat", "Network data received for textures"),
ACTUAL_IN_KBIT("actualinkbitstat", "Incoming network data"),
ACTUAL_OUT_KBIT("actualoutkbitstat", "Outgoing network data");
LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Seconds> > SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"),
SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"),
LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%");
SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "", LL_SIM_STAT_TIME_DILATION),
SIM_FPS("simfps", "", LL_SIM_STAT_FPS),
SIM_PHYSICS_FPS("simphysicsfps", "", LL_SIM_STAT_PHYSFPS),
SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "Simulator time scale", LL_SIM_STAT_TIME_DILATION),
SIM_FPS("simfps", "Simulator framerate", LL_SIM_STAT_FPS),
SIM_PHYSICS_FPS("simphysicsfps", "Simulator physics framerate", LL_SIM_STAT_PHYSFPS),
SIM_AGENT_UPS("simagentups", "", LL_SIM_STAT_AGENTUPS),
SIM_SCRIPT_EPS("simscripteps", "", LL_SIM_STAT_SCRIPT_EPS),
SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps", "", LL_SIM_STAT_SKIPPEDAISILSTEPS_PS),
SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS),
SIM_MAIN_AGENTS("simmainagents", "", LL_SIM_STAT_NUMAGENTMAIN),
SIM_CHILD_AGENTS("simchildagents", "", LL_SIM_STAT_NUMAGENTCHILD),
SIM_MAIN_AGENTS("simmainagents", "Number of avatars in current region", LL_SIM_STAT_NUMAGENTMAIN),
SIM_CHILD_AGENTS("simchildagents", "Number of avatars in neighboring regions", LL_SIM_STAT_NUMAGENTCHILD),
SIM_OBJECTS("simobjects", "", LL_SIM_STAT_NUMTASKS),
SIM_ACTIVE_OBJECTS("simactiveobjects", "", LL_SIM_STAT_NUMTASKSACTIVE),
SIM_ACTIVE_SCRIPTS("simactivescripts", "", LL_SIM_STAT_NUMSCRIPTSACTIVE),
SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
SIM_ACTIVE_OBJECTS("simactiveobjects", "Number of scripted and/or mocing objects", LL_SIM_STAT_NUMTASKSACTIVE),
SIM_ACTIVE_SCRIPTS("simactivescripts", "Number of scripted objects", LL_SIM_STAT_NUMSCRIPTSACTIVE),
SIM_IN_PACKETS_PER_SEC("siminpps", "", LL_SIM_STAT_INPPS),
SIM_OUT_PACKETS_PER_SEC("simoutpps", "", LL_SIM_STAT_OUTPPS),
SIM_PENDING_DOWNLOADS("simpendingdownloads", "", LL_SIM_STAT_PENDING_DOWNLOADS),
@ -122,23 +122,25 @@ SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "", LL_SIM_STAT_TIME_DIL
SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS),
SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS);
SimMeasurement<LLUnit<F64, LLUnits::Percent> > SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS);
LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"),
NUM_IMAGES("numimagesstat"),
NUM_RAW_IMAGES("numrawimagesstat"),
NUM_OBJECTS("numobjectsstat"),
NUM_ACTIVE_OBJECTS("numactiveobjectsstat"),
NUM_SIZE_CULLED("numsizeculledstat"),
NUM_VIS_CULLED("numvisculledstat"),
ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"),
LIGHTING_DETAIL("lightingdetail", "Lighting Detail"),
VISIBLE_AVATARS("visibleavatars", "Visible Avatars"),
SHADER_OBJECTS("shaderobjects", "Object Shaders"),
DRAW_DISTANCE("drawdistance", "Draw Distance"),
PENDING_VFS_OPERATIONS("vfspendingoperations"),
PACKETS_LOST_PERCENT("packetslostpercentstat"),
WINDOW_WIDTH("windowwidth", "Window width"),
WINDOW_HEIGHT("windowheight", "Window height");
LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > PACKETS_LOST_PERCENT("packetslostpercentstat");
static LLTrace::SampleStatHandle<S64> CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled");
LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Megabytes> > GL_TEX_MEM("gltexmemstat"),
@ -150,38 +152,38 @@ LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Kibibytes> > DELTA_BANDWIDTH("del
SimMeasurement<LLUnit<F64, LLUnits::Milliseconds> > SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS),
SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
SimMeasurement<LLUnit<F64, LLUnits::Bytes> > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES),
SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
SimMeasurement<LLUnit<F64, LLUnits::Kilobytes> > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES);
SimMeasurement<LLUnit<F64, LLUnits::Megabytes> > SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Milliseconds> > FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"),
FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
SIM_PING("simpingstat");
FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
SIM_PING("simpingstat");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections");
LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Milliseconds> > REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"),
FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"),
TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"),
@ -189,8 +191,6 @@ LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Seconds> > AVATAR_EDIT_TIME("avata
FPS_10_TIME("fps10time", "Seconds below 10 FPS"),
FPS_8_TIME("fps8time", "Seconds below 8 FPS"),
FPS_2_TIME("fps2time", "Seconds below 2 FPS");
}
LLViewerStats::LLViewerStats()
@ -378,17 +378,7 @@ void update_statistics()
gTextureTimer.unpause();
}
{
static F32 visible_avatar_frames = 0.f;
static F32 avg_visible_avatars = 0;
F32 visible_avatars = (F32)LLVOAvatar::sNumVisibleAvatars;
if (visible_avatars > 0.f)
{
visible_avatar_frames = 1.f;
avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames;
}
sample(LLStatViewer::VISIBLE_AVATARS, (F64)avg_visible_avatars);
}
sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars);
LLWorld::getInstance()->updateNetStats();
LLWorld::getInstance()->requestCacheMisses();

View File

@ -72,7 +72,6 @@ extern LLTrace::CountStatHandle<> FPS,
PACKETS_LOST,
PACKETS_OUT,
TEXTURE_PACKETS,
TRIANGLES_DRAWN,
CHAT_COUNT,
IM_COUNT,
OBJECT_CREATE,
@ -93,6 +92,7 @@ extern LLTrace::CountStatHandle<> FPS,
TEX_REBAKES,
NUM_NEW_OBJECTS;
extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN;
extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibits> > KBIT,
LAYERS_KBIT,
@ -112,13 +112,11 @@ extern SimMeasurement<> SIM_TIME_DILATION,
SIM_AGENT_UPS,
SIM_SCRIPT_EPS,
SIM_SKIPPED_SILHOUETTE,
SIM_SKIPPED_CHARACTERS_PERCENTAGE,
SIM_MAIN_AGENTS,
SIM_CHILD_AGENTS,
SIM_OBJECTS,
SIM_ACTIVE_OBJECTS,
SIM_ACTIVE_SCRIPTS,
SIM_PERCENTAGE_SCRIPTS_RUN,
SIM_IN_PACKETS_PER_SEC,
SIM_OUT_PACKETS_PER_SEC,
SIM_PENDING_DOWNLOADS,
@ -127,23 +125,25 @@ extern SimMeasurement<> SIM_TIME_DILATION,
SIM_PHYSICS_PINNED_TASKS,
SIM_PHYSICS_LOD_TASKS;
extern SimMeasurement<LLUnit<F64, LLUnits::Percent> > SIM_PERCENTAGE_SCRIPTS_RUN,
SIM_SKIPPED_CHARACTERS_PERCENTAGE;
extern LLTrace::SampleStatHandle<> FPS_SAMPLE,
NUM_IMAGES,
NUM_RAW_IMAGES,
NUM_OBJECTS,
NUM_ACTIVE_OBJECTS,
NUM_SIZE_CULLED,
NUM_VIS_CULLED,
ENABLE_VBO,
LIGHTING_DETAIL,
VISIBLE_AVATARS,
SHADER_OBJECTS,
DRAW_DISTANCE,
PENDING_VFS_OPERATIONS,
PACKETS_LOST_PERCENT,
WINDOW_WIDTH,
WINDOW_HEIGHT;
extern LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > PACKETS_LOST_PERCENT;
extern LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Megabytes> > GL_TEX_MEM,
GL_BOUND_MEM,
RAW_MEM,
@ -165,8 +165,8 @@ extern SimMeasurement<LLUnit<F64, LLUnits::Milliseconds> > SIM_FRAME_TIME,
SIM_SLEEP_TIME,
SIM_PUMP_IO_TIME;
extern SimMeasurement<LLUnit<F64, LLUnits::Bytes> > SIM_UNACKED_BYTES,
SIM_PHYSICS_MEM;
extern SimMeasurement<LLUnit<F64, LLUnits::Kilobytes> > SIM_UNACKED_BYTES;
extern SimMeasurement<LLUnit<F64, LLUnits::Megabytes> > SIM_PHYSICS_MEM;
extern LLTrace::SampleStatHandle<LLUnit<F64, LLUnits::Milliseconds> > FRAMETIME_JITTER,

View File

@ -48,8 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f;
const F32 MIN_BANDWIDTH = 50.f;
const F32 MAX_BANDWIDTH = 3000.f;
const F32 STEP_FRACTIONAL = 0.1f;
const F32 TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s
const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s
const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s
const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s
const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds
LLViewerThrottle gViewerThrottle;
@ -304,7 +304,7 @@ void LLViewerThrottle::updateDynamicThrottle()
}
mUpdateTimer.reset();
F32 mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
{
if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)

View File

@ -711,7 +711,7 @@ void LLWorld::renderPropertyLines()
void LLWorld::updateNetStats()
{
F32 bits = 0.f;
LLUnit<F64, LLUnits::Bits> bits = 0.f;
U32 packets = 0;
for (region_list_t::iterator iter = mActiveRegionList.begin();
@ -729,19 +729,18 @@ void LLWorld::updateNetStats()
S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut;
S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost;
S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();
S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits();
LLUnit<F64, LLUnits::Bits> actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();
LLUnit<F64, LLUnits::Bits> actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits();
add(LLStatViewer::ACTUAL_IN_KBIT, LLUnit<F64, LLUnits::Bits>(actual_in_bits));
add(LLStatViewer::ACTUAL_OUT_KBIT, LLUnit<F64, LLUnits::Bits>(actual_out_bits));
add(LLStatViewer::KBIT, LLUnit<F64, LLUnits::Bits>(bits));
add(LLStatViewer::ACTUAL_IN_KBIT, actual_in_bits);
add(LLStatViewer::ACTUAL_OUT_KBIT, actual_out_bits);
add(LLStatViewer::KBIT, bits);
add(LLStatViewer::PACKETS_IN, packets_in);
add(LLStatViewer::PACKETS_OUT, packets_out);
add(LLStatViewer::PACKETS_LOST, packets_lost);
if (packets_in)
{
F32 packet_loss = 100.f * ((F32)packets_lost/(F32)packets_in);
sample(LLStatViewer::PACKETS_LOST_PERCENT, packet_loss);
sample(LLStatViewer::PACKETS_LOST_PERCENT, LLUnits::Ratio::fromValue((F32)packets_lost/(F32)packets_in));
}
mLastPacketsIn = gMessageSystem->mPacketsIn;

View File

@ -4686,7 +4686,7 @@ void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type)
}
record(sStatBatchSize, count);
add(LLStatViewer::TRIANGLES_DRAWN, count);
add(LLStatViewer::TRIANGLES_DRAWN, LLUnits::Triangles::fromValue(count));
if (LLPipeline::sRenderFrameTest)
{

File diff suppressed because it is too large Load Diff