source: rtems/cpukit/libmisc/shell/print_heapinfo.c

Last change on this file was 93934f88, checked in by Sebastian Huber <sebastian.huber@…>, on 08/22/17 at 12:18:09

heap: Fix integer types

Update #3082.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  Print Heap Information Structure
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 <stdio.h>
18
19#include "internal.h"
20
21void rtems_shell_print_heap_info(
22  const char             *c,
23  const Heap_Information *h
24)
25{
26  printf(
27    "Number of %s blocks:                    %12" PRIuPTR "\n"
28    "Largest %s block:                       %12" PRIuPTR "\n"
29    "Total bytes %s:                         %12" PRIuPTR "\n",
30    c, h->number,
31    c, h->largest,
32    c, h->total
33  );
34}
35
36void rtems_shell_print_heap_stats(
37  const Heap_Statistics *s
38)
39{
40  printf(
41    "Size of the allocatable area in bytes:    %12" PRIuPTR "\n"
42    "Minimum free size ever in bytes:          %12" PRIuPTR "\n"
43    "Maximum number of free blocks ever:       %12" PRIu32 "\n"
44    "Maximum number of blocks searched ever:   %12" PRIu32 "\n"
45    "Lifetime number of bytes allocated:       %12" PRIu64 "\n"
46    "Lifetime number of bytes freed:           %12" PRIu64 "\n"
47    "Total number of searches:                 %12" PRIu32 "\n"
48    "Total number of successful allocations:   %12" PRIu32 "\n"
49    "Total number of failed allocations:       %12" PRIu32 "\n"
50    "Total number of successful frees:         %12" PRIu32 "\n"
51    "Total number of successful resizes:       %12" PRIu32 "\n",
52    s->size,
53    s->min_free_size,
54    s->max_free_blocks,
55    s->max_search,
56    s->lifetime_allocated,
57    s->lifetime_freed,
58    s->searches,
59    s->allocs,
60    s->failed_allocs,
61    s->frees,
62    s->resizes
63  );
64}
Note: See TracBrowser for help on using the repository browser.