PRINTF("任务名 已用栈(B) 剩余栈(B) 栈使用率(%%) 优先级 CPU使用率(%%) CPU最大使用率(%%) 调用次数 状态rn");
OSTaskStkChk (&Led0TaskTCB,&free,&used,&err);
PRINTF("Led0TaskTCB %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),Led0TaskTCB.Prio,Led0TaskTCB.CPUUsage/100.0,Led0TaskTCB.CPUUsageMax/100.0,Led0TaskTCB.CtxSwCtr,task_state[Led0TaskTCB.TaskState]);
OSTaskStkChk (&Led1TaskTCB,&free,&used,&err);
PRINTF("Led1TaskTCB %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),Led1TaskTCB.Prio,Led1TaskTCB.CPUUsage/100.0,Led1TaskTCB.CPUUsageMax/100.0,Led1TaskTCB.CtxSwCtr,task_state[Led1TaskTCB.TaskState]);
OSTaskStkChk (&TCPCMDTaskTCB,&free,&used,&err);
PRINTF("TCPCMDTaskTCB %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),TCPCMDTaskTCB.Prio,TCPCMDTaskTCB.CPUUsage/100.0,TCPCMDTaskTCB.CPUUsageMax/100.0,TCPCMDTaskTCB.CtxSwCtr,task_state[TCPCMDTaskTCB.TaskState]);
OSTaskStkChk (&COLLECTTaskTCB,&free,&used,&err);
PRINTF("COLLECTTaskTCB %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),COLLECTTaskTCB.Prio,COLLECTTaskTCB.CPUUsage/100.0,COLLECTTaskTCB.CPUUsageMax/100.0,COLLECTTaskTCB.CtxSwCtr,task_state[COLLECTTaskTCB.TaskState]);
OSTaskStkChk (&GET_TEMPERATURETaskTCB,&free,&used,&err);
PRINTF("STATUS %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),GET_TEMPERATURETaskTCB.Prio,GET_TEMPERATURETaskTCB.CPUUsage/100.0,GET_TEMPERATURETaskTCB.CPUUsageMax/100.0,GET_TEMPERATURETaskTCB.CtxSwCtr,task_state[GET_TEMPERATURETaskTCB.TaskState]);
OSTaskStkChk (&UDPDEBUGTaskTCB,&free,&used,&err);
PRINTF("UDPDEBUGTaskTCB %4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srnrn",
used,free,(used*100)/(used+free),UDPDEBUGTaskTCB.Prio,UDPDEBUGTaskTCB.CPUUsage/100.0,UDPDEBUGTaskTCB.CPUUsageMax/100.0,UDPDEBUGTaskTCB.CtxSwCtr,task_state[UDPDEBUGTaskTCB.TaskState]);
for(i=0;i<12;i++)
{
OSTaskStkChk (&LwIP_task_TCB
,&free,&used,&err);
if(LwIP_task_TCB.CtxSwCtr)
PRINTF("LwIP_task_TCB[%2d]%4d %4d %3d%% %3d %3.2f%% %3.2f%% %8d %srn",
i,used,free,(used*100)/(used+free),LwIP_task_TCB.Prio,LwIP_task_TCB.CPUUsage/100.0,LwIP_task_TCB.CPUUsageMax/100.0,LwIP_task_TCB.CtxSwCtr,task_state[LwIP_task_TCB.TaskState]);
}
cpuuseage=OSStatTaskCPUUsage/100.0; //由于算出来的是万分之几的CPU占用率,这边做了一些处理
PRINTF("任务切换次数 :%d CPU总使用率=%3.2f%%rn",OSTaskCtxSwCtr,cpuuseage);