From e132c6a9f75918978051e8eb23092f5d05c7c3fc Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 14 Apr 2018 15:40:24 +0200 Subject: Redo frequency counters. --- src/common.hpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/common.hpp') diff --git a/src/common.hpp b/src/common.hpp index f4ce9ff..ae4deed 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -48,21 +48,13 @@ ntime_t nclock(void); #define MSEC(x) ((ntime_t)x * 1000000) class freq_counter_t { - ntime_t *samples; - size_t num_samples, collected = 0; - ntime_t last_tick = 0; - - float last_ma; - ntime_t last_ma_time = 0; - - void push(ntime_t sample); + size_t ticks; + ntime_t t0 = 0; + float last_reading; public: - freq_counter_t(size_t num_samples_); - ~freq_counter_t(void); - void tick(void); - float freq_ma(void); + float read(ntime_t ival); }; extern freq_counter_t fc_render; -- cgit