MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ProcessPendingPerformanceMeasurements

Function ProcessPendingPerformanceMeasurements

src/framerate_gui.cpp:1067–1077  ·  view source on GitHub ↗

* This drains the PFE_SOUND measurement data queue into _pf_data. * PFE_SOUND measurements are made by the mixer thread and so cannot be stored * into _pf_data directly, because this would not be thread safe and would violate * the invariants of the FPS and frame graph windows. * @see PerformanceMeasurement::~PerformanceMeasurement() */

Source from the content-addressed store, hash-verified

1065 * @see PerformanceMeasurement::~PerformanceMeasurement()
1066 */
1067void ProcessPendingPerformanceMeasurements()
1068{
1069 if (_sound_perf_pending.load(std::memory_order_acquire)) {
1070 std::lock_guard lk(_sound_perf_lock);
1071 for (size_t i = 0; i < _sound_perf_measurements.size(); i += 2) {
1072 _pf_data[PFE_SOUND].Add(_sound_perf_measurements[i], _sound_perf_measurements[i + 1]);
1073 }
1074 _sound_perf_measurements.clear();
1075 _sound_perf_pending.store(false, std::memory_order_relaxed);
1076 }
1077}

Callers 1

UpdateWindowsFunction · 0.85

Calls 3

sizeMethod · 0.45
AddMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected