OpenTTD
|
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. More... | |
~PerformanceMeasurer () | |
Finish a cycle of a measured element and store the measurement taken. More... | |
void | SetExpectedRate (double rate) |
Set the rate of expected cycles per second of a performance element. More... | |
Static Public Member Functions | |
static void | Paused (PerformanceElement elem) |
Indicate that a cycle of "pause" where no processing occurs. More... | |
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 77 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 207 of file framerate_gui.cpp.
PerformanceMeasurer::~PerformanceMeasurer | ( | ) |
Finish a cycle of a measured element and store the measurement taken.
Definition at line 216 of file framerate_gui.cpp.
References anonymous_namespace{framerate_gui.cpp}::_pf_data, anonymous_namespace{framerate_gui.cpp}::PerformanceData::Add(), and GetPerformanceTimer().
|
static |
Indicate that a cycle of "pause" where no processing occurs.
elem | The element not currently being processed |
Definition at line 231 of file framerate_gui.cpp.
References anonymous_namespace{framerate_gui.cpp}::_pf_data, anonymous_namespace{framerate_gui.cpp}::PerformanceData::AddPause(), and GetPerformanceTimer().
Referenced by StateGameLoop().
void PerformanceMeasurer::SetExpectedRate | ( | double | rate | ) |
Set the rate of expected cycles per second of a performance element.
Definition at line 222 of file framerate_gui.cpp.
References anonymous_namespace{framerate_gui.cpp}::_pf_data, and anonymous_namespace{framerate_gui.cpp}::PerformanceData::expected_rate.