OpenTTD Source  20240919-master-gdf0233f4c2
anonymous_namespace{framerate_gui.cpp}::PerformanceData Struct Reference

Public Member Functions

 PerformanceData (double expected_rate)
 Initialize a data element with an expected collection rate. More...
 
void Add (TimingMeasurement start_time, TimingMeasurement end_time)
 Collect a complete measurement, given start and ending times for a processing block.
 
void BeginAccumulate (TimingMeasurement start_time)
 Begin an accumulation of multiple measurements into a single value, from a given start time.
 
void AddAccumulate (TimingMeasurement duration)
 Accumulate a period onto the current measurement.
 
void AddPause (TimingMeasurement start_time)
 Indicate a pause/expected discontinuity in processing the element.
 
double GetAverageDurationMilliseconds (int count)
 Get average cycle processing time over a number of data points.
 
double GetRate ()
 Get current rate of a performance element, based on approximately the past one second of data.
 

Data Fields

TimingMeasurement durations [NUM_FRAMERATE_POINTS]
 Time spent processing each cycle of the performance element, circular buffer.
 
TimingMeasurement timestamps [NUM_FRAMERATE_POINTS]
 Start time of each cycle of the performance element, circular buffer.
 
double expected_rate
 Expected number of cycles per second when the system is running without slowdowns.
 
int next_index
 Next index to write to in durations and timestamps.
 
int prev_index
 Last index written to in durations and timestamps.
 
int num_valid
 Number of data points recorded, clamped to NUM_FRAMERATE_POINTS.
 
TimingMeasurement acc_duration
 Current accumulated duration.
 
TimingMeasurement acc_timestamp
 Start time for current accumulation cycle.
 

Static Public Attributes

static const TimingMeasurement INVALID_DURATION = UINT64_MAX
 Duration value indicating the value is not valid should be considered a gap in measurements.
 

Detailed Description

Definition at line 49 of file framerate_gui.cpp.

Constructor & Destructor Documentation

◆ PerformanceData()

anonymous_namespace{framerate_gui.cpp}::PerformanceData::PerformanceData ( double  expected_rate)
inlineexplicit

Initialize a data element with an expected collection rate.

Parameters
expected_rateExpected number of cycles per second of the performance element. Use 1 if unknown or not relevant. The rate is used for highlighting slow-running elements in the GUI.

Definition at line 77 of file framerate_gui.cpp.


The documentation for this struct was generated from the following file: