diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2016-02-24 17:44:59 +0200 |
---|---|---|
committer | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2016-03-01 14:12:13 +0200 |
commit | ce4919069bac9400ada191de37062305260a79c8 (patch) | |
tree | 46c18f20513f8518c8c7ed490b67144451a09a7b | |
parent | 1aeca8d569f9e77b0a0df2c780f3d8ab0f97be85 (diff) |
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 <jukka.rissanen@linux.intel.com>
-rw-r--r-- | net/ip/net_core.c | 20 |
1 files 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); } } } |