FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
perfmon_periodic.c
Go to the documentation of this file.
1 /*
2  * perfmon_periodic.c - skeleton plug-in periodic function
3  *
4  * Copyright (c) <current-year> <your-organization>
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vppinfra/error.h>
20 #include <perfmon/perfmon.h>
21 #include <asm/unistd.h>
22 #include <sys/ioctl.h>
23 
24 /* "not in glibc" */
25 static long
26 perf_event_open (struct perf_event_attr *hw_event, pid_t pid, int cpu,
27  int group_fd, unsigned long flags)
28 {
29  int ret;
30 
31  ret = syscall (__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
32  return ret;
33 }
34 
35 static void
38 {
39  int i;
41  perfmon_thread_t *pt = data->u[0].v;
42  u64 c[2] = { 0, 0 };
43  u64 *cc;
44 
46  return;
47 
49  cc = pt->c;
50  else
51  cc = c;
52 
53  for (i = 0; i < pm->n_active; i++)
54  {
55  if (pt->rdpmc_indices[i] != ~0)
56  cc[i] = clib_rdpmc ((int) pt->rdpmc_indices[i]);
57  else
58  {
59  u64 sw_value;
60  int read_result;
61  if ((read_result = read (pt->pm_fds[i], &sw_value,
62  sizeof (sw_value))) != sizeof (sw_value))
63  {
65  ("counter read returned %d, expected %d",
66  read_result, sizeof (sw_value));
69  read_current_perf_counters, 0 /* enable */ );
70  return;
71  }
72  cc[i] = sw_value;
73  }
74  }
75 
77  {
78  u32 node_index = args->node->node_index;
80  pt->counters[node_index].ticks[0] += c[0] - pt->c[0];
81  pt->counters[node_index].ticks[1] += c[1] - pt->c[1];
82  pt->counters[node_index].vectors += args->packets;
83  }
84 }
85 
86 static void
88 {
89  int j;
90  vlib_main_t *vm = pm->vlib_main;
91  vlib_main_t *stat_vm;
92  perfmon_thread_t *pt;
93  u32 len;
94 
95 
97 
98  for (j = 0; j < vec_len (vlib_mains); j++)
99  {
100  stat_vm = vlib_mains[j];
101  if (stat_vm == 0)
102  continue;
103 
104  pt = pm->threads[j];
105  len = vec_len (pt->counters);
106  if (!len)
107  continue;
108 
109  clib_memset (pt->counters, 0, len * sizeof (pt->counters[0]));
110  }
112 }
113 
114 static void
116 {
117  struct perf_event_attr pe;
118  int fd;
119  struct perf_event_mmap_page *p = 0;
122  u32 my_thread_index = vm->thread_index;
123  perfmon_thread_t *pt = pm->threads[my_thread_index];
124  u32 index;
125  int i, limit = 1;
126  int cpu;
129  cbdata.u[0].v = pt;
130  cbdata.u[1].v = vm;
131 
132  if ((pm->current_event + 1) < vec_len (pm->single_events_to_collect))
133  limit = 2;
134 
135  for (i = 0; i < limit; i++)
136  {
138  pm->current_event + i);
139 
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;
144  pe.disabled = 1;
145  pe.pinned = 1;
146  /*
147  * Note: excluding the kernel makes the
148  * (software) context-switch counter read 0...
149  */
150  if (pe.type != PERF_TYPE_SOFTWARE)
151  {
152  /* Exclude kernel and hypervisor */
153  pe.exclude_kernel = 1;
154  pe.exclude_hv = 1;
155  }
156 
157  cpu = vm->cpu_id;
158 
159  fd = perf_event_open (&pe, 0, cpu, -1, 0);
160  if (fd == -1)
161  {
162  clib_unix_warning ("event open: type %d config %d", c->pe_type,
163  c->pe_config);
164  return;
165  }
166 
167  if (pe.type != PERF_TYPE_SOFTWARE)
168  {
169  p = mmap (0, pm->page_size, PROT_READ, MAP_SHARED, fd, 0);
170  if (p == MAP_FAILED)
171  {
172  clib_unix_warning ("mmap");
173  close (fd);
174  return;
175  }
176  CLIB_MEM_UNPOISON (p, pm->page_size);
177  }
178  else
179  p = 0;
180 
181  if (ioctl (fd, PERF_EVENT_IOC_RESET, 0) < 0)
182  clib_unix_warning ("reset ioctl");
183 
184  if (ioctl (fd, PERF_EVENT_IOC_ENABLE, 0) < 0)
185  clib_unix_warning ("enable ioctl");
186 
187  pt->perf_event_pages[i] = (void *) p;
188  pt->pm_fds[i] = fd;
189  }
190 
191  /*
192  * Hardware events must be all opened and enabled before aquiring
193  * pmc indices, otherwise the pmc indices might be out-dated.
194  */
195  for (i = 0; i < limit; i++)
196  {
197  p = (struct perf_event_mmap_page *) pt->perf_event_pages[i];
198 
199  /*
200  * Software event counters - and others not capable of being
201  * read via the "rdpmc" instruction - will be read
202  * by system calls.
203  */
204  if (p == 0 || p->cap_user_rdpmc == 0)
205  index = ~0;
206  else
207  index = p->index - 1;
208 
209  pt->rdpmc_indices[i] = index;
210  }
211 
212  pm->n_active = i;
213  /* Enable the main loop counter snapshot mechanism */
215 }
216 
217 static void
219 {
221  u32 my_thread_index = vm->thread_index;
222  perfmon_thread_t *pt = pm->threads[my_thread_index];
223  int i;
224 
225  /* Stop main loop collection */
228 
229  for (i = 0; i < pm->n_active; i++)
230  {
231  if (pt->pm_fds[i] == 0)
232  continue;
233 
234  if (ioctl (pt->pm_fds[i], PERF_EVENT_IOC_DISABLE, 0) < 0)
235  clib_unix_warning ("disable ioctl");
236 
237  if (pt->perf_event_pages[i])
238  {
239  if (munmap (pt->perf_event_pages[i], pm->page_size) < 0)
240  clib_unix_warning ("munmap");
241  pt->perf_event_pages[i] = 0;
242  }
243 
244  (void) close (pt->pm_fds[i]);
245  pt->pm_fds[i] = 0;
246  }
247 }
248 
249 static void
251 {
253 
257  worker_thread_start_event, 0 /* disable */ );
259 }
260 
261 static void
263 {
268  worker_thread_stop_event, 0 /* disable */ );
269  disable_events (pm);
270 }
271 
272 static void
274 {
275  int i;
276  int last_set;
277  int all = 0;
278  pm->current_event = 0;
279 
280  if (vec_len (pm->single_events_to_collect) == 0)
281  {
282  pm->state = PERFMON_STATE_OFF;
283  return;
284  }
285 
286  last_set = clib_bitmap_last_set (pm->thread_bitmap);
287  all = (last_set == ~0);
288 
290  clear_counters (pm);
291 
292  /* Start collection on thread 0? */
293  if (all || clib_bitmap_get (pm->thread_bitmap, 0))
294  {
295  /* Start collection on this thread */
297  }
298 
299  /* And also on worker threads */
300  for (i = 1; i < vec_len (vlib_mains); i++)
301  {
302  if (vlib_mains[i] == 0)
303  continue;
304 
305  if (all || clib_bitmap_get (pm->thread_bitmap, i))
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,
310  (void *) worker_thread_start_event, 1 /* enable */ );
311  }
312 }
313 
314 void
316 {
317  int i, j, k;
318  vlib_main_t *vm = pm->vlib_main;
319  vlib_main_t *stat_vm;
321  perfmon_counters_t *ctr;
322  perfmon_counters_t *ctrs;
323  perfmon_counters_t **ctr_dups = 0;
324  perfmon_thread_t *pt;
326  perfmon_event_config_t *current_event;
327  uword *p;
328  u8 *counter_name;
329  u32 len;
330 
331  /* snapshoot the nodes, including pm counters */
333 
334  for (j = 0; j < vec_len (vlib_mains); j++)
335  {
336  stat_vm = vlib_mains[j];
337  if (stat_vm == 0)
338  continue;
339 
340  pt = pm->threads[j];
341  len = vec_len (pt->counters);
342  ctrs = 0;
343  if (len)
344  {
345  vec_validate (ctrs, len - 1);
346  clib_memcpy (ctrs, pt->counters, len * sizeof (pt->counters[0]));
347  clib_memset (pt->counters, 0, len * sizeof (pt->counters[0]));
348  }
349  vec_add1 (ctr_dups, ctrs);
350  }
351 
353 
354  for (j = 0; j < vec_len (vlib_mains); j++)
355  {
356  stat_vm = vlib_mains[j];
357  if (stat_vm == 0)
358  continue;
359 
360  pt = pm->threads[j];
361  ctrs = ctr_dups[j];
362 
363  for (i = 0; i < vec_len (ctrs); i++)
364  {
365  u8 *capture_name;
366 
367  ctr = &ctrs[i];
368  nm = &stat_vm->node_main;
369 
370  if (ctr->ticks[0] == 0 && ctr->ticks[1] == 0)
371  continue;
372 
373  for (k = 0; k < 2; k++)
374  {
375  /*
376  * We collect 2 counters at once, except for the
377  * last counter when the user asks for an odd number of
378  * counters
379  */
380  if ((pm->current_event + k)
382  break;
383 
384  capture_name = format (0, "t%d-%v%c", j, nm->nodes[i]->name, 0);
385 
387  capture_name);
388 
389  if (p == 0)
390  {
391  pool_get (pm->capture_pool, c);
392  memset (c, 0, sizeof (*c));
393  c->thread_and_node_name = capture_name;
395  capture_name, c - pm->capture_pool);
396  }
397  else
398  {
399  c = pool_elt_at_index (pm->capture_pool, p[0]);
400  vec_free (capture_name);
401  }
402 
403  /* Snapshoot counters, etc. into the capture */
404  current_event = pm->single_events_to_collect
405  + pm->current_event + k;
406  counter_name = (u8 *) current_event->name;
407 
408  vec_add1 (c->counter_names, counter_name);
409  vec_add1 (c->counter_values, ctr->ticks[k]);
410  vec_add1 (c->vectors_this_counter, ctr->vectors);
411  }
412  }
413  vec_free (ctrs);
414  }
415  vec_free (ctr_dups);
416 }
417 
418 static void
420 {
421  int i;
422  int last_set, all;
423 
424  last_set = clib_bitmap_last_set (pm->thread_bitmap);
425  all = (last_set == ~0);
426 
427  if (all || clib_bitmap_get (pm->thread_bitmap, 0))
428  disable_events (pm);
429 
430  /* And also on worker threads */
431  for (i = 1; i < vec_len (vlib_mains); i++)
432  {
433  if (vlib_mains[i] == 0)
434  continue;
435  if (all || clib_bitmap_get (pm->thread_bitmap, i))
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,
440  (void *) worker_thread_stop_event, 1 /* enable */ );
441  }
442 
443  /* Make sure workers have stopped collection */
444  if (i > 1)
445  {
446  f64 deadman = vlib_time_now (vm) + 1.0;
447 
448  for (i = 1; i < vec_len (vlib_mains); i++)
449  {
450  /* Has the worker actually stopped collecting data? */
454  {
455  if (vlib_time_now (vm) > deadman)
456  {
457  clib_warning ("Thread %d deadman timeout!", i);
458  break;
459  }
460  vlib_process_suspend (pm->vlib_main, 1e-3);
461  }
462  }
463  }
465  pm->current_event += pm->n_active;
467  {
468  pm->current_event = 0;
469  pm->state = PERFMON_STATE_OFF;
470  return;
471  }
472 
473  if (all || clib_bitmap_get (pm->thread_bitmap, 0))
475 
476  /* And also on worker threads */
477  for (i = 1; i < vec_len (vlib_mains); i++)
478  {
479  if (vlib_mains[i] == 0)
480  continue;
481  if (all || clib_bitmap_get (pm->thread_bitmap, i))
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,
486  worker_thread_start_event, 0 /* disable */ );
487  }
488 }
489 
490 static uword
493 {
495  f64 now;
496  uword *event_data = 0;
497  uword event_type;
498  int i;
499 
500  while (1)
501  {
502  if (pm->state == PERFMON_STATE_RUNNING)
504  else
506 
507  now = vlib_time_now (vm);
508 
509  event_type = vlib_process_get_events (vm, (uword **) & event_data);
510 
511  switch (event_type)
512  {
513  case PERFMON_START:
514  for (i = 0; i < vec_len (event_data); i++)
515  start_event (pm, now, event_data[i]);
516  break;
517 
518  /* Handle timeout */
519  case ~0:
520  handle_timeout (vm, pm, now);
521  break;
522 
523  default:
524  clib_warning ("Unexpected event %d", event_type);
525  break;
526  }
527  vec_reset_length (event_data);
528  }
529  return 0; /* or not */
530 }
531 
532 /* *INDENT-OFF* */
534 {
535  .function = perfmon_periodic_process,
536  .type = VLIB_NODE_TYPE_PROCESS,
537  .name = "perfmon-periodic-process",
538 };
539 /* *INDENT-ON* */
540 
541 /*
542  * fd.io coding-style-patch-verification: ON
543  *
544  * Local Variables:
545  * eval: (c-set-style "gnu")
546  * End:
547  */
vec_reset_length
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Definition: vec_bootstrap.h:194
vlib.h
vlib_main_t::cpu_id
u32 cpu_id
Definition: main.h:216
vlib_worker_thread_barrier_release
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
Definition: threads.c:1375
scrape_and_clear_counters
void scrape_and_clear_counters(perfmon_main_t *pm)
Definition: perfmon_periodic.c:315
perfmon_counters_t::ticks
u64 ticks[2]
Definition: perfmon.h:81
handle_timeout
static void handle_timeout(vlib_main_t *vm, perfmon_main_t *pm, f64 now)
Definition: perfmon_periodic.c:419
disable_events
static void disable_events(perfmon_main_t *pm)
Definition: perfmon_periodic.c:218
perfmon_counters_t
Definition: perfmon.h:79
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vlib_process_wait_for_event
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
Definition: node_funcs.h:660
f
vlib_frame_t * f
Definition: interface_output.c:1098
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
perfmon_main_t
Definition: perfmon.h:164
perfmon_main
perfmon_main_t perfmon_main
Definition: perfmon.c:27
clib_callback_data_remove
#define clib_callback_data_remove(set_, fp_)
Remove a callback from the specified callback set.
Definition: callback_data.h:84
vlib_main_t::node_main
vlib_node_main_t node_main
Definition: main.h:173
hash_set_mem
#define hash_set_mem(h, key, value)
Definition: hash.h:275
perfmon_main_t::capture_pool
perfmon_capture_t * capture_pool
Definition: perfmon.h:114
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
VLIB_NODE_RUNTIME_PERF_BEFORE
@ VLIB_NODE_RUNTIME_PERF_BEFORE
Definition: main.h:68
node_index
node node_index
Definition: interface_output.c:440
vlib_node_runtime_perf_callback_args_t::packets
uword packets
Definition: main.h:78
perfmon_main_t::page_size
u32 page_size
Definition: perfmon.h:142
VLIB_NODE_RUNTIME_PERF_RESET
@ VLIB_NODE_RUNTIME_PERF_RESET
Definition: main.h:70
vlib_frame_t
Definition: node.h:372
worker_thread_stop_event
static void worker_thread_stop_event(vlib_main_t *vm)
Definition: perfmon_periodic.c:262
clib_unix_warning
#define clib_unix_warning(format, args...)
Definition: error.h:68
clib_callback_data_enable_disable
#define clib_callback_data_enable_disable(set_, fp_, ena_)
Enable/Disable the specified callback.
Definition: callback_data.h:189
perfmon_main_t::n_active
int n_active
Definition: perfmon.h:140
perfmon_thread_t::pm_fds
int pm_fds[2]
Definition: perfmon.h:93
vlib_process_get_events
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,...
Definition: node_funcs.h:583
vlib_node_runtime_perf_callback_args_t::node
vlib_node_runtime_t * node
Definition: main.h:76
perfmon_event_config_t::name
char * name
Definition: perfmon.h:54
clear_counters
static void clear_counters(perfmon_main_t *pm)
Definition: perfmon_periodic.c:87
pid
u32 pid
Definition: dhcp.api:164
perfmon_main_t::current_event
u32 current_event
Definition: perfmon.h:139
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
perfmon_thread_t::rdpmc_indices
u32 rdpmc_indices[2]
Definition: perfmon.h:98
clib_bitmap_get
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
Definition: bitmap.h:197
len
u8 len
Definition: ip_types.api:103
error.h
perfmon_main_t::vlib_main
vlib_main_t * vlib_main
Definition: perfmon.h:154
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
perfmon_main_t::timeout_interval
f64 timeout_interval
Definition: perfmon.h:136
perfmon_thread_t::perf_event_pages
u8 * perf_event_pages[2]
Definition: perfmon.h:96
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
vlib_worker_thread_barrier_sync
#define vlib_worker_thread_barrier_sync(X)
Definition: threads.h:173
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
perfmon_main_t::single_events_to_collect
perfmon_event_config_t * single_events_to_collect
Definition: perfmon.h:126
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
vlib_node_runtime_perf_callback_data_t
Definition: main.h:89
uword
u64 uword
Definition: types.h:112
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
vlib_main_t::thread_index
u32 thread_index
Definition: main.h:215
worker_thread_start_event
static void worker_thread_start_event(vlib_main_t *vm)
Definition: perfmon_periodic.c:250
f64
double f64
Definition: types.h:142
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
perfmon_main_t::state
volatile u8 state
Definition: perfmon.h:111
vlib_node_runtime_perf_callback_data_t::fp
vlib_node_runtime_perf_callback_fp_t fp
Definition: main.h:91
perfmon_thread_t
Definition: perfmon.h:85
read_current_perf_counters
static void read_current_perf_counters(vlib_node_runtime_perf_callback_data_t *data, vlib_node_runtime_perf_callback_args_t *args)
Definition: perfmon_periodic.c:36
pe
uword pe(void *v)
GDB callable function: pe - call pool_elts - number of elements in a pool.
Definition: gdb_funcs.c:64
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_node_runtime_perf_callback_args_t::vm
struct vlib_main_t * vm
Definition: main.h:75
perfmon_counters_t::vectors
u64 vectors
Definition: perfmon.h:82
vlib_main_t::vlib_node_runtime_perf_callbacks
vlib_node_runtime_perf_callback_set_t vlib_node_runtime_perf_callbacks
Definition: main.h:134
data
u8 data[128]
Definition: ipsec_types.api:95
perf_event_open
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags)
Definition: perfmon_periodic.c:26
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
perfmon_thread_t::c
u64 c[2]
Definition: perfmon.h:90
index
u32 index
Definition: flow_types.api:221
perfmon_periodic_process
static uword perfmon_periodic_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: perfmon_periodic.c:491
vlib_node_runtime_t::node_index
u32 node_index
Node index.
Definition: node.h:478
vlib_main_t::worker_thread_main_loop_callback_tmp
void(**volatile worker_thread_main_loop_callback_tmp)(struct vlib_main_t *, u64 t)
Definition: main.h:229
perfmon_periodic_node
vlib_node_registration_t perfmon_periodic_node
(constructor) VLIB_REGISTER_NODE (perfmon_periodic_node)
Definition: perfmon_periodic.c:533
perfmon_thread_t::counters
perfmon_counters_t * counters
Definition: perfmon.h:101
u64
unsigned long u64
Definition: types.h:89
vlib_process_wait_for_event_or_clock
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...
Definition: node_funcs.h:755
format
description fragment has unexpected format
Definition: map.api:433
vlib_node_runtime_perf_callback_args_t::call_type
vlib_node_runtime_perf_call_type_t call_type
Definition: main.h:80
vlib_process_suspend
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
Definition: node_funcs.h:486
perfmon_main_t::capture_by_thread_and_node_name
uword * capture_by_thread_and_node_name
Definition: perfmon.h:115
u32
unsigned int u32
Definition: types.h:88
perfmon_event_config_t
Definition: perfmon.h:52
CLIB_MEM_UNPOISON
#define CLIB_MEM_UNPOISON(a, s)
Definition: sanitizer.h:114
perfmon_capture_t
Definition: perfmon.h:65
enable_current_events
static void enable_current_events(perfmon_main_t *pm)
Definition: perfmon_periodic.c:115
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
nm
nat44_ei_main_t * nm
Definition: nat44_ei_hairpinning.c:413
vlib_main_t::worker_thread_main_loop_callback_lock
clib_spinlock_t worker_thread_main_loop_callback_lock
Definition: main.h:230
now
f64 now
Definition: nat44_ei_out2in.c:710
vlib_node_runtime_perf_callback_data_t::u
u64 u
Definition: main.h:95
clib_bitmap_last_set
static uword clib_bitmap_last_set(uword *ai)
Return the higest numbered set bit in a bitmap.
Definition: bitmap.h:410
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
u8
unsigned char u8
Definition: types.h:56
rt
vnet_interface_output_runtime_t * rt
Definition: interface_output.c:419
start_event
static void start_event(perfmon_main_t *pm, f64 now, uword event_data)
Definition: perfmon_periodic.c:273
i
int i
Definition: flowhash_template.h:376
PERFMON_START
#define PERFMON_START
Definition: perfmon.h:167
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
vlib_main_t::worker_thread_main_loop_callbacks
void(**volatile worker_thread_main_loop_callbacks)(struct vlib_main_t *, u64 t)
Definition: main.h:227
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:327
perfmon_main_t::threads
perfmon_thread_t ** threads
Definition: perfmon.h:148
vlib_node_main_t
Definition: node.h:665
PERFMON_STATE_RUNNING
@ PERFMON_STATE_RUNNING
Definition: perfmon.h:62
vlib_node_runtime_t
Definition: node.h:454
perfmon_main_t::thread_bitmap
uword * thread_bitmap
Definition: perfmon.h:145
clib_callback_enable_disable
#define clib_callback_enable_disable(h, tmp, l, f, enable)
Add or remove a callback to the specified callback set.
Definition: callback.h:38
vlib_node_runtime_perf_callback_args_t
Definition: main.h:73
PERFMON_STATE_OFF
@ PERFMON_STATE_OFF
Definition: perfmon.h:61
clib_callback_data_is_set
#define clib_callback_data_is_set(set_, fp_)
Check if callback is set.
Definition: callback_data.h:231
VLIB_NODE_RUNTIME_PERF_AFTER
@ VLIB_NODE_RUNTIME_PERF_AFTER
Definition: main.h:69
clib_callback_data_add
#define clib_callback_data_add(set_, value_)
Add a callback to the specified callback set.
Definition: callback_data.h:57
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105