1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/shell/cmds/heap.c

45 lines
951 B
C
Raw Normal View History

2013-06-27 16:16:57 +02:00
/*
* Copyright (C) 2013 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
2013-06-27 16:16:57 +02:00
*/
/**
* @ingroup sys_shell_commands
* @{
*
2013-06-27 16:16:57 +02:00
* @file
* @brief Print the state of the heap
2013-06-27 16:16:57 +02:00
*
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
2013-06-27 16:16:57 +02:00
*
* @}
2013-06-27 16:16:57 +02:00
*/
#include "cpu_conf.h"
#include "shell.h"
#if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS)
2013-06-27 16:16:57 +02:00
extern void heap_stats(void);
#else
#include <stdio.h>
#endif
2013-06-27 16:16:57 +02:00
static int _heap_handler(int argc, char **argv)
2013-09-05 12:41:43 +02:00
{
(void) argc;
(void) argv;
#if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS)
heap_stats();
return 0;
#else
printf("heap statistics are not supported for %s cpu\n", RIOT_CPU);
return 1;
#endif
2013-06-27 16:16:57 +02:00
}
SHELL_COMMAND(heap, "Prints heap statistics.", _heap_handler);