// // Created by MightyPork on 2018/12/08. // #include #include #include "console/cmd_common.h" #include /* '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"); }