diff options
author | Gary Boon <gboon@cisco.com> | 2019-05-03 13:30:14 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-05-03 19:26:49 +0000 |
commit | 4681e07a02c2e1681048c4e3a018433c055a91b1 (patch) | |
tree | 2f99a34616278a620f877b188eb506f5f58a6d4b /src/vlib/trace_funcs.h | |
parent | c5fa2b8099ea1fe18a5df3c71ad6a16df242431e (diff) |
Add callbacks for extended trace functionality, one as content is added with vlib_add_trace, and one to post-process the captured content immediately after trace filtering.
Change-Id: Ieb521686d8c0e7ce1a0ef325f7abdde613e1eb9c
Signed-off-by: Gary Boon <gboon@cisco.com>
Diffstat (limited to 'src/vlib/trace_funcs.h')
-rw-r--r-- | src/vlib/trace_funcs.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/vlib/trace_funcs.h b/src/vlib/trace_funcs.h index eb06799305c..56cbfc7b6a2 100644 --- a/src/vlib/trace_funcs.h +++ b/src/vlib/trace_funcs.h @@ -63,7 +63,14 @@ vlib_add_trace (vlib_main_t * vm, ASSERT (vnet_trace_dummy); - if (PREDICT_FALSE (tm->trace_enable == 0)) + if (PREDICT_FALSE (tm->add_trace_callback != 0)) + { + return tm->add_trace_callback ((struct vlib_main_t *) vm, + (struct vlib_node_runtime_t *) r, + (struct vlib_buffer_t *) b, + n_data_bytes); + } + else if (PREDICT_FALSE (tm->trace_enable == 0)) { ASSERT (vec_len (vnet_trace_dummy) >= n_data_bytes + sizeof (*h)); return vnet_trace_dummy; @@ -129,6 +136,10 @@ vlib_trace_buffer (vlib_main_t * vm, { tm->last_main_loop_count = vm->main_loop_count; trace_apply_filter (vm); + + if (tm->trace_buffer_callback) + (tm->trace_buffer_callback) ((struct vlib_main_t *) vm, + (struct vlib_trace_main_t *) tm); } vlib_trace_next_frame (vm, r, next_index); |