Bring in the gnu omni font for text, and rewrite my stats code to use c++ and then use that to calc FPS stats for an FPS display on the left. Debug build gets about 48, release gets about 500fps. Amit's code will probably do even better.

This commit is contained in:
Zed A. Shaw 2025-01-18 02:42:41 -05:00
parent e3e0f0a322
commit cf9682ed70
8 changed files with 85 additions and 95 deletions

45
stats.hpp Normal file
View file

@ -0,0 +1,45 @@
#pragma once
#include <cmath>
struct Stats {
double sum = 0.0;
double sumsq = 0.0;
unsigned long n = 0L;
double min = 0.0;
double max = 0.0;
inline void reset() {
sum = 0;
sumsq = 0;
n = 0L;
min = 0;
max = 0;
}
inline double mean() {
return sum / n;
}
inline double stddev() {
return std::sqrt((sumsq - (sum * sum / n)) /
(n - 1));
}
inline void sample(double s) {
sum += s;
sumsq += s * s;
if (n == 0) {
min = s;
max = s;
} else {
if (min > s) min = s;
if (max < s) max = s;
}
n += 1;
}
void dump();
};