mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-12 10:52:32 +02:00
decouple 'general timing' from 'game loop' details
This commit is contained in:
parent
8d2153d2f3
commit
c3167444a9
2 changed files with 22 additions and 14 deletions
|
@ -117,10 +117,9 @@ void Stats::updateStats(bool force) {
|
|||
}
|
||||
}
|
||||
|
||||
bool shouldDisplayTimingDetail = Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::Stats) && isExpanded();
|
||||
if (shouldDisplayTimingDetail != PerformanceTimer::isActive()) {
|
||||
PerformanceTimer::setActive(shouldDisplayTimingDetail);
|
||||
bool performanceTimerShouldBeActive = Menu::getInstance()->isOptionChecked(MenuOption::Stats) && _expanded;
|
||||
if (performanceTimerShouldBeActive != PerformanceTimer::isActive()) {
|
||||
PerformanceTimer::setActive(performanceTimerShouldBeActive);
|
||||
}
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
@ -406,10 +405,11 @@ void Stats::updateStats(bool force) {
|
|||
}
|
||||
|
||||
bool performanceTimerIsActive = PerformanceTimer::isActive();
|
||||
bool displayPerf = _expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails);
|
||||
if (displayPerf && performanceTimerIsActive) {
|
||||
if (!_timingExpanded) {
|
||||
_timingExpanded = true;
|
||||
|
||||
if (performanceTimerShouldBeActive &&
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
|
||||
if (!_showTimingDetails) {
|
||||
_showTimingDetails = true;
|
||||
emit timingExpandedChanged();
|
||||
}
|
||||
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
|
||||
|
@ -452,8 +452,15 @@ void Stats::updateStats(bool force) {
|
|||
}
|
||||
_timingStats = perfLines;
|
||||
emit timingStatsChanged();
|
||||
} else if (_showTimingDetails) {
|
||||
_showTimingDetails = false;
|
||||
emit timingExpandedChanged();
|
||||
}
|
||||
|
||||
// build _gameUpdateStats
|
||||
if (_expanded && performanceTimerIsActive) {
|
||||
if (!_showGameUpdateStats) {
|
||||
_showGameUpdateStats = true;
|
||||
}
|
||||
class SortableStat {
|
||||
public:
|
||||
SortableStat(QString a, float p) : message(a), priority(p) {}
|
||||
|
@ -462,6 +469,7 @@ void Stats::updateStats(bool force) {
|
|||
bool operator<(const SortableStat& other) const { return priority < other.priority; }
|
||||
};
|
||||
|
||||
const QMap<QString, PerformanceTimerRecord>& allRecords = PerformanceTimer::getAllTimerRecords();
|
||||
std::priority_queue<SortableStat> idleUpdateStats;
|
||||
auto itr = allRecords.find("/idle/update");
|
||||
if (itr != allRecords.end()) {
|
||||
|
@ -488,9 +496,8 @@ void Stats::updateStats(bool force) {
|
|||
_gameUpdateStats = "";
|
||||
emit gameUpdateStatsChanged();
|
||||
}
|
||||
} else if (_timingExpanded) {
|
||||
_timingExpanded = false;
|
||||
emit timingExpandedChanged();
|
||||
} else if (_showGameUpdateStats) {
|
||||
_showGameUpdateStats = false;
|
||||
_gameUpdateStats = "";
|
||||
emit gameUpdateStatsChanged();
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public:
|
|||
void updateStats(bool force = false);
|
||||
|
||||
bool isExpanded() { return _expanded; }
|
||||
bool isTimingExpanded() { return _timingExpanded; }
|
||||
bool isTimingExpanded() { return _showTimingDetails; }
|
||||
|
||||
void setExpanded(bool expanded) {
|
||||
if (_expanded != expanded) {
|
||||
|
@ -264,7 +264,8 @@ private:
|
|||
int _recentMaxPackets{ 0 } ; // recent max incoming voxel packets to process
|
||||
bool _resetRecentMaxPacketsSoon{ true };
|
||||
bool _expanded{ false };
|
||||
bool _timingExpanded{ false };
|
||||
bool _showTimingDetails{ false };
|
||||
bool _showGameUpdateStats{ false };
|
||||
QString _monospaceFont;
|
||||
const AudioIOStats* _audioStats;
|
||||
QStringList _downloadUrls = QStringList();
|
||||
|
|
Loading…
Reference in a new issue