TaskStat

Example of use:

#include <Services/Profiling/TaskStat.h>

Profiling::TaskStat taskStat(Serial);
Timer statTimer;

void init()
{
   ...

   // Set up timer to print task information to Serial terminal every 2 seconds
   statTimer.initializeMs<2000>(InterruptCallback([]() { taskStat.update(); }));
   statTimer.start();
}
class TaskStat

Helper class to support printing of real-time task information.

Code is refactored from the FreeRTOS Real Time Stats Example.

Requires these SDK configuration settings to be set:

  • FREERTOS_USE_TRACE_FACILITY

  • FREERTOS_GENERATE_RUN_TIME_STATS

  • FREERTOS_VTASKLIST_INCLUDE_COREID (optional)

Public Functions

TaskStat(Print &out)

Constructor.

Parameters:

out – Where to print reports (e.g. Serial)

bool update()

Update the report.

Nothing will be output the first time this is called. From then on, the stats will show the difference in task usage from the previous call.