From c35a8302c6275a1ba71dcdff15f58310d064a909 Mon Sep 17 00:00:00 2001 From: rodri Date: Mon, 8 Mar 2021 21:01:40 +0000 Subject: refactor statistics code to make it more general purpose. --- dat.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'dat.h') diff --git a/dat.h b/dat.h index 6503042..4dd4250 100644 --- a/dat.h +++ b/dat.h @@ -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 -- cgit v1.2.3