aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.h
diff options
context:
space:
mode:
authorTom Seidenberg <tseidenb@cisco.com>2020-07-10 15:49:03 +0000
committerDave Barach <openvpp@barachs.net>2020-07-16 21:44:42 +0000
commit6c81f5a2493ff65b4dacfef45db8a1ee459a738f (patch)
tree24343a92e18599be4e4b4aa360ab7b2c13cdb878 /src/vlib/threads.h
parentbab02f0b184b63c4159ded030cf34044be10da40 (diff)
misc: add callback hooks and refactor pmc
Callbacks for monitoring and performance measurement: - Add new callback list type, with context - Add callbacks for API, CLI, and barrier sync - Modify node dispatch callback to pass plugin-specific context - Modify perfmon plugin to keep PMC samples local to the plugin - Include process nodes in dispatch callback - Pass dispatch function return value to callback Type: refactor Signed-off-by: Tom Seidenberg <tseidenb@cisco.com> Change-Id: I28b06c58490611e08d76ff5b01b2347ba2109b22
Diffstat (limited to 'src/vlib/threads.h')
-rw-r--r--src/vlib/threads.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index c1188cea933..e8d416997b0 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -16,6 +16,7 @@
#define included_vlib_threads_h
#include <vlib/main.h>
+#include <vppinfra/callback.h>
#include <linux/sched.h>
extern vlib_main_t **vlib_mains;
@@ -400,6 +401,10 @@ vlib_worker_thread_barrier_check (void)
u32 thread_index = vm->thread_index;
f64 t = vlib_time_now (vm);
+ if (PREDICT_FALSE (vec_len (vm->barrier_perf_callbacks) != 0))
+ clib_call_callbacks (vm->barrier_perf_callbacks, vm,
+ vm->clib_time.last_cpu_time, 0 /* enter */ );
+
if (PREDICT_FALSE (vlib_worker_threads->barrier_elog_enabled))
{
vlib_worker_thread_t *w = vlib_worker_threads + thread_index;
@@ -498,6 +503,10 @@ vlib_worker_thread_barrier_check (void)
ed->thread_index = thread_index;
ed->duration = (int) (1000000.0 * t);
}
+
+ if (PREDICT_FALSE (vec_len (vm->barrier_perf_callbacks) != 0))
+ clib_call_callbacks (vm->barrier_perf_callbacks, vm,
+ vm->clib_time.last_cpu_time, 1 /* leave */ );
}
}