From 7bce9899c00b88409b51e393038c81d9722671e4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Jun 2021 10:44:50 -0600 Subject: [PATCH] modify PBD::TimingStats to discard the first 1000 recorded values to avoid too much influence from chaotic startup conditions --- libs/pbd/pbd/timing.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/pbd/pbd/timing.h b/libs/pbd/pbd/timing.h index 608997c8c8..0ba4166dd3 100644 --- a/libs/pbd/pbd/timing.h +++ b/libs/pbd/pbd/timing.h @@ -127,8 +127,11 @@ public: void update () { - Timing::update (); - calc (); + /* throw away the first 1000 values */ + if (_update_cnt++ > 1000) { + Timing::update (); + calc (); + } } void reset () @@ -140,6 +143,7 @@ public: _avg = 0.; _vm = 0.; _vs = 0.; + _update_cnt = 0; } bool valid () const { @@ -192,6 +196,8 @@ private: double _avg; double _vm; double _vs; + uint64_t _update_cnt; +}; }; class LIBPBD_API TimingData