Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

FreeRTOS kernel overhead

Posted by mcmagnus on 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 configUSETICKLESSIDLE=1. Then i use the PRE/POSTSLEEPPROCESSING 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?


FreeRTOS kernel overhead

Posted by edwards3 on October 20, 2016

Integer rounding errors? They will always round down.

Try without the sleep mode. Make sure the idle task is the only task running at 0 priority and use the run time stats to see how much cpu it gets.


FreeRTOS kernel overhead

Posted by mcmagnus on October 21, 2016

It might be a set of closed source 3pp tasks I have running. If I disable that stack (a BT stack), the problem goes away, so my guess is they get many very short slices which are normally shorter than the ~4ms which is the RTC resolution (not an ideal behaviour). I need to verify this more closely, but that's my working theory right now.

Thanks for your input, I'll try without the sleep mode.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS