You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
887 B

//
// Created by MightyPork on 2018/12/08.
//
#include <esp_heap_caps.h>
#include <esp_system.h>
#include "console/cmd_common.h"
#include <console/cmddef.h>
/* 'heap' command prints minumum heap size */
static int cmd_heap(console_ctx_t *ctx, cmd_signature_t *reg)
{
static struct {
struct arg_end *end;
} cmd_args;
if (reg) {
cmd_args.end = arg_end(1);
reg->argtable = &cmd_args;
reg->command = "heap";
reg->help = "Get emulator heap usage stats (for debug)";
return 0;
}
uint32_t heap_size = heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT);
uint32_t current_free = esp_get_free_heap_size();
console_printf("free heap: %u bytes\r\n"
" lowest: %u bytes\r\n", current_free, heap_size);
return 0;
}
void register_cmd_heap(void)
{
console_cmd_register(cmd_heap, "heap");
}