Processor occupancy tracing: why isn’t it there?

I’m thinking about using the TASKSWITCHEDIN/OUT macros to record the time spent in processing time by each task. This is something available on every operating system and I wonder why that isn’t part of the normal tracing capabilities. Surely there is a reason for not including such a functionality by default?

Processor occupancy tracing: why isn’t it there?

http://www.freertos.org/rtos-run-time-stats.html You just have to fill in the macro that returns the time stamp, which can’t be part of the standard kernel code because where it comes from depends on the mcu you are using and which timers are free on that mcu. There are some standard ways of providing the time stamp on Cortex mcus that use raw systick timer values. you can also look at http://www.freertos.org/uxTaskGetSystemState.html and http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTrace/FreeRTOSPlusTrace.shtml

Processor occupancy tracing: why isn’t it there?

Thanks Dave I’m again getting up to speed on FreeRTOS after years, and I totally forgot about this -_- By looking into my old code I had the runtime stats setup already, with the core timer and everything. I’m getting old 😛 I remember reading something about the impact of the tracing features, but can’t find it. Do you know anything about this?

Processor occupancy tracing: why isn’t it there?

The timing impact? Well, as with all the features that add code (stack overflow detection, assert points, and the like) there is a code size and execution speed impact. The impact of gathering run time information depends on the implementation of the function that returns the time stamp. If it is simply reading a register then the impact will be one read, and one write, per context switch (actually, probably a little more). If the time stamp needs to be pre-processed then the impact will be higher. Formatting statistical information into human readable table is another matter. That takes a long time and is not really something you want to be doing outside of your debug code.