diff options
Diffstat (limited to 'indra/newview/llfasttimerview.cpp')
-rw-r--r-- | indra/newview/llfasttimerview.cpp | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index a7998f6e9e..77021df6c1 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) { @@ -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()); @@ -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); } } |