diff options
author | Dave Barach <dave@barachs.net> | 2016-03-26 18:45:42 -0400 |
---|---|---|
committer | Dave Barach <dave@barachs.net> | 2016-03-26 18:45:52 -0400 |
commit | fb6e59d839001b37bbb70e253627d5b1331ae918 (patch) | |
tree | aa62c9da5996e254fe98cce20f3075ba1e2c7480 /vlib | |
parent | 20a64f5f8a3dc6132c79da074adc7de1f037a154 (diff) |
Improve main-loop event-logs
Change-Id: I984debeffe0dce36c9e7ab963f25d862cc7550cc
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vlib')
-rw-r--r-- | vlib/vlib/main.c | 19 | ||||
-rw-r--r-- | vlib/vlib/node.c | 6 |
2 files changed, 13 insertions, 12 deletions
diff --git a/vlib/vlib/main.c b/vlib/vlib/main.c index 2ea91a91657..fe9a7da8243 100644 --- a/vlib/vlib/main.c +++ b/vlib/vlib/main.c @@ -46,9 +46,6 @@ CJ_GLOBAL_LOG_PROTOTYPE; - -//#define VLIB_ELOG_MAIN_LOOP 1 - /* Actually allocate a few extra slots of vector data to support speculative vector enqueues which overflow vector data in next frame. */ #define VLIB_FRAME_SIZE_ALLOC (VLIB_FRAME_SIZE + 4) @@ -779,22 +776,26 @@ void vlib_gdb_show_event_log (void) elog_show_buffer_internal (vlib_get_main(), (u32)~0); } -always_inline void +static inline void vlib_elog_main_loop_event (vlib_main_t * vm, u32 node_index, u64 time, u32 n_vectors, u32 is_return) { - elog_main_t * em = &vm->elog_main; + vlib_main_t * evm = &vlib_global_main; + elog_main_t * em = &evm->elog_main; - if (VLIB_ELOG_MAIN_LOOP) - elog (em, + if (VLIB_ELOG_MAIN_LOOP && n_vectors) + elog_track (em, /* event type */ vec_elt_at_index (is_return - ? vm->node_return_elog_event_types - : vm->node_call_elog_event_types, + ? evm->node_return_elog_event_types + : evm->node_call_elog_event_types, node_index), + /* track */ + (vm->cpu_index ? &vlib_worker_threads[vm->cpu_index].elog_track : + &em->default_track), /* data to log */ n_vectors); } diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c index 66a2d09fdb8..40ef7c71a51 100644 --- a/vlib/vlib/node.c +++ b/vlib/vlib/node.c @@ -61,13 +61,13 @@ static void node_set_elog_name (vlib_main_t * vm, uword node_index) t = vec_elt_at_index (vm->node_call_elog_event_types, node_index); vec_free (t->format); - t->format = (char *) format (0, "%v (%%d)", n->name); + t->format = (char *) format (0, "%v-call: %%d%c", n->name, 0); t = vec_elt_at_index (vm->node_return_elog_event_types, node_index); vec_free (t->format); - t->format = (char *) format (0, "%v () = %%d", n->name); + t->format = (char *) format (0, "%v-return: %%d%c", n->name, 0); - n->name_elog_string = elog_string (&vm->elog_main, "%v", n->name); + n->name_elog_string = elog_string (&vm->elog_main, "%v%c", n->name,0); } void vlib_node_rename (vlib_main_t * vm, u32 node_index, char * fmt, ...) |