Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*
0002  *  Print Heap Information Structure
0003  *
0004  *  COPYRIGHT (c) 1989-2008.
0005  *  On-Line Applications Research Corporation (OAR).
0006  *
0007  *  The license and distribution terms for this file may be
0008  *  found in the file LICENSE in this distribution or at
0009  *  http://www.rtems.org/license/LICENSE.
0010  */
0011 
0012 #ifdef HAVE_CONFIG_H
0013 #include "config.h"
0014 #endif
0015 
0016 #include <inttypes.h>
0017 #include <stdio.h>
0018 
0019 #include "internal.h"
0020 
0021 void rtems_shell_print_heap_info(
0022   const char             *c,
0023   const Heap_Information *h
0024 )
0025 {
0026   printf(
0027     "Number of %s blocks:                    %12" PRIuPTR "\n"
0028     "Largest %s block:                       %12" PRIuPTR "\n"
0029     "Total bytes %s:                         %12" PRIuPTR "\n",
0030     c, h->number,
0031     c, h->largest,
0032     c, h->total
0033   );
0034 }
0035 
0036 void rtems_shell_print_heap_stats(
0037   const Heap_Statistics *s
0038 )
0039 {
0040   printf(
0041     "Size of the allocatable area in bytes:    %12" PRIuPTR "\n"
0042     "Minimum free size ever in bytes:          %12" PRIuPTR "\n"
0043     "Maximum number of free blocks ever:       %12" PRIu32 "\n"
0044     "Maximum number of blocks searched ever:   %12" PRIu32 "\n"
0045     "Lifetime number of bytes allocated:       %12" PRIu64 "\n"
0046     "Lifetime number of bytes freed:           %12" PRIu64 "\n"
0047     "Total number of searches:                 %12" PRIu32 "\n"
0048     "Total number of successful allocations:   %12" PRIu32 "\n"
0049     "Total number of failed allocations:       %12" PRIu32 "\n"
0050     "Total number of successful frees:         %12" PRIu32 "\n"
0051     "Total number of successful resizes:       %12" PRIu32 "\n",
0052     s->size,
0053     s->min_free_size,
0054     s->max_free_blocks,
0055     s->max_search,
0056     s->lifetime_allocated,
0057     s->lifetime_freed,
0058     s->searches,
0059     s->allocs,
0060     s->failed_allocs,
0061     s->frees,
0062     s->resizes
0063   );
0064 }