Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*
0002  *  MALLOC_INFO Shell Command Implmentation
0003  *
0004  *  COPYRIGHT (c) 1989-2008.
0005  *  On-Line Applications Research Corporation (OAR).
0006  *
0007  *  The license and distribution terms for this file may be
0008  *  found in the file LICENSE in this distribution or at
0009  *  http://www.rtems.org/license/LICENSE.
0010  */
0011 
0012 #ifdef HAVE_CONFIG_H
0013 #include "config.h"
0014 #endif
0015 
0016 #include <inttypes.h>
0017 
0018 #include <rtems.h>
0019 #include <rtems/malloc.h>
0020 #include <rtems/shell.h>
0021 #include <rtems/score/protectedheap.h>
0022 #include <rtems/score/wkspace.h>
0023 #include "internal.h"
0024 
0025 void rtems_shell_print_unified_work_area_message(void)
0026 {
0027   printf( "C Program Heap and RTEMS Workspace are %s.\n",
0028     rtems_configuration_get_unified_work_area() ? "the same" : "separate"
0029   );
0030 }
0031 
0032 static int rtems_shell_main_wkspace_info(
0033   int   argc RTEMS_UNUSED,
0034   char *argv[] RTEMS_UNUSED
0035 )
0036 {
0037   Heap_Information_block info;
0038 
0039   rtems_shell_print_unified_work_area_message();
0040 
0041   _Protected_heap_Get_information( &_Workspace_Area, &info );
0042   rtems_shell_print_heap_info( "free", &info.Free );
0043   rtems_shell_print_heap_info( "used", &info.Used );
0044   rtems_shell_print_heap_stats( &info.Stats );
0045 
0046   return 0;
0047 }
0048 
0049 rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command = {
0050   "wkspace",                                  /* name */
0051   "Report on RTEMS Executive Workspace",      /* usage */
0052   "rtems",                                    /* topic */
0053   rtems_shell_main_wkspace_info,              /* command */
0054   NULL,                                       /* alias */
0055   NULL                                        /* next */
0056 };