FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
tw_timer_template.c File Reference

TW timer implementation TEMPLATE ONLY, do not compile directly. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static u32 TW() make_internal_timer_handle (u32 pool_index, u32 timer_id)
 
static void timer_addhead (TWT(tw_timer) *pool, u32 head_index, u32 new_index)
 
static void timer_remove (TWT(tw_timer) *pool, TWT(tw_timer) *elt)
 
static void timer_add (TWT(tw_timer_wheel) *tw, TWT(tw_timer) *t, u64 interval)
 
u32 TW() tw_timer_start (TWT(tw_timer_wheel) *tw, u32 user_id, u32 timer_id, u64 interval)
 Start a Tw Timer. More...
 
void TW() tw_timer_stop (TWT(tw_timer_wheel) *tw, u32 handle)
 Stop a tw timer. More...
 
int TW() tw_timer_handle_is_free (TWT(tw_timer_wheel) *tw, u32 handle)
 
void TW() tw_timer_update (TWT(tw_timer_wheel) *tw, u32 handle, u64 interval)
 Update a tw timer. More...
 
void TW() tw_timer_wheel_init (TWT(tw_timer_wheel) *tw, void *expired_timer_callback, f64 timer_interval_in_seconds, u32 max_expirations)
 Initialize a tw timer wheel template instance. More...
 
void TW() tw_timer_wheel_free (TWT(tw_timer_wheel) *tw)
 Free a tw timer wheel template instance. More...
 
static u32 *TW() tw_timer_expire_timers_internal (TWT(tw_timer_wheel) *tw, f64 now, u32 *callback_vector_arg)
 Advance a tw timer wheel. More...
 
u32 *TW() tw_timer_expire_timers (TWT(tw_timer_wheel) *tw, f64 now)
 
u32 *TW() tw_timer_expire_timers_vec (TWT(tw_timer_wheel) *tw, f64 now, u32 *vec)
 

Detailed Description

TW timer implementation TEMPLATE ONLY, do not compile directly.

Definition in file tw_timer_template.c.

Function Documentation

◆ make_internal_timer_handle()

static u32 TW() make_internal_timer_handle ( u32  pool_index,
u32  timer_id 
)
inlinestatic

Definition at line 103 of file tw_timer_template.c.

+ Here is the caller graph for this function:

◆ timer_add()

static void timer_add ( TWT(tw_timer_wheel) *  tw,
TWT(tw_timer) *  t,
u64  interval 
)
inlinestatic

Definition at line 161 of file tw_timer_template.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ timer_addhead()

static void timer_addhead ( TWT(tw_timer) *  pool,
u32  head_index,
u32  new_index 
)
inlinestatic

Definition at line 119 of file tw_timer_template.c.

+ Here is the caller graph for this function:

◆ timer_remove()

static void timer_remove ( TWT(tw_timer) *  pool,
TWT(tw_timer) *  elt 
)
inlinestatic

Definition at line 145 of file tw_timer_template.c.

+ Here is the caller graph for this function:

◆ tw_timer_expire_timers()

u32* TW() tw_timer_expire_timers ( TWT(tw_timer_wheel) *  tw,
f64  now 
)

Definition at line 806 of file tw_timer_template.c.

+ Here is the call graph for this function:

◆ tw_timer_expire_timers_internal()

static u32* TW() tw_timer_expire_timers_internal ( TWT(tw_timer_wheel) *  tw,
f64  now,
u32 callback_vector_arg 
)
inlinestatic

Advance a tw timer wheel.

Calls the expired timer callback as needed. This routine should be called once every timer_interval seconds

Parameters
tw_timer_wheel_t* tw timer wheel template instance pointer
f64now the current time, e.g. from vlib_time_now(vm)
Returns
u32 * vector of expired user handles

Definition at line 504 of file tw_timer_template.c.

+ Here is the caller graph for this function:

◆ tw_timer_expire_timers_vec()

u32* TW() tw_timer_expire_timers_vec ( TWT(tw_timer_wheel) *  tw,
f64  now,
u32 vec 
)

Definition at line 811 of file tw_timer_template.c.

+ Here is the call graph for this function:

◆ tw_timer_handle_is_free()

int TW() tw_timer_handle_is_free ( TWT(tw_timer_wheel) *  tw,
u32  handle 
)

Definition at line 379 of file tw_timer_template.c.

◆ tw_timer_start()

u32 TW() tw_timer_start ( TWT(tw_timer_wheel) *  tw,
u32  user_id,
u32  timer_id,
u64  interval 
)

Start a Tw Timer.

Parameters
tw_timer_wheel_t* tw timer wheel object pointer
u32user_id user defined timer id, presumably for a tw session
u32timer_id app-specific timer ID. 4 bits.
u64interval timer interval in ticks
Returns
handle needed to cancel the timer

Definition at line 296 of file tw_timer_template.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tw_timer_stop()

void TW() tw_timer_stop ( TWT(tw_timer_wheel) *  tw,
u32  handle 
)

Stop a tw timer.

Parameters
tw_timer_wheel_t* tw timer wheel object pointer
u32handle timer cancellation returned by tw_timer_start

Definition at line 352 of file tw_timer_template.c.

+ Here is the call graph for this function:

◆ tw_timer_update()

void TW() tw_timer_update ( TWT(tw_timer_wheel) *  tw,
u32  handle,
u64  interval 
)

Update a tw timer.

Parameters
tw_timer_wheel_t* tw timer wheel object pointer
u32handle timer returned by tw_timer_start
u32interval timer interval in ticks

Definition at line 390 of file tw_timer_template.c.

+ Here is the call graph for this function:

◆ tw_timer_wheel_free()

void TW() tw_timer_wheel_free ( TWT(tw_timer_wheel) *  tw)

Free a tw timer wheel template instance.

Parameters
tw_timer_wheel_t* tw timer wheel object pointer

Definition at line 454 of file tw_timer_template.c.

+ Here is the call graph for this function:

◆ tw_timer_wheel_init()

void TW() tw_timer_wheel_init ( TWT(tw_timer_wheel) *  tw,
void *  expired_timer_callback,
f64  timer_interval_in_seconds,
u32  max_expirations 
)

Initialize a tw timer wheel template instance.

Parameters
tw_timer_wheel_t* tw timer wheel object pointer
void* expired_timer_callback. Passed a u32 * vector of expired timer handles. The callback is optional.
f64timer_interval_in_seconds

Definition at line 407 of file tw_timer_template.c.

+ Here is the call graph for this function: