net: Make sure timer fiber does not print stack usage too often
Sometimes the timer fiber was flooding stack usage to console. Change-Id: I3518cc08f3c8d3ed8ccc19e7bbb6356811e28ab7 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
0cb73a1b9c
commit
9f8ed3a6e0
1 changed files with 17 additions and 6 deletions
|
@ -669,17 +669,28 @@ static void net_timer_fiber(void)
|
||||||
|
|
||||||
#ifdef CONFIG_INIT_STACKS
|
#ifdef CONFIG_INIT_STACKS
|
||||||
{
|
{
|
||||||
static clock_time_t last_print;
|
#define PRINT_CYCLE (10 * sys_clock_hw_cycles_per_sec)
|
||||||
|
|
||||||
|
static clock_time_t next_print;
|
||||||
|
uint32_t cycle = clock_get_cycle();
|
||||||
|
|
||||||
/* Print stack usage every 10 sec */
|
/* Print stack usage every 10 sec */
|
||||||
if (!last_print ||
|
if (!next_print ||
|
||||||
(last_print +
|
(next_print < cycle &&
|
||||||
10 * sys_clock_hw_cycles_per_sec) <
|
(!((cycle - next_print) > PRINT_CYCLE)))) {
|
||||||
clock_get_cycle()) {
|
clock_time_t new_print;
|
||||||
|
|
||||||
net_analyze_stack("timer fiber",
|
net_analyze_stack("timer fiber",
|
||||||
timer_fiber_stack,
|
timer_fiber_stack,
|
||||||
sizeof(timer_fiber_stack));
|
sizeof(timer_fiber_stack));
|
||||||
last_print = clock_get_cycle() + 1;
|
new_print = cycle + PRINT_CYCLE;
|
||||||
|
if (new_print > cycle) {
|
||||||
|
next_print = new_print;
|
||||||
|
} else {
|
||||||
|
/* Overflow */
|
||||||
|
next_print = PRINT_CYCLE -
|
||||||
|
(0xffffffff - cycle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue