mcmagnus wrote on Thursday, October 20, 2016:
I’m trying to find where ~10% of the time are spent, this is how I’m looking:
I’m using TICKLESS mode by setting configUSE_TICKLESS_IDLE=1.
Then i use the PRE/POST_SLEEP_PROCESSING hooks to take the time spent in sleep mode. I measure the number of ms from the PRE call to the POST call using the RTC of the STM32F4 MCU.
Every 10 seconds, i.e. when the RTC have passed 10000 ms since the last report, I print a report saying how much time I have spent in the sleep state and the exact number of ms passed since the last report. This number is very often ~10% lower than the total amount of ms passed.
I have also added a snippet to log the task status, or rather the diff of the task time compared to the last report. Then I always get the IDLE task at the top, but according to RTOS, the IDLE has always used up very close to the total time. I usually also see some other tasks that have spent a couple of ms each, but nowhere near the missing 10% (1 second per 10 seconds).
However, sometimes I do see a very close correlation between the time spent in sleep mode, the total and the IDLE time, so it’s not a problem with the RTC being 10% skewed compared to the clock used for the RTOS ticks.
I also tried to add debug logs in all? IRQ functions but didn’t see that any was used at the time.
Anybody got any ideas?