How can I accurately measure CPU usage for these ISRs while addressing nested interrupts?
I am using FreeRTOS on an STM32F4-Nucleo board and
vTaskGetRunTimeStats()
to measure task CPU usage with the following code:
The g_osRuntimeCounter
is incremented in a timer callback, and I can measure CPU usage for tasks and IDLE time. However, I need to track CPU usage for specific ISRs (CAN reception and USB-OTG), which are interrupt-based.
Context:
- The interrupts for CAN and USB-OTG are triggered frequently , which are 10ms and 5ms respectively . Understanding the impact of ISRs on task performance is important in this setup.
- The hardware timer used for g_osRuntimeCounter
runs at a frequency of 1MHz which determines how accurately I can track time.
Challenges:
- I am unsure how to extend this setup to measure CPU usage inside ISRs, especially with interrupt nesting complicating things.
- Timer increments within ISRs may affect the accuracy of the measurement.
How can I accurately measure CPU usage for these ISRs while addressing nested interrupts? Should ISR CPU usage be tracked separately from task CPU usage?0 Replies