fpsmetrics: refactor FPS calculation in metrics

Co-authored-by: Etaash Mathamsetty <etaash.mathamsetty@gmail.com>
This commit is contained in:
flightlessmango 2024-09-04 17:08:02 +02:00
parent a6422bc6ff
commit d102604291

View File

@ -58,9 +58,9 @@ class fpsMetrics {
if (!fps_stats.empty()) {
float sum = std::accumulate(fps_stats.begin(), fps_stats.end(), 0.0f,
[](float acc, const std::pair<uint64_t, float>& p) {
return acc + p.second;
return acc + 1000.f / p.second;
});
it->value = sum / fps_stats.size();
it->value = 1000.f / (sum / fps_stats.size());
}
} else {
try {