From cd98b8b40ec6b238c4faf28b7f72038ec248851d Mon Sep 17 00:00:00 2001 From: Joakim Eriksson Date: Mon, 24 Aug 2015 11:42:50 +0200 Subject: [PATCH] added periodic debug printout of number of used neighbors and routes --- core/net/rpl/rpl-nbr-policy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/net/rpl/rpl-nbr-policy.c b/core/net/rpl/rpl-nbr-policy.c index 8c9a2ff21..34e67f946 100644 --- a/core/net/rpl/rpl-nbr-policy.c +++ b/core/net/rpl/rpl-nbr-policy.c @@ -68,6 +68,18 @@ static int num_free; static uip_ds6_nbr_t *worst_rank_nbr; /* the parent that has the worst rank */ static rpl_rank_t worst_rank; /*---------------------------------------------------------------------------*/ +#if DEBUG == DEBUG_FULL +static void update_nbr(void); +static struct ctimer periodic_timer; +static int timer_init = 0; +static void +handle_periodic_timer(void *ptr) +{ + update_nbr(); + ctimer_restart(&periodic_timer); +} +#endif /* DEBUG == DEBUG_FULL */ +/*---------------------------------------------------------------------------*/ static void update_nbr(void) { @@ -77,6 +89,14 @@ update_nbr(void) int is_used; rpl_rank_t rank; +#if DEBUG == DEBUG_FULL + if(!timer_init) { + timer_init = 1; + ctimer_set(&periodic_timer, 60 * CLOCK_SECOND, + &handle_periodic_timer, NULL); + } +#endif /* DEBUG == DEBUG_FULL */ + worst_rank = 0; worst_rank_nbr = NULL; num_used = 0;