diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-07 17:46:25 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-07 17:46:25 +0000 |
commit | 694bd9f68e551cdfbda2e93a6fe260ffba5eff04 (patch) | |
tree | ecb0762ecdef60f4da46f0a700440a8069ecd3e3 | |
parent | 2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-694bd9f68e551cdfbda2e93a6fe260ffba5eff04.tar.bz2 |
2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am: Add new files.
* libmisc/shell/internal.h: Prototype for rtems_shell_print_heap_info()
* libmisc/shell/main_mallocinfo.c: Use rtems_shell_print_heap_info().
* libmisc/shell/shellconfig.h: Add wkspace command.
* libmisc/shell/main_wkspaceinfo.c,
libmisc/shell/print_heapinfo.c: New files.
-rw-r--r-- | cpukit/ChangeLog | 9 | ||||
-rw-r--r-- | cpukit/libmisc/Makefile.am | 3 | ||||
-rw-r--r-- | cpukit/libmisc/shell/internal.h | 15 | ||||
-rw-r--r-- | cpukit/libmisc/shell/main_mallocinfo.c | 4 | ||||
-rw-r--r-- | cpukit/libmisc/shell/main_wkspaceinfo.c | 52 | ||||
-rw-r--r-- | cpukit/libmisc/shell/print_heapinfo.c | 37 | ||||
-rw-r--r-- | cpukit/libmisc/shell/shellconfig.h | 9 |
7 files changed, 121 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 0bbbceefeb..96cf4bf85d 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,14 @@ 2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com> + * libmisc/Makefile.am: Add new files. + * libmisc/shell/internal.h: Prototype for rtems_shell_print_heap_info() + * libmisc/shell/main_mallocinfo.c: Use rtems_shell_print_heap_info(). + * libmisc/shell/shellconfig.h: Add wkspace command. + * libmisc/shell/main_wkspaceinfo.c, + libmisc/shell/print_heapinfo.c: New files. + +2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com> + * score/inline/rtems/score/isr.inl: Fix spacing. * score/src/apimutexallocate.c: Fix spacing. * score/src/coremsgseize.c: Check for message pending instead of diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am index 53c6e63964..9fd195f8dd 100644 --- a/cpukit/libmisc/Makefile.am +++ b/cpukit/libmisc/Makefile.am @@ -61,7 +61,6 @@ libmw_fb_a_SOURCES = mw-fb/mw_fb.c mw-fb/mw_uid.c mw-fb/mw_fb.h \ mw-fb/mw_uid.h ## shell - if LIBSHELL noinst_LIBRARIES += libshell.a if LIBNETWORKING @@ -86,7 +85,7 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \ shell/shell.h shell/shell_makeargs.c shell/str2int.c shell/write_file.c \ shell/utils-cp.c shell/err.c shell/errx.c shell/verr.c shell/verrx.c \ shell/vwarn.c shell/vwarnx.c shell/warn.c shell/warnx.c \ - shell/fts.c + shell/fts.c shell/print_heapinfo.c shell/main_wkspaceinfo.c endif EXTRA_DIST += shell/README diff --git a/cpukit/libmisc/shell/internal.h b/cpukit/libmisc/shell/internal.h index 1e4a4c88da..e542769b12 100644 --- a/cpukit/libmisc/shell/internal.h +++ b/cpukit/libmisc/shell/internal.h @@ -33,9 +33,16 @@ rtems_shell_topic_t * rtems_shell_lookup_topic(char * topic); void rtems_shell_register_monitor_commands(void); void rtems_shell_initialize_command_set(void); -int rtems_shell_libc_mounter (const char* driver, - const char* path, - rtems_shell_filesystems_t* fs, - rtems_filesystem_options_t options); +int rtems_shell_libc_mounter( + const char* driver, + const char* path, + rtems_shell_filesystems_t* fs, + rtems_filesystem_options_t options +); + +void rtems_shell_print_heap_info( + const char *c, + Heap_Information *h +); #endif diff --git a/cpukit/libmisc/shell/main_mallocinfo.c b/cpukit/libmisc/shell/main_mallocinfo.c index fa3c239ba4..001c3ea73b 100644 --- a/cpukit/libmisc/shell/main_mallocinfo.c +++ b/cpukit/libmisc/shell/main_mallocinfo.c @@ -49,8 +49,8 @@ int rtems_shell_main_malloc_info( region_information_block info; malloc_info( &info ); - printit( "free", &info.Free ); - printit( "used", &info.Used ); + rtems_shell_print_heap_info( "free", &info.Free ); + rtems_shell_print_heap_info( "used", &info.Used ); return 0; } else if ( !strcmp( argv[1], "stats" ) ) { malloc_report_statistics_with_plugin( diff --git a/cpukit/libmisc/shell/main_wkspaceinfo.c b/cpukit/libmisc/shell/main_wkspaceinfo.c new file mode 100644 index 0000000000..5defe8ae7d --- /dev/null +++ b/cpukit/libmisc/shell/main_wkspaceinfo.c @@ -0,0 +1,52 @@ +/* + * MALLOC_INFO Shell Command Implmentation + * + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <inttypes.h> + +#include <rtems.h> +#include <rtems/malloc.h> +#include <rtems/shell.h> +#include "internal.h" + +int rtems_shell_main_wkspace_info( + int argc, + char *argv[] +) +{ + Heap_Information_block info; + extern void classinfo_tester(); + + /* XXX lock allocator and do not violate visibility */ + _Heap_Get_information( &_Workspace_Area, &info ); + rtems_shell_print_heap_info( "free", &info.Free ); + rtems_shell_print_heap_info( "used", &info.Used ); + + classinfo_tester(); + decode_id( _Thread_Executing->Object.id ); + return 0; +} + +rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command = { + "wkspace", /* name */ + "", /* usage */ + "rtems", /* topic */ + rtems_shell_main_wkspace_info, /* command */ + NULL, /* alias */ + NULL /* next */ +}; + diff --git a/cpukit/libmisc/shell/print_heapinfo.c b/cpukit/libmisc/shell/print_heapinfo.c new file mode 100644 index 0000000000..9110c97a76 --- /dev/null +++ b/cpukit/libmisc/shell/print_heapinfo.c @@ -0,0 +1,37 @@ +/* + * Print Heap Information Structure + * + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <inttypes.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include "internal.h" + +void rtems_shell_print_heap_info( + const char *c, + Heap_Information *h +) +{ + printf( + "Number of %s blocks: %" PRId32 "\n" + "Largest %s block: %" PRId32 "\n" + "Total bytes %s: %" PRId32 "\n", + c, h->number, + c, h->largest, + c, h->total + ); +} diff --git a/cpukit/libmisc/shell/shellconfig.h b/cpukit/libmisc/shell/shellconfig.h index 612d428efc..5e827ff39e 100644 --- a/cpukit/libmisc/shell/shellconfig.h +++ b/cpukit/libmisc/shell/shellconfig.h @@ -53,7 +53,9 @@ extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command; extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command; extern rtems_shell_cmd_t rtems_shell_STACKUSE_Command; extern rtems_shell_cmd_t rtems_shell_PERIODUSE_Command; +extern rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command; extern rtems_shell_cmd_t rtems_shell_MALLOC_INFO_Command; +extern rtems_shell_cmd_t rtems_shell_JOEL_Command; extern rtems_shell_cmd_t *rtems_shell_Initial_commands[]; @@ -287,6 +289,12 @@ extern rtems_shell_filesystems_t *rtems_shell_Mount_filesystems[]; defined(CONFIGURE_SHELL_COMMAND_PERIODUSE) &rtems_shell_PERIODUSE_Command, #endif + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_COMMAND_WKSPACE_INFO)) || \ + defined(CONFIGURE_SHELL_COMMAND_WKSPACE_INFO) + &rtems_shell_WKSPACE_INFO_Command, + #endif + /* * Malloc family commands @@ -297,6 +305,7 @@ extern rtems_shell_filesystems_t *rtems_shell_Mount_filesystems[]; &rtems_shell_MALLOC_INFO_Command, #endif + &rtems_shell_JOEL_Command, /* * User defined shell commands */ |