From 462352102c6e48b35b2c7545b8ada68e2f42045f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Jun 2021 15:38:36 -0600 Subject: [PATCH] add a new update() method to PBD::TimingStats to allow use of an already-computed interval --- libs/pbd/pbd/timing.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/pbd/pbd/timing.h b/libs/pbd/pbd/timing.h index fa246bc554..4c3597ce44 100644 --- a/libs/pbd/pbd/timing.h +++ b/libs/pbd/pbd/timing.h @@ -83,6 +83,10 @@ public: void update () { m_last_val = g_get_monotonic_time (); } + void update (uint64_t interval) { + m_start_val = 0; + m_last_val = interval; + } void reset () { m_start_val = m_last_val = 0; @@ -134,6 +138,17 @@ public: } } + /* interval computed externally */ + void update (uint64_t interval) + { + /* throw away the first 1000 values */ + if (_update_cnt++ < 1000) { + return; + } + Timing::update (interval); + calc (); + } + void reset () { Timing::reset ();