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.
This commit is contained in:
Joel Sherrill
2008-01-07 17:46:25 +00:00
parent c961c06bbe
commit 694bd9f68e
7 changed files with 121 additions and 8 deletions

View File

@@ -1,3 +1,12 @@
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.

View File

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

View File

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

View File

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

View File

@@ -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 */
};

View File

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

View File

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