diff options
author | rodri <rgl@antares-labs.eu> | 2021-03-08 21:01:40 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2021-03-08 21:01:40 +0000 |
commit | c35a8302c6275a1ba71dcdff15f58310d064a909 (patch) | |
tree | 855fea01169b4de19a8d777446008df0ed672a54 /dat.h | |
parent | c24c56fa9ac83b61a6ad6732f9704b9dddf79b22 (diff) | |
download | gamephysics-c35a8302c6275a1ba71dcdff15f58310d064a909.tar.gz gamephysics-c35a8302c6275a1ba71dcdff15f58310d064a909.tar.bz2 gamephysics-c35a8302c6275a1ba71dcdff15f58310d064a909.zip |
refactor statistics code to make it more general purpose.
Diffstat (limited to 'dat.h')
-rw-r--r-- | dat.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,11 +1,21 @@ typedef struct State State; typedef struct Derivative Derivative; +typedef struct Stats Stats; + +struct Stats +{ + double cur; + double total; + double min, avg, max; + uvlong nupdates; + + void (*update)(Stats*, double); +}; struct State { double x, v; - double acc, min, max, avg; - int nsteps; + Stats stats; }; struct Derivative |