From 01557b0c6e723627427195bb33bdfe0b125c70b1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 27 Nov 2014 11:44:48 +0100 Subject: libcsupport: Delete malloc statistics Use the heap handler statistics instead. Add heap walk option to MALLOC shell command. close #1367 --- doc/shell/memory.t | 79 +++++++++++++++++++----------------------------------- doc/user/conf.t | 31 --------------------- 2 files changed, 27 insertions(+), 83 deletions(-) (limited to 'doc') diff --git a/doc/shell/memory.t b/doc/shell/memory.t index 3227e736c8..0fdf1f8513 100644 --- a/doc/shell/memory.t +++ b/doc/shell/memory.t @@ -530,18 +530,14 @@ extern rtems_shell_cmd_t rtems_shell_MMOVE_Command; @subheading SYNOPSYS: @example -malloc [info|stats] +malloc [walk] @end example @subheading DESCRIPTION: -This command prints either information or statistics about the -C Program Heap used by the @code{malloc} family of calls based upon -the value of the first argument passed to the command. - -When the subcommand @code{info} is specified, information on the -current state of the C Program Heap is reported. This includes the following -information: +This command prints information about the current state of the C Program Heap +used by the @code{malloc()} family of calls if no or invalid options are passed +to the command. This includes the following information: @itemize @bullet @item Number of free blocks @@ -552,23 +548,8 @@ information: @item Total bytes used @end itemize -When the subcommand @code{stats} is specified, statistics on the -the C Program Heap are reported. Malloc Family Statistics must -be enabled for all of the values to be updated. The statistics -available includes the following information: - -@itemize @bullet -@item -@item Currently available memory (in kilobytes) -@item Currently allocated memory (in kilobytes) -@item Maximum amount of memory ever allocated (in kilobytes) -@item Lifetime tally of allocated memory (in kilobytes) -@item Lifetime tally of freed memory (in kilobytes) -@item Number of calls to @code{malloc} -@item Number of calls to @code{free} -@item Number of calls to @code{realloc} -@item Number of calls to @code{calloc} -@end itemize +When the subcommand @code{walk} is specified, then a heap walk will be +performed and information about each block is printed out. @subheading EXIT STATUS: @@ -576,47 +557,41 @@ This command returns 0 on success and non-zero if an error is encountered. @subheading NOTES: -@findex CONFIGURE_MALLOC_STATISTICS - -The @code{CONFIGURE_MALLOC_STATISTICS} @code{confdefs.h} constant -must be defined when the application is configured for the full -set of statistics information to be available. +NONE @subheading EXAMPLES: The following is an example of how to use the @code{malloc} command. @example -SHLL [/] $ malloc info +SHLL [/] $ malloc Number of free blocks: 3 Largest free block: 3626672 Total bytes free: 3627768 Number of used blocks: 130 Largest used block: 1048 Total bytes used: 10136 -SHLL [/] $ malloc stats -Malloc statistics - avail:3552k allocated:9k (0%) max:10k (0%) lifetime:21k freed:12k - Call counts: malloc:203 free:93 realloc:0 calloc:20 -SHLL [/] $ malloc info -Number of free blocks: 3 -Largest free block: 3626672 -Total bytes free: 3627768 -Number of used blocks: 130 -Largest used block: 1048 -Total bytes used: 10136 -SHLL [/] $ malloc stats -Malloc statistics - avail:3552k allocated:9k (0%) max:10k (0%) lifetime:23k freed:14k - Call counts: malloc:205 free:95 realloc:0 calloc:20 +SHLL [/] $ malloc walk +malloc walk +PASS[0]: page size 8, min block size 48 + area begin 0x00210210, area end 0x0FFFC000 + first block 0x00210214, last block 0x0FFFBFDC + first free 0x00228084, last free 0x00228354 +PASS[0]: block 0x00210214: size 88 +... +PASS[0]: block 0x00220154: size 144 +PASS[0]: block 0x002201E4: size 168, prev 0x002205BC, next 0x00228354 (= last free) +PASS[0]: block 0x0022028C: size 168, prev_size 168 +... +PASS[0]: block 0x00226E7C: size 4136 +PASS[0]: block 0x00227EA4: size 408, prev 0x00228084 (= first free), next 0x00226CE4 +PASS[0]: block 0x0022803C: size 72, prev_size 408 +PASS[0]: block 0x00228084: size 648, prev 0x0020F75C (= head), next 0x00227EA4 +PASS[0]: block 0x0022830C: size 72, prev_size 648 +PASS[0]: block 0x00228354: size 266157192, prev 0x002201E4, next 0x0020F75C (= tail) +PASS[0]: block 0x0FFFBFDC: size 4028711480, prev_size 266157192 @end example -Note that in the above example, the lifetime allocated and free -values have increased between the two calls to @code{malloc stats} -even though the amount of memory available in the C Program Heap -is the same in both the @code{malloc info} invocations. This indicates -that memory was allocated and freed as a side-effect of the commands. - @subheading CONFIGURATION: @findex CONFIGURE_SHELL_NO_COMMAND_MALLOC diff --git a/doc/user/conf.t b/doc/user/conf.t index d72ff06661..68b5ede8fa 100644 --- a/doc/user/conf.t +++ b/doc/user/conf.t @@ -2433,37 +2433,6 @@ This section defines the file system and IO library related configuration parameters supported by @code{}. -@c -@c === CONFIGURE_MALLOC_STATISTICS === -@c -@subsection Enable Malloc Family Statistics - -@findex CONFIGURE_MALLOC_STATISTICS - - -@table @b -@item CONSTANT: -@code{CONFIGURE_MALLOC_STATISTICS} - -@item DATA TYPE: -Boolean feature macro. - -@item RANGE: -Defined or undefined. - -@item DEFAULT VALUE: -This is not defined by default, and Malloc Statistics are disabled. - -@end table - -@subheading DESCRIPTION: -This configuration parameter is defined when the application wishes to -enable the gathering of more detailed statistics on the C Malloc Family -of routines. - -@subheading NOTES: -None. - @c @c === CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS === @c -- cgit v1.2.3