|
OpenTTD Source 20260711-master-g3fb3006dff
|
RAII class for measuring simple elements of performance. More...
#include <framerate_type.h>
Public Member Functions | |
| PerformanceMeasurer (PerformanceElement elem) | |
| Begin a cycle of a measured element. | |
| ~PerformanceMeasurer () | |
| Finish a cycle of a measured element and store the measurement taken. | |
| void | SetExpectedRate (double rate) |
| Set the rate of expected cycles per second of a performance element. | |
Static Public Member Functions | |
| 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. | |
Private Attributes | |
| PerformanceElement | elem |
| TimingMeasurement | start_time |
RAII class for measuring simple elements of performance.
Construct an object with the appropriate element parameter when processing begins, time is automatically taken when the object goes out of scope again.
Call Paused at the start of a frame if the processing of this element is paused.
Definition at line 90 of file framerate_type.h.
| PerformanceMeasurer::PerformanceMeasurer | ( | PerformanceElement | elem | ) |
Begin a cycle of a measured element.
| elem | The element to be measured |
Definition at line 269 of file framerate_gui.cpp.
References End, and GetPerformanceTimer().
| PerformanceMeasurer::~PerformanceMeasurer | ( | ) |
Finish a cycle of a measured element and store the measurement taken.
Definition at line 278 of file framerate_gui.cpp.
References AI0, AllScripts, End, GameScript, GetPerformanceTimer(), SetInactive(), and Sound.
|
static |
Indicate that a cycle of "pause" where no processing occurs.
| elem | The element not currently being processed |
Definition at line 330 of file framerate_gui.cpp.
References GetPerformanceTimer(), and SetInactive().
Referenced by StateGameLoop().
| void PerformanceMeasurer::SetExpectedRate | ( | double | rate | ) |
Set the rate of expected cycles per second of a performance element.
| rate | The new rate. |
Definition at line 310 of file framerate_gui.cpp.
|
static |
Mark a performance element as not currently in use.
| elem | The element to set as unused. |
Definition at line 319 of file framerate_gui.cpp.
Referenced by AI::GameLoop(), Game::GameLoop(), OnTick_LinkGraph(), Paused(), AI::Stop(), and ~PerformanceMeasurer().
|
private |
Definition at line 91 of file framerate_type.h.
|
private |
Definition at line 92 of file framerate_type.h.