2013-06-27 16:16:57 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
|
|
|
*
|
2014-07-31 20:15:03 +02:00
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-02-12 18:06:34 +01:00
|
|
|
* @ingroup sys_shell_commands
|
|
|
|
* @{
|
|
|
|
*
|
2013-06-27 16:16:57 +02:00
|
|
|
* @file
|
2015-02-12 18:06:34 +01:00
|
|
|
* @brief Print the state of the heap
|
2013-06-27 16:16:57 +02:00
|
|
|
*
|
2015-02-12 18:06:34 +01:00
|
|
|
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
2013-06-27 16:16:57 +02:00
|
|
|
*
|
2015-02-12 18:06:34 +01:00
|
|
|
* @}
|
2013-06-27 16:16:57 +02:00
|
|
|
*/
|
|
|
|
|
2019-02-03 15:24:52 +01:00
|
|
|
#include "cpu_conf.h"
|
2022-05-31 23:27:27 +02:00
|
|
|
#include "shell.h"
|
2019-02-03 15:24:52 +01:00
|
|
|
|
|
|
|
#if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS)
|
2013-06-27 16:16:57 +02:00
|
|
|
extern void heap_stats(void);
|
2019-02-03 15:24:52 +01:00
|
|
|
#else
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
2013-06-27 16:16:57 +02:00
|
|
|
|
2022-06-08 08:51:38 +02:00
|
|
|
static int _heap_handler(int argc, char **argv)
|
2013-09-05 12:41:43 +02:00
|
|
|
{
|
2014-02-21 19:10:24 +01:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
|
|
|
|
2019-02-03 15:24:52 +01:00
|
|
|
#if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS)
|
2013-08-06 16:36:37 +02:00
|
|
|
heap_stats();
|
2015-03-20 08:51:45 +01:00
|
|
|
return 0;
|
2019-02-03 15:24:52 +01:00
|
|
|
#else
|
|
|
|
printf("heap statistics are not supported for %s cpu\n", RIOT_CPU);
|
|
|
|
return 1;
|
|
|
|
#endif
|
2013-06-27 16:16:57 +02:00
|
|
|
}
|
2022-05-31 23:27:27 +02:00
|
|
|
|
|
|
|
SHELL_COMMAND(heap, "Prints heap statistics.", _heap_handler);
|