From ce4919069bac9400ada191de37062305260a79c8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 24 Feb 2016 17:44:59 +0200 Subject: net: Print the stack usage in timer fiber less often If enabled, the stack usage is now printed every 60 secs. Also changing the code to use the kernel ticks clock API. Change-Id: I44eabd0c372dfb8983ef379e12e38e5bf94a99d2 Signed-off-by: Jukka Rissanen --- net/ip/net_core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/ip/net_core.c b/net/ip/net_core.c index 77f4041e7..70dcacd16 100644 --- a/net/ip/net_core.c +++ b/net/ip/net_core.c @@ -681,27 +681,27 @@ static void net_timer_fiber(void) #ifdef CONFIG_INIT_STACKS { -#define PRINT_CYCLE (10 * sys_clock_hw_cycles_per_sec) +#define PRINT_CYCLE (60 * sys_clock_ticks_per_sec) - static clock_time_t next_print; - uint32_t cycle = clock_get_cycle(); + static uint32_t next_print; + uint32_t curr = sys_tick_get_32(); - /* Print stack usage every 10 sec */ + /* Print stack usage every n. sec */ if (!next_print || - (next_print < cycle && - (!((cycle - next_print) > PRINT_CYCLE)))) { - clock_time_t new_print; + (next_print < curr && + (!((curr - next_print) > PRINT_CYCLE)))) { + uint32_t new_print; net_analyze_stack("timer fiber", timer_fiber_stack, sizeof(timer_fiber_stack)); - new_print = cycle + PRINT_CYCLE; - if (new_print > cycle) { + new_print = curr + PRINT_CYCLE; + if (new_print > curr) { next_print = new_print; } else { /* Overflow */ next_print = PRINT_CYCLE - - (0xffffffff - cycle); + (0xffffffff - curr); } } } -- cgit v1.2.3