Debug - OS stacks - show current stack usage too

Change-Id: I41f895786e409c3f4ea500f99eb74cbd6cdbe5b6
This commit is contained in:
William Wilgus 2025-02-27 12:34:30 -05:00 committed by Solomon Peachy
parent c5d3468be6
commit 856da7f366
3 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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;