diff options
author | Dave Barach <dave@barachs.net> | 2020-06-08 11:17:19 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-06-08 16:03:36 +0000 |
commit | 0a67b48f1d1065d250191657810bd5cd0b718c39 (patch) | |
tree | 9eec6623974c246fa100c53eb997c9cec53d3895 /src/vlib | |
parent | 6a3195f166fa09e2eb2af66394c12e6288fcd3c5 (diff) |
vlib: stop inlining vlib_add_trace(...)
Packet tracing performance doesn't justify inlining
vlib_add_trace(...) over 500 times.
It makes a 15% text-segment size difference in a representative use-case:
Inline:
$ size .../vnet_skx.dir/ipsec/ipsec_input.c.o
text data bss dec hex filename
6831 80 0 6911 1aff .../vnet_skx.dir/ipsec/ipsec_input.c.o
Not inline:
$ size .../vnet_skx.dir/ipsec/ipsec_input.c.o
text data bss dec hex filename
5776 80 0 5856 16e0 .../vnet_skx.dir/ipsec/ipsec_input.c.o
Retain the original code as vlib_add_trace_inline, instantiate once as
vlib_add_trace.
Type: refactor
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: Iaf431dbf00c4aad03663d86f9dd1322e84d03962
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/trace.c | 9 | ||||
-rw-r--r-- | src/vlib/trace_funcs.h | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/vlib/trace.c b/src/vlib/trace.c index 7ee1b63f07e..f47c1b8c91d 100644 --- a/src/vlib/trace.c +++ b/src/vlib/trace.c @@ -572,6 +572,15 @@ vnet_is_packet_traced (vlib_buffer_t * b, u32 classify_table_index, int func) return 1; } +void * +vlib_add_trace (vlib_main_t * vm, + vlib_node_runtime_t * r, vlib_buffer_t * b, u32 n_data_bytes) +{ + return vlib_add_trace_inline (vm, r, b, n_data_bytes); +} + + + /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vlib/trace_funcs.h b/src/vlib/trace_funcs.h index 4261f675aec..b25237bd7e8 100644 --- a/src/vlib/trace_funcs.h +++ b/src/vlib/trace_funcs.h @@ -52,8 +52,9 @@ vlib_validate_trace (vlib_trace_main_t * tm, vlib_buffer_t * b) void vlib_add_handoff_trace (vlib_main_t * vm, vlib_buffer_t * b); always_inline void * -vlib_add_trace (vlib_main_t * vm, - vlib_node_runtime_t * r, vlib_buffer_t * b, u32 n_data_bytes) +vlib_add_trace_inline (vlib_main_t * vm, + vlib_node_runtime_t * r, vlib_buffer_t * b, + u32 n_data_bytes) { vlib_trace_main_t *tm = &vm->trace_main; vlib_trace_header_t *h; @@ -95,6 +96,11 @@ vlib_add_trace (vlib_main_t * vm, return h->data; } +/* Non-inline (typical use-case) version of the above */ +void *vlib_add_trace (vlib_main_t * vm, + vlib_node_runtime_t * r, vlib_buffer_t * b, + u32 n_data_bytes); + always_inline vlib_trace_header_t * vlib_trace_header_next (vlib_trace_header_t * h) { |