Stats
Keeping the performance figures.
Pure arithmetic, so the awkward part -- a rolling average that has to start somewhere -- is testable without opening a window.
Type Aliases
Definitions
A rolling average that does not have to crawl up from zero.
The first sample is taken whole. Blending it against an initial nought would show a frame rate climbing from 0 to 60 over the first second of every run, which looks like a stall and is really just the average filling up.
Converts a duration in nanoseconds to milliseconds as a Float32.
Folds one frame's measurements into the running figures.
A Float32 to one decimal place, without String.format.
Rounds rather than truncates, so 1.99 does not read as 1.9. Negatives are not expected -- these are durations and rates -- but they are handled rather than silently mangled.
The frame rate a gap of frameNs between frames implies.
A gap of nought or less means the clock has not moved, which happens on the first frame and on machines whose timer granularity is coarser than a frame. Reporting an infinity there would be arithmetically honest and useless to read.