OpenTTD Source 20260711-master-g3fb3006dff
framerate_type.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
34
35#ifndef FRAMERATE_TYPE_H
36#define FRAMERATE_TYPE_H
37
38#include "core/enum_type.hpp"
39
79
80
81typedef uint64_t TimingMeasurement;
82
92 TimingMeasurement start_time;
93public:
96 void SetExpectedRate(double rate);
97 static void SetInactive(PerformanceElement elem);
98 static void Paused(PerformanceElement elem);
99};
100
114 TimingMeasurement start_time;
115public:
118 static void Reset(PerformanceElement elem);
119};
120
123
124#endif /* FRAMERATE_TYPE_H */
~PerformanceAccumulator()
Finish and add one block of the accumulating value.
static void Reset(PerformanceElement elem)
Store the previous accumulator value and reset for a new cycle of accumulating measurements.
PerformanceAccumulator(PerformanceElement elem)
Begin measuring one block of the accumulating value.
static void SetInactive(PerformanceElement elem)
Mark a performance element as not currently in use.
static void Paused(PerformanceElement elem)
Indicate that a cycle of "pause" where no processing occurs.
void SetExpectedRate(double rate)
Set the rate of expected cycles per second of a performance element.
PerformanceMeasurer(PerformanceElement elem)
Begin a cycle of a measured element.
Type (helpers) for enums.
#define DECLARE_ENUM_AS_SEQUENTIAL(enum_type)
For some enums it is useful to add/sub more than 1.
void ShowFramerateWindow()
Open the general framerate window.
void ProcessPendingPerformanceMeasurements()
This drains the PerformanceElement::Sound measurement data queue into _pf_data.
PerformanceElement
Elements of game performance that can be measured.
@ AI7
AI execution for player slot 8.
@ GameLoopLandscape
Time spent processing other world features.
@ AI0
AI execution for player slot 1.
@ Video
Speed of painting drawn video buffer.
@ GameLoopRoadVehicles
Time spend processing road vehicles.
@ GameLoopShips
Time spent processing ships.
@ AI9
AI execution for player slot 10.
@ Drawing
Speed of drawing world and GUI.
@ AllScripts
Sum of all GS/AI scripts.
@ GameLoopAircraft
Time spent processing aircraft.
@ End
End of enum, must be last.
@ AI11
AI execution for player slot 12.
@ GameScript
Game script execution.
@ AI4
AI execution for player slot 5.
@ GameLoopTrains
Time spent processing trains.
@ Sound
Speed of mixing audio samples.
@ AI10
AI execution for player slot 11.
@ AI12
AI execution for player slot 13.
@ GameLoopEconomy
Time spent processing cargo movement.
@ AI3
AI execution for player slot 4.
@ ViewportDrawing
Time spent drawing world viewports in GUI.
@ AI13
AI execution for player slot 14.
@ AI5
AI execution for player slot 6.
@ AI14
AI execution for player slot 15.
@ GameLoopLinkGraph
Time spent waiting for link graph background jobs.
@ AI8
AI execution for player slot 9.
@ AI2
AI execution for player slot 3.
@ AI6
AI execution for player slot 7.
@ AI1
AI execution for player slot 2.
uint64_t TimingMeasurement
Type used to hold a performance timing measurement.