diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-19 06:27:33 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-19 06:27:33 +0100 | 
| commit | 36b2d71c26baefa4318383326e0fec61d5aa3616 (patch) | |
| tree | 23ab77e1602ee4451033551b280f6515aea41663 /logic | |
| parent | 6c031cbf7234cd5e58a09a984f21b938a30feafe (diff) | |
logic/pipeline: improve DEBUG_TIMINGS
Diffstat (limited to 'logic')
| -rw-r--r-- | logic/pipeline.cpp | 30 | 
1 files changed, 23 insertions, 7 deletions
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 1cd23110..130b7eff 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -29,6 +29,11 @@  #   include <mmsystem.h>  #endif +//#define DEBUG_TIMINGS +#ifdef DEBUG_TIMINGS +#   include "compat/variance.hpp" +#endif +  namespace pipeline_impl {  reltrans::reltrans() = default; @@ -198,7 +203,6 @@ double pipeline::map(double pos, Map& axis)      return fc.get_value(pos);  } -//#define DEBUG_TIMINGS  template<int u, int w>  static inline bool is_nan(const dmat<u,w>& r)  { @@ -535,18 +539,30 @@ void pipeline::run()  #ifdef DEBUG_TIMINGS          { +            static variance v; +            static Timer tt, t2;              static int cnt; -            static Timer tt; -            if (tt.elapsed_seconds() >= 1) + +            v.input(t2.elapsed_ms()); + +            if (tt.elapsed_ms() >= 1000)              {                  tt.start(); -                qDebug() << cnt << "Hz" -                         << "sleepy time" << sleep_time_ms -                         << "diff" << ms{elapsed_nsecs}.count() - ms{const_sleep_ms}.count() -                         << "backlog" << ms{backlog_time}.count(); +                qDebug() << cnt << "Hz," +                         << "loop: " "time" << v.avg() +                         << "stddev:" << v.stddev() +                         << "backlog" << ms{backlog_time}.count() +                         << "sleep" << sleep_time_ms << "ms"; + +                if (v.count() > 256 * 60) +                    v.clear(); +                  cnt = 0;              } +              cnt++; + +            t2.start();          }  #endif  | 
