CPU load and interrupts

I have implemented measurement of the CPU load thanks to traceTASK_SWITCHED_IN(), traceTASK_SWITCHED_OUT() macros and a high frequency free running timer as proposed in freertos_Percentage_use_of_the_CPU_180e5758j.html and in measuring-cpu-usage/177

This works fine but it is not clear to me if this takes time spent into ISR into account or not. I’ve carried out some testing and I believe that time spent in ISR which interrupt the idle task is counted as idle time which is not correct. Can someone confirm this or suggest a reliable way to verify it?

Unless you add instrumenting to all your ISRs, time in the ISRs will count to the time of the task they interrupt.

Thanks for your answer. This confirms what I saw. Instrumenting all ISR is not worth the effort since they are all quite short and processing is offloaded to tasks.