X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vlib%2Fvlib%2Ftrace_funcs.h;h=1da46b41964fc6cd85f4c8e0e243fee41e71f556;hb=ce8debfe0faaea959aed846f83a0e1ade5f5acd2;hp=3dc7471e152ba4e4cc11b201770ae244b3fb38c1;hpb=cb9cadad578297ffd78fa8a33670bdf1ab669e7e;p=vpp.git 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);