summaryrefslogtreecommitdiffstats
path: root/vlib/vlib/trace_funcs.h
diff options
context:
space:
mode:
authorBud Grise <griseb@cisco.com>2016-02-02 14:23:29 -0500
committerGerrit Code Review <gerrit@fd.io>2016-02-02 21:33:08 +0000
commit0bcc9d511e52a9832e723825b4c84d9332d7025b (patch)
treef170cc10b06fd13aadb72974a7606376c0774560 /vlib/vlib/trace_funcs.h
parentcfe0724b22672369d7d26108eef89362b7006a0c (diff)
Tracing enhancements.
Limit buffer tracing to 50 in order to limit large output, unless the user over rides the max "sh trace max <number>". Add trace filtering, to be able to only trace packets that were processed by a specific node or exclude packets processed by a node. Example, only include packets processed by error-drop: # trace filter include error-drop 1 # trace add dpdk-input 1000000 <wait for packets, to come in> # show trace Change-Id: I5d9e15d2268ea55e6ef87b2b8756049c49b2791b Signed-off-by: Todd Foggoa <tfoggoa@cisco.com>
Diffstat (limited to 'vlib/vlib/trace_funcs.h')
-rw-r--r--vlib/vlib/trace_funcs.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/vlib/vlib/trace_funcs.h b/vlib/vlib/trace_funcs.h
index 3dc7471e152..1da46b41964 100644
--- a/vlib/vlib/trace_funcs.h
+++ b/vlib/vlib/trace_funcs.h
@@ -99,6 +99,8 @@ vlib_trace_next_frame (vlib_main_t * vm,
nf->flags |= VLIB_FRAME_TRACE;
}
+void trace_apply_filter (vlib_main_t * vm);
+
/* Mark buffer as traced and allocate trace buffer. */
always_inline void
vlib_trace_buffer (vlib_main_t * vm,
@@ -110,6 +112,16 @@ vlib_trace_buffer (vlib_main_t * vm,
vlib_trace_main_t * tm = &vm->trace_main;
vlib_trace_header_t ** h;
+ /*
+ * Apply filter to existing traces to keep number of allocated traces low.
+ * Performed each time around the main loop.
+ */
+ if (tm->last_main_loop_count != vm->main_loop_count)
+ {
+ tm->last_main_loop_count = vm->main_loop_count;
+ trace_apply_filter (vm);
+ }
+
vlib_trace_next_frame (vm, r, next_index);
pool_get (tm->trace_buffer_pool, h);