source: rtems/cpukit/libmisc/shell/main_mallocinfo.c @ d53862a

5
Last change on this file since d53862a was d53862a, checked in by Sebastian Huber <sebastian.huber@…>, on 11/08/18 at 06:56:54

rtems: Deprecate region_information_block

The region_information_block typedef as no corresponding API. It has no
proper namespace prefix. A user can do nothing with it.

Close #3591.

  • Property mode set to 100644
File size: 1.4 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#include <string.h>
18
19#include <rtems.h>
20#include <rtems/malloc.h>
21#include <rtems/libcsupport.h>
22#include <rtems/shellconfig.h>
23
24#include "internal.h"
25
26static int rtems_shell_main_malloc_info(
27  int   argc,
28  char *argv[]
29)
30{
31  if ( argc == 2 && strcmp( argv[ 1 ], "walk" ) == 0 ) {
32    malloc_walk( 0, true );
33  } else {
34    Heap_Information_block info;
35
36    rtems_shell_print_unified_work_area_message();
37    malloc_info( &info );
38    rtems_shell_print_heap_info( "free", &info.Free );
39    rtems_shell_print_heap_info( "used", &info.Used );
40    rtems_shell_print_heap_stats( &info.Stats );
41  }
42
43  return 0;
44}
45
46rtems_shell_cmd_t rtems_shell_MALLOC_INFO_Command = {
47  "malloc",                                   /* name */
48  "malloc [walk]",                            /* usage */
49  "mem",                                      /* topic */
50  rtems_shell_main_malloc_info,               /* command */
51  NULL,                                       /* alias */
52  NULL                                        /* next */
53};
54
Note: See TracBrowser for help on using the repository browser.