OpenTTD Source 20241224-master-gee860a5c8e
|
RAII class for measuring multi-step elements of performance. More...
#include <framerate_type.h>
Public Member Functions | |
PerformanceAccumulator (PerformanceElement elem) | |
Begin measuring one block of the accumulating value. | |
~PerformanceAccumulator () | |
Finish and add one block of the accumulating value. | |
Static Public Member Functions | |
static void | Reset (PerformanceElement elem) |
Store the previous accumulator value and reset for a new cycle of accumulating measurements. | |
Private Attributes | |
PerformanceElement | elem |
TimingMeasurement | start_time |
RAII class for measuring multi-step elements of performance.
At the beginning of a frame, call Reset on the element, then construct an object in the scope where each processing cycle happens. The measurements are summed between resets.
Usually StateGameLoop is an appropriate function to place Reset calls in, but for elements with more isolated scopes it can also be appropriate to Reset somewhere else. An example is the CallVehicleTicks function where all the vehicle type elements are reset.
The PerformanceMeasurer::Paused function can also be used with elements otherwise measured with this class.
Definition at line 114 of file framerate_type.h.
PerformanceAccumulator::PerformanceAccumulator | ( | PerformanceElement | elem | ) |
Begin measuring one block of the accumulating value.
elem | The element to be measured |
Definition at line 309 of file framerate_gui.cpp.
References GetPerformanceTimer(), and PFE_MAX.
PerformanceAccumulator::~PerformanceAccumulator | ( | ) |
Finish and add one block of the accumulating value.
Definition at line 318 of file framerate_gui.cpp.
References anonymous_namespace{framerate_gui.cpp}::PerformanceData::AddAccumulate(), and GetPerformanceTimer().
|
static |
Store the previous accumulator value and reset for a new cycle of accumulating measurements.
elem | The element to begin a new measurement cycle of |
Definition at line 328 of file framerate_gui.cpp.
References anonymous_namespace{framerate_gui.cpp}::PerformanceData::BeginAccumulate(), and GetPerformanceTimer().
Referenced by StateGameLoop(), and UpdateWindows().
|
private |
Definition at line 115 of file framerate_type.h.
|
private |
Definition at line 116 of file framerate_type.h.