summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/stackchk/check.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-06 22:51:25 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-06 22:51:25 +0000
commit90a5d194a2712d7e28eafa1aac0b9fdb32e7b96b (patch)
tree251aff7b38cce4867fb2a77f5bbafa3b8ccb9785 /cpukit/libmisc/stackchk/check.c
parent2007-09-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-90a5d194a2712d7e28eafa1aac0b9fdb32e7b96b.tar.bz2
2007-09-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/Makefile.am, libcsupport/src/printk.c: * libcsupport/src/printk_plugin.c: New file. include/rtems/bspIo.h, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuuse.h, libmisc/stackchk/check.c, libmisc/stackchk/stackchk.h: rtems/include/rtems/rtems/ratemon.h, rtems/src/ratemonreportstatistics.c: Added capability to specify your own "printf" routine to various reporting functions. This added an XXX_with_plugin as the underlying implementation for + rtems_rate_monotonic_report_statistics + rtems_stack_checker_report_usage + rtems_cpu_usage_report As demonstration, the http netdemo can now print out stack and cpu usage reports.
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/stackchk/check.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index 3e0a39651a..5134936a3f 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -351,10 +351,13 @@ void *Stack_check_find_high_water_mark(
}
/*
- * Stack_check_Dump_threads_usage(
+ * Stack_check_Dump_threads_usage
*
* Try to print out how much stack was actually used by the task.
*/
+static void *print_context;
+static rtems_printk_plugin_t print_handler;
+
void Stack_check_Dump_threads_usage(
Thread_Control *the_thread
)
@@ -368,6 +371,9 @@ void Stack_check_Dump_threads_usage(
if ( !the_thread )
return;
+ if ( !print_handler )
+ return;
+
/*
* XXX HACK to get to interrupt stack
*/
@@ -402,7 +408,9 @@ void Stack_check_Dump_threads_usage(
name[ 4 ] = '\0';
}
- printk("0x%08" PRIx32 " %4s 0x%p - 0x%p %8" PRId32 " %8" PRId32 "\n",
+ (*print_handler)(
+ print_context,
+ "0x%08" PRIx32 " %4s 0x%p - 0x%p %8" PRId32 " %8" PRId32 "\n",
the_thread ? the_thread->Object.id : ~0,
name,
stack->area,
@@ -432,13 +440,19 @@ void Stack_check_Dump_threads_usage(
* rtems_stack_checker_report_usage
*/
-void rtems_stack_checker_report_usage( void )
+void rtems_stack_checker_report_usage_with_plugin(
+ void *context,
+ rtems_printk_plugin_t print
+)
{
if (Stack_check_Initialized == 0)
return;
- printk("Stack usage by thread\n");
- printk(
+ print_context = context;
+ print_handler = print;
+
+ (*print)( context, "Stack usage by thread\n");
+ (*print)( context,
" ID NAME LOW HIGH AVAILABLE USED\n"
);
@@ -447,4 +461,13 @@ void rtems_stack_checker_report_usage( void )
/* dump interrupt stack info if any */
Stack_check_Dump_threads_usage((Thread_Control *) -1);
+
+ print_context = NULL;
+ print_handler = NULL;
+
+}
+
+void rtems_stack_checker_report_usage( void )
+{
+ rtems_stack_checker_report_usage_with_plugin( NULL, printk_plugin );
}