aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.h
diff options
context:
space:
mode:
authorColin Tregenza Dancer <ctd@metaswitch.com>2017-09-06 20:23:24 +0100
committerDave Barach <openvpp@barachs.net>2017-09-11 11:44:44 +0000
commiteb1ac1732f15f9a99edbeffeb94c525b9ff25c1d (patch)
tree3753d83d94c05904e3fcb64370e75661d0afa0bb /src/vlib/threads.h
parenta19e1054b58024891691eaebeb13700cdce57fea (diff)
Recombine diags and minimum barrier open time changes (VPP-968)
Support logging to both syslog and elog Also include DaveB is_mp_safe fix, which had been lost Change-Id: If82f7969e2f43c63c3fed5b1a0c7434c90c1f380 Signed-off-by: Colin Tregenza Dancer <ctd@metaswitch.com>
Diffstat (limited to 'src/vlib/threads.h')
-rw-r--r--src/vlib/threads.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index c3f1cadee16..72340ee1a37 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -18,6 +18,22 @@
#include <vlib/main.h>
#include <linux/sched.h>
+/*
+ * To enable detailed tracing of barrier usage, including call stacks and
+ * timings, define BARRIER_TRACING here or in relevant TAGS. If also used
+ * with CLIB_DEBUG, timing will _not_ be representative of normal code
+ * execution.
+ *
+ */
+
+// #define BARRIER_TRACING 1
+
+/*
+ * Two options for barrier tracing output: syslog & elog.
+ */
+
+// #define BARRIER_TRACING_ELOG 1
+
extern vlib_main_t **vlib_mains;
void vlib_set_thread_name (char *name);
@@ -102,6 +118,10 @@ typedef struct
vlib_thread_registration_t *registration;
u8 *name;
u64 barrier_sync_count;
+#ifdef BARRIER_TRACING
+ const char *barrier_caller;
+ const char *barrier_context;
+#endif
volatile u32 *node_reforks_required;
long lwp;
@@ -179,7 +199,14 @@ u32 vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts);
#define BARRIER_SYNC_TIMEOUT (1.0)
#endif
-void vlib_worker_thread_barrier_sync (vlib_main_t * vm);
+#ifdef BARRIER_TRACING
+#define vlib_worker_thread_barrier_sync(X) {vlib_worker_threads[0].barrier_caller=__FUNCTION__;vlib_worker_thread_barrier_sync_int(X);}
+#else
+#define vlib_worker_thread_barrier_sync(X) vlib_worker_thread_barrier_sync_int(X)
+#endif
+
+
+void vlib_worker_thread_barrier_sync_int (vlib_main_t * vm);
void vlib_worker_thread_barrier_release (vlib_main_t * vm);
void vlib_worker_thread_node_refork (void);