vlib: calculate per-worker loops/second metric
Use exponential smoothing. Each sample has a half-life of 1
second. reported_rate(t) = reported_rate(t-1) * K + rate(t)*(1-K)
Sample every 20ms, i.e. 50 samples per second
K = exp (-1.0/20.0);
K = 0.95;
Type: feature
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I9aea5dd5fecfaefffb78245316adb4bf62eb2bd4
diff --git a/src/vlib/main.h b/src/vlib/main.h
index af6539e..0e65c81 100644
--- a/src/vlib/main.h
+++ b/src/vlib/main.h
@@ -251,6 +251,14 @@
*/
int need_vlib_worker_thread_node_runtime_update;
+ /* Dispatch loop time accounting */
+ u64 loops_this_reporting_interval;
+ f64 loop_interval_end;
+ f64 loop_interval_start;
+ f64 loops_per_second;
+ f64 seconds_per_loop;
+ f64 damping_constant;
+
/*
* Barrier epoch - Set to current time, each time barrier_sync or
* barrier_release is called with zero recursion.