From 5fd723b1f000da658ee13ae2cf79a0636a2bc0f2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 29 Nov 2017 12:03:47 +0100 Subject: Update LuaProc GC stat calc --- libs/ardour/luaproc.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'libs/ardour/luaproc.cc') diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index 9122fb32fb..d5a0f65d1e 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -131,7 +131,8 @@ void LuaProc::init () { #ifdef WITH_LUAPROC_STATS - _stats_avg[0] = _stats_avg[1] = _stats_max[0] = _stats_max[1] = _stats_cnt = 0; + _stats_avg[0] = _stats_avg[1] = _stats_max[0] = _stats_max[1] = 0; + _stats_cnt = -25; #endif lua.tweak_rt_gc (); @@ -746,14 +747,15 @@ LuaProc::connect_and_run (BufferSet& bufs, lua.collect_garbage_step (100 /*kB*/); #ifdef WITH_LUAPROC_STATS - ++_stats_cnt; - int64_t t2 = g_get_monotonic_time (); - int64_t ela0 = t1 - t0; - int64_t ela1 = t2 - t1; - if (ela0 > _stats_max[0]) _stats_max[0] = ela0; - if (ela1 > _stats_max[1]) _stats_max[1] = ela1; - _stats_avg[0] += ela0; - _stats_avg[1] += ela1; + if (++_stats_cnt > 0) { + int64_t t2 = g_get_monotonic_time (); + int64_t ela0 = t1 - t0; + int64_t ela1 = t2 - t1; + if (ela0 > _stats_max[0]) _stats_max[0] = ela0; + if (ela1 > _stats_max[1]) _stats_max[1] = ela1; + _stats_avg[0] += ela0; + _stats_avg[1] += ela1; + } #endif return 0; } -- cgit v1.2.3