summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-07-19 21:17:07 +0200
committerPatric Stout <truebrain@openttd.org>2018-07-19 21:17:07 +0200
commit2a868b9f3b8e3b5f8b9e5f728f628ec88fd5e3ad (patch)
tree36da708e128fc68d9ceac32362503df43af2fc22 /src/openttd.cpp
parenta3d1950b656787b76fbccec1aedd63407c34c2f1 (diff)
downloadopenttd-2a868b9f3b8e3b5f8b9e5f728f628ec88fd5e3ad.tar.xz
Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 43c6b1170..510f00427 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -63,6 +63,7 @@
#include "subsidy_func.h"
#include "gfx_layout.h"
#include "viewport_sprite_sorter.h"
+#include "framerate_type.h"
#include "linkgraph/linkgraphschedule.h"
@@ -1336,6 +1337,14 @@ void StateGameLoop()
{
/* don't execute the state loop during pause */
if (_pause_mode != PM_UNPAUSED) {
+ PerformanceMeasurer::Paused(PFE_GAMELOOP);
+ PerformanceMeasurer::Paused(PFE_GL_ECONOMY);
+ PerformanceMeasurer::Paused(PFE_GL_TRAINS);
+ PerformanceMeasurer::Paused(PFE_GL_ROADVEHS);
+ PerformanceMeasurer::Paused(PFE_GL_SHIPS);
+ PerformanceMeasurer::Paused(PFE_GL_AIRCRAFT);
+ PerformanceMeasurer::Paused(PFE_GL_LANDSCAPE);
+
UpdateLandscapingLimits();
#ifndef DEBUG_DUMP_COMMANDS
Game::GameLoop();
@@ -1343,6 +1352,9 @@ void StateGameLoop()
CallWindowTickEvent();
return;
}
+
+ PerformanceMeasurer framerate(PFE_GAMELOOP);
+ PerformanceAccumulator::Reset(PFE_GL_LANDSCAPE);
if (HasModalProgress()) return;
Layouter::ReduceLineCache();