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 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <inttypes.h> |
---|
20 | |
---|
21 | #include <rtems.h> |
---|
22 | #include <rtems/malloc.h> |
---|
23 | #include <rtems/shell.h> |
---|
24 | #include <rtems/score/protectedheap.h> |
---|
25 | #include "internal.h" |
---|
26 | |
---|
27 | extern bool rtems_unified_work_area; |
---|
28 | |
---|
29 | void rtems_shell_print_unified_work_area_message(void) |
---|
30 | { |
---|
31 | printf( "\nC Program Heap and RTEMS Workspace are %s.\n", |
---|
32 | ((rtems_unified_work_area) ? "the same" : "separate") |
---|
33 | ); |
---|
34 | } |
---|
35 | |
---|
36 | int rtems_shell_main_wkspace_info( |
---|
37 | int argc __attribute__((unused)), |
---|
38 | char *argv[] __attribute__((unused)) |
---|
39 | ) |
---|
40 | { |
---|
41 | Heap_Information_block info; |
---|
42 | |
---|
43 | rtems_shell_print_unified_work_area_message(); |
---|
44 | |
---|
45 | _Protected_heap_Get_information( &_Workspace_Area, &info ); |
---|
46 | rtems_shell_print_heap_info( "free", &info.Free ); |
---|
47 | rtems_shell_print_heap_info( "used", &info.Used ); |
---|
48 | |
---|
49 | return 0; |
---|
50 | } |
---|
51 | |
---|
52 | rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command = { |
---|
53 | "wkspace", /* name */ |
---|
54 | "Report on RTEMS Executive Workspace", /* usage */ |
---|
55 | "rtems", /* topic */ |
---|
56 | rtems_shell_main_wkspace_info, /* command */ |
---|
57 | NULL, /* alias */ |
---|
58 | NULL /* next */ |
---|
59 | }; |
---|