summaryrefslogtreecommitdiff
path: root/src/date.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2020-01-26 13:45:51 +0100
committerGitHub <noreply@github.com>2020-01-26 13:45:51 +0100
commitc8779fb311c2665d3fc45c18b2f3460cd998d179 (patch)
tree15321da1e265a40fce50700182b218a87494d24a /src/date.cpp
parentf88ac83408bff58022699b4d9488818d509ef974 (diff)
downloadopenttd-c8779fb311c2665d3fc45c18b2f3460cd998d179.tar.xz
Feature: NewGRF callback profiling (#7868)
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
Diffstat (limited to 'src/date.cpp')
-rw-r--r--src/date.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/date.cpp b/src/date.cpp
index be0a7782d..97758a3eb 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -18,6 +18,7 @@
#include "rail_gui.h"
#include "linkgraph/linkgraph.h"
#include "saveload/saveload.h"
+#include "newgrf_profiling.h"
#include "safeguards.h"
@@ -245,6 +246,10 @@ static void OnNewMonth()
*/
static void OnNewDay()
{
+ if (!_newgrf_profilers.empty() && _newgrf_profile_end_date <= _date) {
+ NewGRFProfiler::FinishAll();
+ }
+
if (_network_server) NetworkServerDailyLoop();
DisasterDailyLoop();