tally PerformanceTimer records when it is active

This commit is contained in:
Andrew Meadows 2017-10-02 20:57:20 -07:00
parent c3167444a9
commit 21cd986645

View file

@ -117,11 +117,6 @@ void Stats::updateStats(bool force) {
} }
} }
bool performanceTimerShouldBeActive = Menu::getInstance()->isOptionChecked(MenuOption::Stats) && _expanded;
if (performanceTimerShouldBeActive != PerformanceTimer::isActive()) {
PerformanceTimer::setActive(performanceTimerShouldBeActive);
}
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
auto avatarManager = DependencyManager::get<AvatarManager>(); auto avatarManager = DependencyManager::get<AvatarManager>();
// we need to take one avatar out so we don't include ourselves // we need to take one avatar out so we don't include ourselves
@ -404,7 +399,14 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(lodStatus, "You can see " + DependencyManager::get<LODManager>()->getLODFeedbackText()); STAT_UPDATE(lodStatus, "You can see " + DependencyManager::get<LODManager>()->getLODFeedbackText());
} }
bool performanceTimerIsActive = PerformanceTimer::isActive();
bool performanceTimerShouldBeActive = Menu::getInstance()->isOptionChecked(MenuOption::Stats) && _expanded;
if (performanceTimerShouldBeActive != PerformanceTimer::isActive()) {
PerformanceTimer::setActive(performanceTimerShouldBeActive);
}
if (performanceTimerShouldBeActive) {
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
}
if (performanceTimerShouldBeActive && if (performanceTimerShouldBeActive &&
Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) { Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
@ -412,7 +414,6 @@ void Stats::updateStats(bool force) {
_showTimingDetails = true; _showTimingDetails = true;
emit timingExpandedChanged(); emit timingExpandedChanged();
} }
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
// we will also include room for 1 line per timing record and a header of 4 lines // we will also include room for 1 line per timing record and a header of 4 lines
// Timing details... // Timing details...
@ -457,7 +458,7 @@ void Stats::updateStats(bool force) {
emit timingExpandedChanged(); emit timingExpandedChanged();
} }
if (_expanded && performanceTimerIsActive) { if (_expanded && performanceTimerShouldBeActive) {
if (!_showGameUpdateStats) { if (!_showGameUpdateStats) {
_showGameUpdateStats = true; _showGameUpdateStats = true;
} }