summaryrefslogtreecommitdiff
path: root/indra/newview/llfasttimerview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfasttimerview.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llfasttimerview.cpp57
1 files changed, 25 insertions, 32 deletions
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 9664aa7dbe..06119620de 100644..100755
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -95,7 +95,6 @@ LLFastTimerView::LLFastTimerView(const LLSD& key)
mHoverBarIndex = -1;
FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount();
mPrintStats = -1;
- mAverageCyclesPerTimer = 0;
}
void LLFastTimerView::onPause()
@@ -161,7 +160,7 @@ LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y)
BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it)
{
@@ -258,7 +257,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
}
S32 i = 0;
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it, ++i)
{
@@ -346,7 +345,7 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
return TRUE;
}
-static LLFastTimer::DeclareTimer FTM_RENDER_TIMER("Timers", true);
+static LLFastTimer::DeclareTimer FTM_RENDER_TIMER("Timers");
static std::map<LLFastTimer::NamedTimer*, LLColor4> sTimerColors;
@@ -369,7 +368,7 @@ void LLFastTimerView::draw()
S32 left, top, right, bottom;
S32 x, y, barw, barh, dx, dy;
- S32 texth, textw;
+ S32 texth;
LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("Rounded_Square");
// Draw the window background
@@ -379,12 +378,6 @@ void LLFastTimerView::draw()
S32 xleft = margin;
S32 ytop = margin;
- mAverageCyclesPerTimer = LLFastTimer::sTimerCalls == 0
- ? 0
- : llround(lerp((F32)mAverageCyclesPerTimer, (F32)(LLFastTimer::sTimerCycles / (U64)LLFastTimer::sTimerCalls), 0.1f));
- LLFastTimer::sTimerCycles = 0;
- LLFastTimer::sTimerCalls = 0;
-
// Draw some help
{
@@ -392,10 +385,6 @@ void LLFastTimerView::draw()
y = height - ytop;
texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
-#if TIME_FAST_TIMERS
- tdesc = llformat("Cycles per timer call: %d", mAverageCyclesPerTimer);
- LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-#else
char modedesc[][32] = {
"2 x Average ",
"Max ",
@@ -410,7 +399,6 @@ void LLFastTimerView::draw()
tdesc = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]);
LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
- textw = LLFontGL::getFontMonospace()->getWidth(tdesc);
x = xleft, y -= (texth + 2);
tdesc = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]);
@@ -419,7 +407,6 @@ void LLFastTimerView::draw()
LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"),
0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-#endif
y -= (texth + 2);
}
@@ -431,11 +418,11 @@ void LLFastTimerView::draw()
y -= (texth + 2);
- sTimerColors[&LLFastTimer::NamedTimer::getRootNamedTimer()] = LLColor4::grey;
+ sTimerColors[&getFrameTimer()] = LLColor4::grey;
F32 hue = 0.f;
- for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for (timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != timer_tree_iterator_t();
++it)
{
@@ -460,7 +447,7 @@ void LLFastTimerView::draw()
S32 cur_line = 0;
ft_display_idx.clear();
std::map<LLFastTimer::NamedTimer*, S32> display_line;
- for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for (timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != timer_tree_iterator_t();
++it)
{
@@ -526,6 +513,7 @@ void LLFastTimerView::draw()
while(!is_child_of_hover_item && next_parent)
{
is_child_of_hover_item = (mHoverID == next_parent);
+ if (next_parent->getParent() == next_parent) break;
next_parent = next_parent->getParent();
}
@@ -537,8 +525,6 @@ void LLFastTimerView::draw()
y -= (texth + 2);
- textw = dx + LLFontGL::getFontMonospace()->getWidth(idp->getName()) + 40;
-
if (idp->getCollapsed())
{
it.skipDescendants();
@@ -570,7 +556,7 @@ void LLFastTimerView::draw()
U64 totalticks;
if (!LLFastTimer::sPauseHistory)
{
- U64 ticks = LLFastTimer::NamedTimer::getRootNamedTimer().getHistoricalCount(mScrollIndex);
+ U64 ticks = getFrameTimer().getHistoricalCount(mScrollIndex);
if (LLFastTimer::getCurFrameIndex() >= 10)
{
@@ -610,7 +596,7 @@ void LLFastTimerView::draw()
totalticks = 0;
for (S32 j=0; j<histmax; j++)
{
- U64 ticks = LLFastTimer::NamedTimer::getRootNamedTimer().getHistoricalCount(j);
+ U64 ticks = getFrameTimer().getHistoricalCount(j);
if (ticks > totalticks)
totalticks = ticks;
@@ -716,7 +702,7 @@ void LLFastTimerView::draw()
LLFastTimer::NamedTimer* prev_id = NULL;
S32 i = 0;
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it, ++i)
{
@@ -793,6 +779,7 @@ void LLFastTimerView::draw()
while(!is_child_of_hover_item && next_parent)
{
is_child_of_hover_item = (mHoverID == next_parent);
+ if (next_parent->getParent() == next_parent) break;
next_parent = next_parent->getParent();
}
@@ -879,7 +866,7 @@ void LLFastTimerView::draw()
}
U64 cur_max = 0;
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it)
{
@@ -980,7 +967,7 @@ void LLFastTimerView::draw()
{
std::string legend_stat;
bool first = true;
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it)
{
@@ -1002,7 +989,7 @@ void LLFastTimerView::draw()
std::string timer_stat;
first = true;
- for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer());
+ for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());
it != end_timer_tree();
++it)
{
@@ -1083,7 +1070,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
{ //read base log into memory
S32 i = 0;
std::ifstream is(base.c_str());
- while (!is.eof() && LLSDSerialize::fromXML(cur, is))
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
{
base_data[i++] = cur;
}
@@ -1096,7 +1083,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
{ //read current log into memory
S32 i = 0;
std::ifstream is(target.c_str());
- while (!is.eof() && LLSDSerialize::fromXML(cur, is))
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
{
cur_data[i++] = cur;
@@ -1387,7 +1374,7 @@ LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is)
stats_map_t time_stats;
stats_map_t sample_stats;
- while (!is.eof() && LLSDSerialize::fromXML(cur, is))
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
{
for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
{
@@ -1558,8 +1545,14 @@ void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::
return ;
}
}
-void LLFastTimerView::onClickCloseBtn()
+void LLFastTimerView::onClickCloseBtn(bool)
{
setVisible(false);
}
+LLFastTimer::NamedTimer& LLFastTimerView::getFrameTimer()
+{
+ return FTM_FRAME.getNamedTimer();
+}
+
+