35 #include <px4_platform_common/px4_config.h> 36 #include <nuttx/progmem.h> 37 #include <nuttx/compiler.h> 41 #include <nuttx/arch.h> 46 #if !defined(CONFIG_NSH_LIBRARY) 52 case TSTATE_TASK_INVALID:
return "init";
54 case TSTATE_TASK_PENDING:
return "PEND";
56 case TSTATE_TASK_READYTORUN:
return "READY";
58 case TSTATE_TASK_RUNNING:
return "RUN";
60 case TSTATE_TASK_INACTIVE:
return "inact";
62 case TSTATE_WAIT_SEM:
return "w:sem";
63 #ifndef CONFIG_DISABLE_SIGNALS 65 case TSTATE_WAIT_SIG:
return "w:sig";
67 #ifndef CONFIG_DISABLE_MQUEUE 69 case TSTATE_WAIT_MQNOTEMPTY:
return "w:mqe";
71 case TSTATE_WAIT_MQNOTFULL:
return "w:mqf";
75 case TSTATE_WAIT_PAGEFILL:
return "w:pgf";
89 size_t stack_size =
system_load.tasks[i].tcb->adj_stack_size;
90 ssize_t stack_free = 0;
92 #if CONFIG_ARCH_INTERRUPTSTACK > 3 95 stack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
96 stack_free = up_check_intstack_remain();
100 stack_free = up_check_tcbstack_remain(
system_load.tasks[i].tcb);
101 #if CONFIG_ARCH_INTERRUPTSTACK > 3 105 ::syslog(LOG_INFO,
"%4d %*-s %8lld %5u/%5u %3u (%3u) ",
107 CONFIG_TASK_NAME_SIZE,
system_load.tasks[i].tcb->name,
109 stack_size - stack_free,
114 #if CONFIG_RR_INTERVAL > 0 116 ::syslog(LOG_INFO,
" %6d\n",
system_load.tasks[i].tcb->timeslice);
127 size_t page = 0, stpage = 0xFFFF;
136 for (status = 0, page = 0; status >= 0; page++) {
137 status = up_progmem_ispageerased(page);
138 pagesize = up_progmem_pagesize(page);
140 mem->arena += pagesize;
145 if (stpage == 0xFFFF) { stpage = page; }
147 mem->fordblks += pagesize;
149 }
else if (status != 0) {
150 mem->uordblks += pagesize;
152 if (stpage != 0xFFFF && up_progmem_isuniform()) {
153 stpage = page - stpage;
155 if (stpage > (
size_t) mem->mxordblk) {
156 mem->mxordblk = stpage;
164 mem->mxordblk *= pagesize;
169 struct mallinfo data;
170 struct mallinfo prog;
172 #ifdef CONFIG_CAN_PASS_STRUCTS 175 (void)mallinfo(&data);
181 ::syslog(LOG_INFO,
" total used free largest\n");
183 ::syslog(LOG_INFO,
"Data: %11d%11d%11d%11d\n",
184 data.arena, data.uordblks, data.fordblks, data.mxordblk);
186 ::syslog(LOG_INFO,
"Prog: %11d%11d%11d%11d\n",
187 prog.arena, prog.uordblks, prog.fordblks, prog.mxordblk);
static struct vehicle_status_s status
struct system_load_s system_load
static void free_getprogmeminfo(struct mallinfo *mem)
static const char * tstate_name(const tstate_t s)