source: rtems/cpukit/libmisc/shell/main_wkspaceinfo.c @ 2c3c657

4.115
Last change on this file since 2c3c657 was 2c3c657, checked in by Sebastian Huber <sebastian.huber@…>, on 11/27/14 at 12:25:22

score: Return heap stats via _Heap_Get_information

Print out heap statistics via the MALLOC and WKSPACE shell commands.

  • Property mode set to 100644
File size: 1.5 KB
Line 
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.org/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
25void rtems_shell_print_unified_work_area_message(void)
26{
27  printf( "C Program Heap and RTEMS Workspace are %s.\n",
28    rtems_configuration_get_unified_work_area() ? "the same" : "separate"
29  );
30}
31
32static 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  rtems_shell_print_heap_stats( &info.Stats );
45
46  return 0;
47}
48
49rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command = {
50  "wkspace",                                  /* name */
51  "Report on RTEMS Executive Workspace",      /* usage */
52  "rtems",                                    /* topic */
53  rtems_shell_main_wkspace_info,              /* command */
54  NULL,                                       /* alias */
55  NULL                                        /* next */
56};
Note: See TracBrowser for help on using the repository browser.