meminfo cli command added (memory allocator statistics from mallinfo())
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include <ctype.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define CLI_COMMAND_MAX_ARGS 8
|
||||
#define CLI_COMMAND_MAX_LEN 256
|
||||
@@ -156,6 +157,30 @@ int cliStackInfo(const char ** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int cliMemoryInfo(const char ** argv)
|
||||
{
|
||||
// struct mallinfo {
|
||||
// int arena; /* total space allocated from system */
|
||||
// int ordblks; /* number of non-inuse chunks */
|
||||
// int smblks; /* unused -- always zero */
|
||||
// int hblks; /* number of mmapped regions */
|
||||
// int hblkhd; /* total space in mmapped regions */
|
||||
// int usmblks; /* unused -- always zero */
|
||||
// int fsmblks; /* unused -- always zero */
|
||||
// int uordblks; /* total allocated space */
|
||||
// int fordblks; /* total non-inuse space */
|
||||
// int keepcost; /* top-most, releasable (via malloc_trim) space */
|
||||
// };
|
||||
struct mallinfo info = mallinfo();
|
||||
serialPrint("arena %d", info.arena);
|
||||
serialPrint("ordblks %d", info.ordblks);
|
||||
serialPrint("uordblks %d", info.uordblks);
|
||||
serialPrint("fordblks %d", info.fordblks);
|
||||
serialPrint("keepcost %d", info.keepcost);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cliReboot(const char ** argv)
|
||||
{
|
||||
#if !defined(SIMU)
|
||||
@@ -383,6 +408,7 @@ const CliCommand cliCommands[] = {
|
||||
{ "reboot", cliReboot, "" },
|
||||
{ "set", cliSet, "<what> <value>" },
|
||||
{ "stackinfo", cliStackInfo, "" },
|
||||
{ "meminfo", cliMemoryInfo, "" },
|
||||
{ "trace", cliTrace, "on | off" },
|
||||
#if defined(PCBFLAMENCO)
|
||||
{ "read_bq24195", cliReadBQ24195, "<register>" },
|
||||
|
||||
Reference in New Issue
Block a user