Display the irq stack usage on the for the init thread (pid = 0)

This commit is contained in:
David Sidrane 2016-12-12 15:29:40 -10:00 committed by Lorenz Meier
parent 1781801151
commit 3eee469fbc

View File

@ -251,19 +251,23 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
);
}
unsigned stack_size = (uintptr_t)system_load.tasks[i].tcb->adj_stack_ptr -
(uintptr_t)system_load.tasks[i].tcb->stack_alloc_ptr;
unsigned stack_free = 0;
uint8_t *stack_sweeper = (uint8_t *)system_load.tasks[i].tcb->stack_alloc_ptr;
size_t stack_size = system_load.tasks[i].tcb->adj_stack_size;
ssize_t stack_free = 0;
while (stack_free < stack_size) {
if (*stack_sweeper++ != 0xff) {
break;
}
#if CONFIG_ARCH_INTERRUPTSTACK > 3
stack_free++;
if (system_load.tasks[i].tcb->pid == 0) {
stack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
stack_free = up_check_intstack_remain();
} else {
#endif
stack_free = up_check_tcbstack_remain(system_load.tasks[i].tcb);
#if CONFIG_ARCH_INTERRUPTSTACK > 3
}
#endif
dprintf(fd, "%s%4d %*-s %8lld %2d.%03d %5u/%5u %3u (%3u) ",
clear_line,
system_load.tasks[i].tcb->pid,
@ -274,7 +278,7 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
stack_size - stack_free,
stack_size,
system_load.tasks[i].tcb->sched_priority,
#if CONFIG_ARCH_BOARD_SIM
#if CONFIG_ARCH_BOARD_SIM || !defined(CONFIG_PRIORITY_INHERITANCE)
0);
#else
system_load.tasks[i].tcb->base_priority);
@ -283,6 +287,7 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
#if CONFIG_RR_INTERVAL > 0
/* print scheduling info with RR time slice */
dprintf(fd, " %6d\n", system_load.tasks[i].tcb->timeslice);
(void)tstate_name(TSTATE_TASK_INVALID); // Stop not used warning
#else
// print task state instead
dprintf(fd, " %-6s\n", tstate_name(system_load.tasks[i].tcb->task_state));