summaryrefslogtreecommitdiff
path: root/indra/newview/llfasttimerview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfasttimerview.cpp')
-rw-r--r--indra/newview/llfasttimerview.cpp78
1 files changed, 40 insertions, 38 deletions
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 843bdfa42d..67d55c53e4 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -59,15 +59,15 @@
using namespace LLTrace;
-static const S32 MAX_VISIBLE_HISTORY = 12;
-static const S32 LINE_GRAPH_HEIGHT = 240;
-static const S32 MIN_BAR_HEIGHT = 3;
-static const S32 RUNNING_AVERAGE_WIDTH = 100;
-static const S32 NUM_FRAMES_HISTORY = 200;
+static constexpr S32 MAX_VISIBLE_HISTORY = 12;
+static constexpr S32 LINE_GRAPH_HEIGHT = 240;
+static constexpr S32 MIN_BAR_HEIGHT = 3;
+static constexpr S32 RUNNING_AVERAGE_WIDTH = 100;
+static constexpr S32 NUM_FRAMES_HISTORY = 200;
std::vector<BlockTimerStatHandle*> ft_display_idx; // line of table entry for display purposes (for collapse)
-BOOL LLFastTimerView::sAnalyzePerformance = FALSE;
+bool LLFastTimerView::sAnalyzePerformance = false;
S32 get_depth(const BlockTimerStatHandle* blockp)
{
@@ -126,16 +126,16 @@ void LLFastTimerView::setPauseState(bool pause_state)
mPauseHistory = pause_state;
}
-BOOL LLFastTimerView::postBuild()
+bool LLFastTimerView::postBuild()
{
LLButton& pause_btn = getChildRef<LLButton>("pause_btn");
mScrollBar = getChild<LLScrollbar>("scroll_vert");
pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this));
- return TRUE;
+ return true;
}
-BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
if (mHoverTimer )
{
@@ -148,14 +148,14 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
mHoverTimer->getParent()->getTreeNode().mCollapsed = true;
}
- return TRUE;
+ return true;
}
else if (mBarRect.pointInRect(x, y))
{
S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight());
bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY);
mStatsIndex = mScrollIndex + bar_idx;
- return TRUE;
+ return true;
}
return LLFloater::handleRightMouseDown(x, y, mask);
}
@@ -172,7 +172,7 @@ BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y)
return NULL;
}
-BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
{
for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
it != LLTrace::end_block_timer_tree_df();
@@ -180,10 +180,10 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
{
(*it)->getTreeNode().mCollapsed = false;
}
- return TRUE;
+ return true;
}
-BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (x < mScrollBar->getRect().mLeft)
{
@@ -201,13 +201,13 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
else if (mGraphRect.pointInRect(x, y))
{
gFocusMgr.setMouseCapture(this);
- return TRUE;
+ return true;
}
return LLFloater::handleMouseDown(x, y, mask);
}
-BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask)
{
if (hasMouseCapture())
{
@@ -216,14 +216,14 @@ BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask)
return LLFloater::handleMouseUp(x, y, mask);;
}
-BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
{
if (hasMouseCapture())
{
F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f);
mScrollIndex = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods());
- return TRUE;
+ return true;
}
mHoverTimer = NULL;
mHoverID = NULL;
@@ -238,7 +238,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
MAX_VISIBLE_HISTORY);
if (mHoverBarIndex == 0)
{
- return TRUE;
+ return true;
}
else if (mHoverBarIndex < 0)
{
@@ -249,7 +249,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
TimerBar* hover_bar = NULL;
F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay;
- for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
+ for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
bar_index < end_index;
++bar_index)
{
@@ -314,7 +314,7 @@ static std::string get_tooltip(BlockTimerStatHandle& timer, S32 history_index, P
return tooltip;
}
-BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
+bool LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
{
if(mPauseHistory && mBarRect.pointInRect(x, y))
{
@@ -331,7 +331,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
.sticky_rect(screen_rect)
.delay_time(0.f));
- return TRUE;
+ return true;
}
}
else
@@ -344,7 +344,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
{
LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording));
- return TRUE;
+ return true;
}
}
}
@@ -352,7 +352,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
return LLFloater::handleToolTip(x, y, mask);
}
-BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
+bool LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (x < mBarRect.mLeft)
{
@@ -366,7 +366,7 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
0,
llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
}
- return TRUE;
+ return true;
}
static BlockTimerStatHandle FTM_RENDER_TIMER("Timers");
@@ -440,7 +440,7 @@ void LLFastTimerView::onOpen(const LLSD& key)
void LLFastTimerView::onClose(bool app_quitting)
{
- setVisible(FALSE);
+ setVisible(false);
}
void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch)
@@ -448,6 +448,8 @@ void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
if (!LLRender::sNsightDebugSupport)
{
+ LLImageDataSharedLock lock(scratch);
+
//read result back into raw image
glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData());
@@ -704,7 +706,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
gGL.color3fv(base_col.mV);
U32 count = 0;
- U32 total_count = base_execution.size();
+ U32 total_count = static_cast<U32>(base_execution.size());
last_p.clear();
@@ -726,7 +728,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
LLGLEnable blend(GL_BLEND);
gGL.color3fv(cur_col.mV);
count = 0;
- total_count = cur_execution.size();
+ total_count = static_cast<U32>(cur_execution.size());
for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter)
{
@@ -1018,7 +1020,7 @@ void LLFastTimerView::drawLineGraph()
//highlight visible range
{
- S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex;
+ S32 first_frame = static_cast<S32>(mRecording.getNumRecordedPeriods()) - mScrollIndex;
S32 last_frame = first_frame - MAX_VISIBLE_HISTORY;
F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1);
@@ -1081,7 +1083,7 @@ void LLFastTimerView::drawLineGraph()
F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value();
F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value());
- for (U32 j = mRecording.getNumRecordedPeriods();
+ for (U32 j = static_cast<U32>(mRecording.getNumRecordedPeriods());
j > 0;
j--)
{
@@ -1274,7 +1276,7 @@ void LLFastTimerView::drawLegend()
}
x += dx;
- BOOL is_child_of_hover_item = (idp == mHoverID);
+ bool is_child_of_hover_item = (idp == mHoverID);
BlockTimerStatHandle* next_parent = idp->getParent();
while(!is_child_of_hover_item && next_parent)
{
@@ -1383,31 +1385,31 @@ void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32
S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight();
//heading
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, FALSE);
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, false);
//tree view
- gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, FALSE);
+ gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, false);
by = y + 5;
//average bar
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, FALSE);
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, false);
by -= bar_height*2+dy;
//current frame bar
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, FALSE);
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, false);
by -= bar_height+dy+1;
//history bars
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, FALSE);
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, false);
by = LINE_GRAPH_HEIGHT-dy;
//line graph
//mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5);
- gl_rect_2d(mGraphRect, FALSE);
+ gl_rect_2d(mGraphRect, false);
}
}
@@ -1649,7 +1651,7 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width,
bool children_visible = visible && !time_block->getTreeNode().mCollapsed;
bar_index++;
- const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
+ const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
if (bar_index < num_bars && row.mBars[bar_index].mFirstChild)
{
bool is_last = false;