summaryrefslogtreecommitdiff
path: root/cpukit/libmisc/shell/print_heapinfo.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-27 13:25:22 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-28 13:09:07 +0100
commit2c3c657625f5129e3062058a2c83f0020fd6bab5 (patch)
tree1b6b2a5b125d4dffc1268768bc067f021c35a412 /cpukit/libmisc/shell/print_heapinfo.c
parent01557b0c6e723627427195bb33bdfe0b125c70b1 (diff)
score: Return heap stats via _Heap_Get_information
Print out heap statistics via the MALLOC and WKSPACE shell commands.
Diffstat (limited to 'cpukit/libmisc/shell/print_heapinfo.c')
-rw-r--r--cpukit/libmisc/shell/print_heapinfo.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/cpukit/libmisc/shell/print_heapinfo.c b/cpukit/libmisc/shell/print_heapinfo.c
index 12bc363f71..4ac9c96f88 100644
--- a/cpukit/libmisc/shell/print_heapinfo.c
+++ b/cpukit/libmisc/shell/print_heapinfo.c
@@ -14,22 +14,47 @@
#endif
#include <inttypes.h>
+#include <stdio.h>
-#include <rtems.h>
-#include <rtems/shell.h>
#include "internal.h"
void rtems_shell_print_heap_info(
- const char *c,
- Heap_Information *h
+ const char *c,
+ const Heap_Information *h
)
{
printf(
- "Number of %s blocks: %" PRId32 "\n"
- "Largest %s block: %" PRId32 "\n"
- "Total bytes %s: %" PRId32 "\n",
+ "Number of %s blocks: %12" PRId32 "\n"
+ "Largest %s block: %12" PRId32 "\n"
+ "Total bytes %s: %12" PRId32 "\n",
c, h->number,
c, h->largest,
c, h->total
);
}
+
+void rtems_shell_print_heap_stats(
+ const Heap_Statistics *s
+)
+{
+ printf(
+ "Instance number: %12" PRIu32 "\n"
+ "Size of the allocatable area in bytes: %12" PRIuPTR "\n"
+ "Minimum free size ever in bytes: %12" PRIuPTR "\n"
+ "Maximum number of free blocks ever: %12" PRIu32 "\n"
+ "Maximum number of blocks searched ever: %12" PRIu32 "\n"
+ "Total number of successful allocations: %12" PRIu32 "\n"
+ "Total number of searches ever: %12" PRIu32 "\n"
+ "Total number of successful calls to free: %12" PRIu32 "\n"
+ "Total number of successful resizes: %12" PRIu32 "\n",
+ s->instance,
+ s->size,
+ s->min_free_size,
+ s->max_free_blocks,
+ s->max_search,
+ s->allocs,
+ s->searches,
+ s->frees,
+ s->resizes
+ );
+}