summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/stackchk
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-31 13:37:59 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 08:46:47 +0100
commitd271c3bb78f86dd9417a964b019b8e38911064fa (patch)
tree3c36b87c580464cc7f1e5aec89e1137a68759da3 /cpukit/libmisc/stackchk
parentposix: Fix timer interval (diff)
downloadrtems-d271c3bb78f86dd9417a964b019b8e38911064fa.tar.bz2
rtems: Add rtems_task_iterate()
Update #2423.
Diffstat (limited to 'cpukit/libmisc/stackchk')
-rw-r--r--cpukit/libmisc/stackchk/check.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index ae4ae79ed8..4c48c5bde3 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -352,23 +352,20 @@ static inline void *Stack_check_find_high_water_mark(
*
* Try to print out how much stack was actually used by the task.
*/
-static const rtems_printer* printer;
-
-static void Stack_check_Dump_threads_usage(
- Thread_Control *the_thread
+static bool Stack_check_Dump_threads_usage(
+ Thread_Control *the_thread,
+ void *arg
)
{
- uint32_t size, used;
- void *low;
- void *high_water_mark;
- void *current;
- Stack_Control *stack;
- char name[5];
+ uint32_t size, used;
+ void *low;
+ void *high_water_mark;
+ void *current;
+ Stack_Control *stack;
+ char name[5];
+ const rtems_printer *printer;
- /*
- * The pointer passed in for the_thread is guaranteed to be non-NULL from
- * rtems_iterate_over_all_threads() so no need to check it here.
- */
+ printer = arg;
/*
* Obtain interrupt stack information
@@ -376,7 +373,7 @@ static void Stack_check_Dump_threads_usage(
#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
if (the_thread == (Thread_Control *) -1) {
if (!Stack_check_Interrupt_stack.area)
- return;
+ return false;
stack = &Stack_check_Interrupt_stack;
the_thread = 0;
current = 0;
@@ -430,7 +427,7 @@ static void Stack_check_Dump_threads_usage(
rtems_printf( printer, "%8" PRId32 "\n", used );
}
-
+ return false;
}
/*
@@ -453,25 +450,26 @@ static void Stack_check_Dump_threads_usage(
*/
void rtems_stack_checker_report_usage_with_plugin(
- const rtems_printer* printer_
+ const rtems_printer* printer
)
{
- if ( printer != NULL || ! rtems_print_printer_valid ( printer_ ) )
- return;
-
- printer = printer_;
-
rtems_printf( printer, "Stack usage by thread\n");
rtems_printf( printer,
" ID NAME LOW HIGH CURRENT AVAILABLE USED\n"
);
/* iterate over all threads and dump the usage */
- rtems_iterate_over_all_threads( Stack_check_Dump_threads_usage );
+ rtems_task_iterate(
+ Stack_check_Dump_threads_usage,
+ RTEMS_DECONST( rtems_printer *, printer )
+ );
#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
/* dump interrupt stack info if any */
- Stack_check_Dump_threads_usage((Thread_Control *) -1);
+ Stack_check_Dump_threads_usage(
+ (Thread_Control *) -1,
+ RTEMS_DECONST( rtems_printer *, printer )
+ );
#endif
printer = NULL;