mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
Debug - OS stacks - show current stack usage too
Change-Id: I41f895786e409c3f4ea500f99eb74cbd6cdbe5b6
This commit is contained in:
parent
c5d3468be6
commit
856da7f366
3 changed files with 10 additions and 4 deletions
|
@ -152,7 +152,7 @@ static const char* threads_getname(int selected_item, void *data,
|
|||
{
|
||||
struct core_debug_info coreinfo;
|
||||
core_get_debug_info(selected_item, &coreinfo);
|
||||
snprintf(buffer, buffer_len, "Idle (%d): %2d%%", selected_item,
|
||||
snprintf(buffer, buffer_len, "Idle (%2d): %2d%%", selected_item,
|
||||
coreinfo.idle_stack_usage);
|
||||
return buffer;
|
||||
}
|
||||
|
@ -165,8 +165,8 @@ static const char* threads_getname(int selected_item, void *data,
|
|||
struct thread_debug_info threadinfo;
|
||||
if (thread_get_debug_info(selected_item, &threadinfo) > 0)
|
||||
{
|
||||
fmtstr = "%2d:" IF_COP(" (%d)") " %s%n" IF_PRIO(" %d %d")
|
||||
IFN_SDL(" %2d%%") " %s";
|
||||
fmtstr = "%2d:" IF_COP(" (%d)") " %s%n" IF_PRIO(" %2d %2d")
|
||||
IFN_SDL(" %2d%% %2d%%") " %s";
|
||||
}
|
||||
int status_len;
|
||||
size_t len = snprintf(buffer, buffer_len, fmtstr,
|
||||
|
@ -175,7 +175,7 @@ static const char* threads_getname(int selected_item, void *data,
|
|||
threadinfo.statusstr,
|
||||
&status_len,
|
||||
IF_PRIO(threadinfo.base_priority, threadinfo.current_priority,)
|
||||
IFN_SDL(threadinfo.stack_usage,)
|
||||
IFN_SDL(threadinfo.stack_usage_cur, threadinfo.stack_usage,)
|
||||
threadinfo.name);
|
||||
|
||||
int start = 0;
|
||||
|
|
|
@ -196,6 +196,7 @@ struct thread_debug_info
|
|||
char statusstr[4];
|
||||
char name[32];
|
||||
#ifndef HAVE_SDL_THREADS
|
||||
unsigned int stack_usage_cur;
|
||||
unsigned int stack_usage;
|
||||
#endif
|
||||
#if NUM_CORES > 1
|
||||
|
|
|
@ -306,6 +306,11 @@ int thread_get_debug_info(unsigned int thread_id,
|
|||
#endif
|
||||
#ifndef HAVE_SDL_THREADS
|
||||
infop->stack_usage = stack_usage(thread->stack, thread->stack_size);
|
||||
|
||||
size_t stack_used_current =
|
||||
thread->stack_size - (thread->context.sp - (uintptr_t)thread->stack);
|
||||
|
||||
infop->stack_usage_cur = stack_used_current * 100 / thread->stack_size;
|
||||
#endif
|
||||
#if NUM_CORES > 1
|
||||
infop->core = thread->core;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue