Does kernel knows an ISR is getting executed in FreeRTOS ?

ps-manikandan wrote on Wednesday, November 14, 2018:

1] i am using FreeRTOS[V8.0.0] on a ARM cortex M4.
2] i tried to measure the cpu free time using idle task and ticks.
3] created a task <application_task> with priority tskIDLE_PRIORITY+4 and redefined the macros traceTASK_SWITCHED_OUT/IN in FreeRTOSConfig.h file to get notified for IDLE’s entry and exit. Upon entry/exit and count the free ticks using “xTaskGetTickCount”.
4] <application_task> just runs a indefinite loop to print a string and sleeps for 2 seconds.
5] i also created a periodic timer (xTimerCreate) for every 10 seconds. In the timer callback i print the cpu free percentage.
6] I get 99% and it decreases when i reduce the sleep time in <application_task>.

With the above setup, i then programmed the spi and dma to do a memory to spi and spi to memory transaction continously through linked list dma. Once initialized for this, the M4 core will get a hardware peripheral(DMA) interrupt continoulsy every 200 micro seconds. In the ISR a very little code is written to modify the link list data. I ensured that this is happening continously but, there is no decrease in the cpu free percentage.

I don’t know whether FreeRTOS kernel knows about this ISR execution.
Does this ISR even preempts the scheduler ?
Is there any way to tell kernel about ISR execution ?
How do i include this ISR execution time into my cpu busy time ?

richarddamon wrote on Wednesday, November 14, 2018:

Since you are counting CPU usage by task switchs in and out of the Idle task, then ISR activity will be counted in whatever task was executing, as the running of an ISR does not involve a task switch. The M4 port (and similar Cortex ports) has no specific call for ISR entry, so the only way to measure ISR time would require you to manually add instrumentation calls in every ISR.

ps-manikandan wrote on Thursday, November 15, 2018:

ok, then there is a possibility that the ISR execution time may get counted into IDLE’s time which is incorrect. I will better increment a variable inside IDLE task and get the no load value for 5seconds. With this i can measure the IDLE’s time with more approximation !
Thanks for the clarification Richard.