MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FinishAll

Method FinishAll

src/newgrf_profiling.cpp:157–175  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

155}
156
157/* static */ uint32_t NewGRFProfiler::FinishAll()
158{
159 NewGRFProfiler::AbortTimer();
160
161 uint64_t max_ticks = 0;
162 uint32_t total_microseconds = 0;
163 for (NewGRFProfiler &pr : _newgrf_profilers) {
164 if (pr.active) {
165 total_microseconds += pr.Finish();
166 max_ticks = std::max(max_ticks, TimerGameTick::counter - pr.start_tick);
167 }
168 }
169
170 if (total_microseconds > 0 && max_ticks > 0) {
171 IConsolePrint(CC_DEBUG, "Total NewGRF callback processing: {} microseconds over {} ticks.", total_microseconds, max_ticks);
172 }
173
174 return total_microseconds;
175}
176
177/**
178 * Check whether profiling is active and should be finished.

Callers

nothing calls this directly

Calls 2

IConsolePrintFunction · 0.70
FinishMethod · 0.45

Tested by

no test coverage detected