|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
17 #error do not include tw_timer_template.h directly
25 #define _twt(a,b) a##b##_t
26 #define __twt(a,b) _twt(a,b)
27 #define TWT(a) __twt(a,TW_SUFFIX)
30 #define __tw(a,b) _tw(a,b)
31 #define TW(a) __tw(a,TW_SUFFIX)
114 #if (TW_TIMER_WHEELS != 1 && TW_TIMER_WHEELS != 2 && TW_TIMER_WHEELS != 3)
115 #error TW_TIMER_WHEELS must be 1, 2 or 3
128 #if (TW_TIMER_WHEELS == 3)
130 u16 fast_ring_offset;
132 u16 slow_ring_offset;
134 #if (TW_TIMER_WHEELS == 2)
136 u16 fast_ring_offset;
142 #if (TW_OVERFLOW_VECTOR > 0)
155 #ifndef __defined_tw_timer_wheel_slot__
156 #define __defined_tw_timer_wheel_slot__
183 TWT (tw_timer) * timers;
206 #if TW_OVERFLOW_VECTOR > 0
210 #if TW_FAST_WHEEL_BITMAP > 0
212 uword *fast_slot_bitmap;
225 #if TW_START_STOP_TRACE_SIZE > 0
229 TWT (
trace) traces[TW_START_STOP_TRACE_SIZE];
232 }
TWT (tw_timer_wheel);
244 f64 timer_interval,
u32 max_expirations);
251 #if TW_FAST_WHEEL_BITMAP
252 u32 TW (tw_timer_first_expires_in_ticks) (
TWT (tw_timer_wheel) * tw);
255 #if TW_START_STOP_TRACE_SIZE > 0
256 void TW (tw_search_trace) (
TWT (tw_timer_wheel) * tw,
u32 handle);
257 void TW (tw_timer_trace) (
TWT (tw_timer_wheel) * tw,
u32 timer_id,
258 u32 pool_index,
u32 handle);
f64 next_run_time
Next time the wheel should run.
typedef CLIB_PACKED(struct { u8 timer_id;u32 pool_index;u32 handle;}) TWT(trace)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
u64 current_tick
current tick
u32 *TW() tw_timer_expire_timers(TWT(tw_timer_wheel) *tw, f64 now)
void TW() tw_timer_stop(TWT(tw_timer_wheel) *tw, u32 handle)
Stop a tw timer.
u32 TW() tw_timer_start(TWT(tw_timer_wheel) *tw, u32 pool_index, u32 timer_id, u64 interval)
Start a Tw Timer.
u32 head_index
Listhead of timers which expire in this interval.
u32 * expired_timer_handles
vectors of expired timers
f64 last_run_time
Last time the wheel ran.
f64 ticks_per_second
Timer ticks per second.
void TW() tw_timer_update(TWT(tw_timer_wheel) *tw, u32 handle, u64 interval)
Update a tw timer.
int TW() tw_timer_handle_is_free(TWT(tw_timer_wheel) *tw, u32 handle)
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
#define TW_SLOTS_PER_RING
static void expired_timer_callback(u32 *expired_timers)
@ TW_TIMER_RING_FAST
Fast timer ring ID.
u32 next
next, previous pool indices
@ TW_TIMER_RING_GLACIER
Glacier ring ID.
u32 *TW() tw_timer_expire_timers_vec(TWT(tw_timer_wheel) *tw, f64 now, u32 *vec)
u32 user_handle
user timer handle
u32 max_expirations
maximum expirations
u8 pad[3]
log2 (size of the packing page block)
@ TW_TIMER_RING_SLOW
Slow timer ring ID.
void TW() tw_timer_wheel_free(TWT(tw_timer_wheel) *tw)
Free a tw timer wheel template instance.
void TW() tw_timer_wheel_init(TWT(tw_timer_wheel) *tw, void *expired_timer_callback, f64 timer_interval, u32 max_expirations)
Initialize a tw timer wheel template instance.
f64 timer_interval
Timer interval, also needed to avoid fp divide in speed path.