/home/aaron/olsrd-current/olsrd/src/core/olsr_timer.c File Reference

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "common/avl.h"
#include "common/avl_comp.h"
#include "olsr_clock.h"
#include "olsr_logging.h"
#include "olsr_memcookie.h"
#include "olsr_timer.h"
Include dependency graph for olsr_timer.c:

Go to the source code of this file.

Functions

static uint32_t calc_jitter (unsigned int rel_time, uint8_t jitter_pct, unsigned int random_val)
void olsr_timer_init (void)
void olsr_timer_cleanup (void)
struct olsr_timer_infoolsr_timer_add (const char *name, timer_cb_func callback, bool periodic)
void olsr_timer_remove (struct olsr_timer_info *info)
struct olsr_timer_entryolsr_timer_start (unsigned int rel_time, uint8_t jitter_pct, void *context, struct olsr_timer_info *ti)
void olsr_timer_stop (struct olsr_timer_entry *timer)
void olsr_timer_change (struct olsr_timer_entry *timer, unsigned int rel_time, uint8_t jitter_pct)
void olsr_timer_set (struct olsr_timer_entry **timer_ptr, unsigned int rel_time, uint8_t jitter_pct, void *context, struct olsr_timer_info *ti)
void olsr_timer_walk (void)

Variables

static struct list_entity timer_wheel [TIMER_WHEEL_SLOTS]
static uint32_t timer_last_run
struct list_entity timerinfo_list
static struct olsr_memcookie_infotimer_mem_cookie = NULL
static struct olsr_memcookie_infotimerinfo_cookie = NULL

Function Documentation

static uint32_t calc_jitter ( unsigned int  rel_time,
uint8_t  jitter_pct,
unsigned int  random_val 
) [static]

Decrement a relative timer by a random number range.

Parameters:
the relative timer expressed in units of milliseconds.
the jitter in percent
cached result of random() at system init.
Returns:
the absolute timer

Definition at line 347 of file olsr_timer.c.

References LOG_TIMER, olsr_clock_getAbsolute(), and OLSR_DEBUG.

Referenced by olsr_timer_change(), and olsr_timer_start().

Here is the call graph for this function:

struct olsr_timer_info* olsr_timer_add ( const char *  name,
timer_cb_func  callback,
bool  periodic 
) [read]
void olsr_timer_change ( struct olsr_timer_entry timer,
unsigned int  rel_time,
uint8_t  jitter_pct 
)
void olsr_timer_cleanup ( void   ) 
void olsr_timer_init ( void   ) 

Init datastructures for maintaining timers.

Definition at line 70 of file olsr_timer.c.

References list_init_head(), LOG_SCHEDULER, olsr_clock_getNow(), OLSR_INFO, olsr_memcookie_add(), timer_last_run, timer_wheel, TIMER_WHEEL_SLOTS, and timerinfo_list.

Referenced by main().

Here is the call graph for this function:

void olsr_timer_remove ( struct olsr_timer_info info  ) 

Removes a group of timers from the scheduler All pointers to timers of this timer_info will be invalid after this.

Parameters:
info pointer to timer info

Definition at line 158 of file olsr_timer.c.

References list_for_each_element_safe, list_remove(), olsr_timer_info::name, olsr_timer_info::node, olsr_memcookie_free(), olsr_timer_stop(), olsr_timer_entry::timer_info, olsr_timer_entry::timer_list, timer_wheel, and TIMER_WHEEL_SLOTS.

Here is the call graph for this function:

void olsr_timer_set ( struct olsr_timer_entry **  timer_ptr,
unsigned int  rel_time,
uint8_t  jitter_pct,
void *  context,
struct olsr_timer_info ti 
)

This is the one stop shop for all sort of timer manipulation. Depending on the passed in parameters a new timer is started, or an existing timer is started or an existing timer is terminated.

Parameters:
timer_ptr pointer to timer_entry pointer
rel_time time until the new timer should fire, 0 to stop timer
jitter_pct jitter of timer in percent
context context pointer of timer
ti timer_info of timer

Definition at line 319 of file olsr_timer.c.

References olsr_timer_change(), olsr_timer_start(), and olsr_timer_stop().

Referenced by add_link_entry(), insert_new_name_in_list(), olsr_calculate_routing_table(), olsr_delete_tc_edge_entry(), olsr_input_tc(), olsr_set_link_timer(), olsr_set_mid_timer(), olsr_update_hna_entry(), olsr_update_packet_loss(), and update_link_entry().

Here is the call graph for this function:

struct olsr_timer_entry* olsr_timer_start ( unsigned int  rel_time,
uint8_t  jitter_pct,
void *  context,
struct olsr_timer_info ti 
) [read]
void olsr_timer_stop ( struct olsr_timer_entry timer  ) 
void olsr_timer_walk ( void   ) 

Variable Documentation

uint32_t timer_last_run [static]

Definition at line 56 of file olsr_timer.c.

Referenced by olsr_timer_init(), and olsr_timer_walk().

struct olsr_memcookie_info* timer_mem_cookie = NULL [static]

Definition at line 60 of file olsr_timer.c.

struct list_entity timer_wheel[TIMER_WHEEL_SLOTS] [static]
struct olsr_memcookie_info* timerinfo_cookie = NULL [static]

Definition at line 61 of file olsr_timer.c.

Definition at line 59 of file olsr_timer.c.

Referenced by olsr_timer_add(), olsr_timer_cleanup(), and olsr_timer_init().

Generated on Wed Jun 19 06:00:05 2013 for olsrd by  doxygen 1.6.3