12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "task_monitor.h"
- #include "stdio.h"
- #include <stdarg.h>
- #include "FreeRTOS.h"
- #include "cmsis_os.h"
- #include "task.h"
- #include "queue.h"
- extern osMessageQueueId_t HighestTaskHandle;
- extern osMessageQueueId_t ReadTaskHandle;
- extern osMessageQueueId_t DealTaskHandle;
- extern osMessageQueueId_t CommonTaskHandle;
- extern osMessageQueueId_t ReadTask02Handle;
- void Read_Remaining_stack_space(void)
- {
- // 读取任务剩余栈空间 ,任务栈的最大使用深度
- // 所有任务都还有 100 以上的剩余栈空间,暂时没有溢出的风险;
- if (HighestTaskHandle != NULL)
- {
- UBaseType_t stackLeft = uxTaskGetStackHighWaterMark(HighestTaskHandle);
- printf("HighestTaskHandle stack remaining: %lu\n", stackLeft);
- }
- if (ReadTaskHandle != NULL)
- {
- UBaseType_t stackLeft = uxTaskGetStackHighWaterMark(ReadTaskHandle);
- printf("ReadTaskHandle stack remaining: %lu\n", stackLeft);
- }
- if (DealTaskHandle != NULL)
- {
- UBaseType_t stackLeft = uxTaskGetStackHighWaterMark(DealTaskHandle);
- printf("DealTaskHandle stack remaining: %lu\n", stackLeft);
- }
- if (CommonTaskHandle != NULL)
- {
- UBaseType_t stackLeft = uxTaskGetStackHighWaterMark(CommonTaskHandle);
- printf("CommonTaskHandle stack remaining: %lu\n", stackLeft);
- }
- if (ReadTask02Handle != NULL)
- {
- UBaseType_t stackLeft = uxTaskGetStackHighWaterMark(ReadTask02Handle);
- printf("ReadTask02Handle stack remaining: %lu\n", stackLeft);
- }
- }
|