vlib: add ASSERT to vlib_time_now(...)
[vpp.git] / src / vlib / main.h
index af6539e..d6b2d1f 100644 (file)
@@ -251,6 +251,14 @@ typedef struct vlib_main_t
    */
   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.
@@ -268,6 +276,10 @@ typedef struct vlib_main_t
   uword *processing_rpc_requests;
   clib_spinlock_t pending_rpc_lock;
 
+  /* buffer fault injector */
+  u32 buffer_alloc_success_seed;
+  f64 buffer_alloc_success_rate;
+
 } vlib_main_t;
 
 /* Global main structure. */
@@ -278,6 +290,13 @@ void vlib_worker_loop (vlib_main_t * vm);
 always_inline f64
 vlib_time_now (vlib_main_t * vm)
 {
+#if CLIB_DEBUG > 0
+  extern __thread uword __os_thread_index;
+#endif
+  /*
+   * Make sure folks don't pass &vlib_global_main from a worker thread.
+   */
+  ASSERT (vm->thread_index == __os_thread_index);
   return clib_time_now (&vm->clib_time) + vm->time_offset;
 }