thread_measure_stack_usage documentation
fix documentation - the return value is the opposite of what it said add and improve comments renamed space to space_free (the name is documentation as well)
This commit is contained in:
parent
c42aa8993f
commit
81608bdab5
@ -96,7 +96,7 @@ int thread_getlastpid(void);
|
||||
* Only works if the thread was created with the flag CREATE_STACKTEST.
|
||||
*
|
||||
* @param stack The stack you want to measure. try active_thread->stack_start.
|
||||
* @return The current usage (overwritten addresses) of the thread's stack
|
||||
* @return The amount of unused space of the thread's stack
|
||||
*/
|
||||
int thread_measure_stack_usage(char *stack);
|
||||
|
||||
|
||||
@ -113,13 +113,14 @@ int thread_measure_stack_usage(char *stack)
|
||||
{
|
||||
unsigned int *stackp = (unsigned int *)stack;
|
||||
|
||||
/* assumption that the comparison fails before or after end of stack */
|
||||
/* assume that the comparison fails before or after end of stack */
|
||||
/* assume that the stack grows "downwards" */
|
||||
while (*stackp == (unsigned int)stackp) {
|
||||
stackp++;
|
||||
}
|
||||
|
||||
int space = (unsigned int)stackp - (unsigned int)stack;
|
||||
return space;
|
||||
int space_free = (unsigned int)stackp - (unsigned int)stack;
|
||||
return space_free;
|
||||
}
|
||||
|
||||
int thread_create(char *stack, int stacksize, char priority, int flags, void (*function)(void), const char *name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user