#include <vlib/vlib.h>
#include <vlib/threads.h>
+u8 *vnet_trace_dummy;
+
/* Helper function for nodes which only trace buffer data. */
void
vlib_trace_frame_buffers_only (vlib_main_t * vm,
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
- clib_memcpy (t0, b0->data + b0->current_data,
- n_buffer_data_bytes_in_trace);
+ clib_memcpy_fast (t0, b0->data + b0->current_data,
+ n_buffer_data_bytes_in_trace);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
t1 = vlib_add_trace (vm, node, b1, n_buffer_data_bytes_in_trace);
- clib_memcpy (t1, b1->data + b1->current_data,
- n_buffer_data_bytes_in_trace);
+ clib_memcpy_fast (t1, b1->data + b1->current_data,
+ n_buffer_data_bytes_in_trace);
}
from += 2;
n_left -= 2;
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
- clib_memcpy (t0, b0->data + b0->current_data,
- n_buffer_data_bytes_in_trace);
+ clib_memcpy_fast (t0, b0->data + b0->current_data,
+ n_buffer_data_bytes_in_trace);
}
from += 1;
n_left -= 1;
/* *INDENT-OFF* */
foreach_vlib_main (
({
- void *mainheap;
-
tm = &this_vlib_main->trace_main;
- mainheap = clib_mem_set_heap (this_vlib_main->heap_base);
- tm->trace_active_hint = 0;
+ tm->trace_enable = 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]);
pool_free (tm->trace_buffer_pool);
- clib_mem_set_heap (mainheap);
}));
/* *INDENT-ON* */
}
-static u8 *
+u8 *
format_vlib_trace (u8 * s, va_list * va)
{
vlib_main_t *vm = va_arg (*va, vlib_main_t *);
/* *INDENT-OFF* */
foreach_vlib_main (
({
- void *mainheap;
-
fmt = "------------------- Start of thread %d %s -------------------\n";
s = format (s, fmt, index, vlib_worker_threads[index].name);
tm = &this_vlib_main->trace_main;
- mainheap = clib_mem_set_heap (this_vlib_main->heap_base);
-
trace_apply_filter(this_vlib_main);
traces = 0;
if (vec_len (traces) == 0)
{
- clib_mem_set_heap (mainheap);
s = format (s, "No packets in trace buffer\n");
goto done;
}
goto done;
}
- clib_mem_set_heap (mainheap);
-
s = format (s, "Packet %d\n%U\n\n", i + 1,
format_vlib_trace, vm, traces[i]);
-
- mainheap = clib_mem_set_heap (this_vlib_main->heap_base);
}
done:
vec_free (traces);
- clib_mem_set_heap (mainheap);
index++;
}));
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
+ if (vnet_trace_dummy == 0)
+ vec_validate_aligned (vnet_trace_dummy, 2048, CLIB_CACHE_LINE_BYTES);
+
while (unformat_check_input (line_input) != (uword) UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "%U %d",
/* *INDENT-OFF* */
foreach_vlib_main ((
{
- void *oldheap;
tm = &this_vlib_main->trace_main;
- tm->trace_active_hint = 1;
tm->verbose = verbose;
- oldheap =
- clib_mem_set_heap (this_vlib_main->heap_base);
vec_validate (tm->nodes, node_index);
tn = tm->nodes + node_index;
- tn->limit += add; clib_mem_set_heap (oldheap);
+ tn->limit += add;
+ tm->trace_enable = 1;
}));
/* *INDENT-ON* */
u32 filter_node_index;
u32 filter_flag;
u32 filter_count;
- void *mainheap;
if (unformat (input, "include %U %d",
unformat_vlib_node, vm, &filter_node_index, &filter_count))
/*
* Clear the trace limits to stop any in-progress tracing
- * Prevents runaway trace allocations when the filter changes (or is removed)
+ * Prevents runaway trace allocations when the filter changes
+ * (or is removed)
*/
- mainheap = clib_mem_set_heap (this_vlib_main->heap_base);
vec_free (tm->nodes);
- clib_mem_set_heap (mainheap);
}));
/* *INDENT-ON* */