From e2a35695f8cd16d72e5a457b80044c5dd402a5d5 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Tue, 1 May 2012 16:38:33 +0000 Subject: [PATCH] Add a command for showing the heap usage. PR: 165025 Submitted by: Gavin Mu MFC after: 1 week --- sys/boot/sparc64/loader/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index be0819f3525..8eba04ab86c 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -800,6 +800,18 @@ main(int (*openfirm)(void *)) return (1); } +COMMAND_SET(heap, "heap", "show heap usage", command_heap); + +static int +command_heap(int argc, char *argv[]) +{ + + mallocstats(); + printf("heap base at %p, top at %p, upper limit at %p\n", heapva, + sbrk(0), heapva + HEAPSZ); + return(CMD_OK); +} + COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); static int