From d56a6f59e99b7adec6742cd25f0d84bacf594537 Mon Sep 17 00:00:00 2001 From: Bud Grise Date: Fri, 19 Feb 2016 12:10:33 -0500 Subject: Add packet tracing hint This avoids checking the buffer flags bit if tracing is not enabled. Change-Id: I32e1a90b5fd10318254c611344488bc2a441c71e Signed-off-by: Todd Foggoa (tfoggoa) --- vlib/vlib/trace.c | 4 ++++ vlib/vlib/trace.h | 3 +++ 2 files changed, 7 insertions(+) (limited to 'vlib') diff --git a/vlib/vlib/trace.c b/vlib/vlib/trace.c index b3008644e5d..4a611ee97b1 100644 --- a/vlib/vlib/trace.c +++ b/vlib/vlib/trace.c @@ -121,6 +121,8 @@ clear_trace_buffer (void) tm = &this_vlib_main->trace_main; mainheap = clib_mem_set_heap (this_vlib_main->heap_base); + tm->trace_active_hint = 0; + for (i = 0; i < vec_len (tm->trace_buffer_pool); i++) if (! pool_is_free_index (tm->trace_buffer_pool, i)) vec_free (tm->trace_buffer_pool[i]); @@ -369,6 +371,8 @@ cli_add_trace_buffer (vlib_main_t * vm, void *oldheap; tm = &this_vlib_main->trace_main; + tm->trace_active_hint = 1; + oldheap = clib_mem_set_heap (this_vlib_main->heap_base); vec_validate (tm->nodes, node_index); diff --git a/vlib/vlib/trace.h b/vlib/vlib/trace.h index 50e51638fdb..fe5d7377861 100644 --- a/vlib/vlib/trace.h +++ b/vlib/vlib/trace.h @@ -76,6 +76,9 @@ typedef struct { #define FILTER_FLAG_EXCLUDE 2 u32 filter_count; + /* set on trace add, cleared on clear trace */ + u32 trace_active_hint; + /* Per node trace counts. */ vlib_trace_node_t * nodes; } vlib_trace_main_t; -- cgit 1.2.3-korg