source: rtems/cpukit/libmisc/shell/main_mallocinfo.c @ 01557b0

4.115
Last change on this file since 01557b0 was 01557b0, checked in by Sebastian Huber <sebastian.huber@…>, on 11/27/14 at 10:44:48

libcsupport: Delete malloc statistics

Use the heap handler statistics instead. Add heap walk option to MALLOC
shell command.

close #1367

  • Property mode set to 100644
File size: 1.3 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    region_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  }
41
42  return 0;
43}
44
45rtems_shell_cmd_t rtems_shell_MALLOC_INFO_Command = {
46  "malloc",                                   /* name */
47  "malloc [walk]",                            /* usage */
48  "mem",                                      /* topic */
49  rtems_shell_main_malloc_info,               /* command */
50  NULL,                                       /* alias */
51  NULL                                        /* next */
52};
53
Note: See TracBrowser for help on using the repository browser.