This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FreeRTOS Tasks +CPU usage by Interrupts

Other Parts Discussed in Thread: TMS570LS0432

I use Hercules Launchpad TMS570LS0432 kit and FreeRTOS v8.1.2. I use vTaskGetRunTimeStats() to view CPU usage. I periodically send and receive data from PC through UART. Does vTaskGetRunTimeStats() consider the CPU Usage along with this interrupt servicing? I see same % values in the console as it was before Interruptions. Kindly suggest a solution to calculate or view the Idle Time with changes made to it by any non-maskable interrupts.

  • Hello Sindhu,

    As far as I can tell by the description on the FreeRTOS website, this API is provided as a debug tool to determine the time spent in various tasks within the OS. It is not a measure of CPU utilization or idle time. More information on the utility can be seen at these links:

    http://www.freertos.org/rtos-run-time-stats.html

    and

    http://www.freertos.org/a00021.html#vTaskGetRunTimeStats

  • Thanks Chuck. I understand that this API ignores Hardware Interrupt Processing. Kindly suggest me a method to measure Idle time( including Task and ISR processing) of CPU after creating the RTOS application on TMS570LS0432 launchpad. I tried incrementing a variable in Idle time Hook and Tick Hook, measure the time that Idle Task takes out of these variables. But this is not showing acceptable results. so in need of help now.

    Thanks in advance !

  • Sindhi,

    Part of the issue with what you are trying to achieve is that you are implementing code on device to attempt to measure the idle/busy time of the CPU and this same code is using device resources that include CPU processing time so whatever your final measurement, you will need to account for time spent supporting the feature.

    With that said, I would consider setting up a RTI free running counter that interrupts on overflow where you track the number of overflows. You could then set up a table in RAM that has an entry for each task/interrupt. Upon entry and exit to each task, you read the counter and calculate the time spent in the task/interrupt. The resulting time/count can be added to the running total in the table. Note that the values in the table will need to be large enough to support the execution time you are measuring.

    You might also consider looking up the PMU and see if this will do what you want. There are several threads on this in the E2E forum so just search for PMU using "Search Community."

    Finally, if you are looking for something that is native to FreeRTOS to measure these characteristics, then I would recommend you go to the FreeRTOS website and see if they might have any suggestions.

  • Thanks Chuck !

    I started reading about PMU and trying RTI free running counter for capturing the interrupt response.

    Your advice is of great help !