|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
20 #include <perfmon/perfmon.h>
21 #include <asm/unistd.h>
22 #include <sys/ioctl.h>
27 int group_fd,
unsigned long flags)
31 ret = syscall (__NR_perf_event_open, hw_event,
pid, cpu, group_fd,
flags);
61 if ((read_result = read (pt->
pm_fds[
i], &sw_value,
62 sizeof (sw_value))) !=
sizeof (sw_value))
65 (
"counter read returned %d, expected %d",
66 read_result,
sizeof (sw_value));
98 for (j = 0; j <
vec_len (vlib_mains); j++)
100 stat_vm = vlib_mains[j];
117 struct perf_event_attr
pe;
119 struct perf_event_mmap_page *p = 0;
135 for (
i = 0;
i < limit;
i++)
140 memset (&
pe, 0,
sizeof (
struct perf_event_attr));
141 pe.type =
c->pe_type;
142 pe.size =
sizeof (
struct perf_event_attr);
143 pe.config =
c->pe_config;
150 if (
pe.type != PERF_TYPE_SOFTWARE)
153 pe.exclude_kernel = 1;
167 if (
pe.type != PERF_TYPE_SOFTWARE)
169 p = mmap (0, pm->
page_size, PROT_READ, MAP_SHARED, fd, 0);
181 if (ioctl (fd, PERF_EVENT_IOC_RESET, 0) < 0)
184 if (ioctl (fd, PERF_EVENT_IOC_ENABLE, 0) < 0)
195 for (
i = 0;
i < limit;
i++)
204 if (p == 0 || p->cap_user_rdpmc == 0)
207 index = p->index - 1;
234 if (ioctl (pt->
pm_fds[
i], PERF_EVENT_IOC_DISABLE, 0) < 0)
287 all = (last_set == ~0);
302 if (vlib_mains[
i] == 0)
307 (vlib_mains[
i]->worker_thread_main_loop_callbacks,
308 vlib_mains[
i]->worker_thread_main_loop_callback_tmp,
309 vlib_mains[
i]->worker_thread_main_loop_callback_lock,
334 for (j = 0; j <
vec_len (vlib_mains); j++)
336 stat_vm = vlib_mains[j];
354 for (j = 0; j <
vec_len (vlib_mains); j++)
356 stat_vm = vlib_mains[j];
373 for (k = 0; k < 2; k++)
384 capture_name =
format (0,
"t%d-%v%c", j,
nm->nodes[
i]->name, 0);
392 memset (
c, 0,
sizeof (*
c));
393 c->thread_and_node_name = capture_name;
406 counter_name = (
u8 *) current_event->
name;
408 vec_add1 (
c->counter_names, counter_name);
425 all = (last_set == ~0);
433 if (vlib_mains[
i] == 0)
437 (vlib_mains[
i]->worker_thread_main_loop_callbacks,
438 vlib_mains[
i]->worker_thread_main_loop_callback_tmp,
439 vlib_mains[
i]->worker_thread_main_loop_callback_lock,
479 if (vlib_mains[
i] == 0)
483 (vlib_mains[
i]->worker_thread_main_loop_callbacks,
484 vlib_mains[
i]->worker_thread_main_loop_callback_tmp,
485 vlib_mains[
i]->worker_thread_main_loop_callback_lock,
496 uword *event_data = 0;
537 .name =
"perfmon-periodic-process",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
void scrape_and_clear_counters(perfmon_main_t *pm)
static void handle_timeout(vlib_main_t *vm, perfmon_main_t *pm, f64 now)
static void disable_events(perfmon_main_t *pm)
#define clib_memcpy(d, s, n)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
perfmon_main_t perfmon_main
#define clib_callback_data_remove(set_, fp_)
Remove a callback from the specified callback set.
vlib_node_main_t node_main
perfmon_capture_t * capture_pool
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ VLIB_NODE_RUNTIME_PERF_BEFORE
@ VLIB_NODE_RUNTIME_PERF_RESET
static void worker_thread_stop_event(vlib_main_t *vm)
#define clib_unix_warning(format, args...)
#define clib_callback_data_enable_disable(set_, fp_, ena_)
Enable/Disable the specified callback.
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
vlib_node_runtime_t * node
static void clear_counters(perfmon_main_t *pm)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define vlib_worker_thread_barrier_sync(X)
perfmon_event_config_t * single_events_to_collect
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
#define hash_set_mem(h, key, value)
static void worker_thread_start_event(vlib_main_t *vm)
sll srl srl sll sra u16x4 i
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
vlib_node_runtime_perf_callback_fp_t fp
static void read_current_perf_counters(vlib_node_runtime_perf_callback_data_t *data, vlib_node_runtime_perf_callback_args_t *args)
uword pe(void *v)
GDB callable function: pe - call pool_elts - number of elements in a pool.
struct _vlib_node_registration vlib_node_registration_t
vlib_node_runtime_perf_callback_set_t vlib_node_runtime_perf_callbacks
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags)
#define vec_free(V)
Free vector's memory (no header).
static uword perfmon_periodic_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
u32 node_index
Node index.
void(**volatile worker_thread_main_loop_callback_tmp)(struct vlib_main_t *, u64 t)
vlib_node_registration_t perfmon_periodic_node
(constructor) VLIB_REGISTER_NODE (perfmon_periodic_node)
perfmon_counters_t * counters
#define hash_get_mem(h, key)
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
vlib_node_runtime_perf_call_type_t call_type
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
uword * capture_by_thread_and_node_name
#define CLIB_MEM_UNPOISON(a, s)
static void enable_current_events(perfmon_main_t *pm)
clib_spinlock_t worker_thread_main_loop_callback_lock
static uword clib_bitmap_last_set(uword *ai)
Return the higest numbered set bit in a bitmap.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static vlib_main_t * vlib_get_main(void)
vnet_interface_output_runtime_t * rt
static void start_event(perfmon_main_t *pm, f64 now, uword event_data)
#define clib_warning(format, args...)
void(**volatile worker_thread_main_loop_callbacks)(struct vlib_main_t *, u64 t)
static f64 vlib_time_now(vlib_main_t *vm)
perfmon_thread_t ** threads
#define clib_callback_enable_disable(h, tmp, l, f, enable)
Add or remove a callback to the specified callback set.
#define clib_callback_data_is_set(set_, fp_)
Check if callback is set.
@ VLIB_NODE_RUNTIME_PERF_AFTER
#define clib_callback_data_add(set_, value_)
Add a callback to the specified callback set.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags