1 | /* |
---|
2 | * MALLOC_INFO Shell Command Implmentation |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2008. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | */ |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <inttypes.h> |
---|
17 | |
---|
18 | #include <rtems.h> |
---|
19 | #include <rtems/malloc.h> |
---|
20 | #include <rtems/shell.h> |
---|
21 | #include <rtems/score/protectedheap.h> |
---|
22 | #include <rtems/score/wkspace.h> |
---|
23 | #include "internal.h" |
---|
24 | |
---|
25 | void rtems_shell_print_unified_work_area_message(void) |
---|
26 | { |
---|
27 | printf( "\nC Program Heap and RTEMS Workspace are %s.\n", |
---|
28 | rtems_configuration_get_unified_work_area() ? "the same" : "separate" |
---|
29 | ); |
---|
30 | } |
---|
31 | |
---|
32 | static int rtems_shell_main_wkspace_info( |
---|
33 | int argc __attribute__((unused)), |
---|
34 | char *argv[] __attribute__((unused)) |
---|
35 | ) |
---|
36 | { |
---|
37 | Heap_Information_block info; |
---|
38 | |
---|
39 | rtems_shell_print_unified_work_area_message(); |
---|
40 | |
---|
41 | _Protected_heap_Get_information( &_Workspace_Area, &info ); |
---|
42 | rtems_shell_print_heap_info( "free", &info.Free ); |
---|
43 | rtems_shell_print_heap_info( "used", &info.Used ); |
---|
44 | |
---|
45 | return 0; |
---|
46 | } |
---|
47 | |
---|
48 | rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command = { |
---|
49 | "wkspace", /* name */ |
---|
50 | "Report on RTEMS Executive Workspace", /* usage */ |
---|
51 | "rtems", /* topic */ |
---|
52 | rtems_shell_main_wkspace_info, /* command */ |
---|
53 | NULL, /* alias */ |
---|
54 | NULL /* next */ |
---|
55 | }; |
---|