Quality RTOS & Embedded Software

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


Processor occupancy tracing: why isn't it there?

Posted by erupter on June 13, 2014

I'm thinking about using the TASKSWITCHEDIN/OUT macros to record the time spent in processing time by each task. This is something available on every operating system and I wonder why that isn't part of the normal tracing capabilities.

Surely there is a reason for not including such a functionality by default?

Processor occupancy tracing: why isn't it there?

Posted by davedoors on June 13, 2014


You just have to fill in the macro that returns the time stamp, which can't be part of the standard kernel code because where it comes from depends on the mcu you are using and which timers are free on that mcu. There are some standard ways of providing the time stamp on Cortex mcus that use raw systick timer values.

you can also look at http://www.freertos.org/uxTaskGetSystemState.html and http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTrace/FreeRTOSPlusTrace.shtml

Processor occupancy tracing: why isn't it there?

Posted by erupter on June 13, 2014

Thanks Dave

I'm again getting up to speed on FreeRTOS after years, and I totally forgot about this -_- By looking into my old code I had the runtime stats setup already, with the core timer and everything.

I'm getting old :P I remember reading something about the impact of the tracing features, but can't find it. Do you know anything about this?

Processor occupancy tracing: why isn't it there?

Posted by davedoors on June 13, 2014

The timing impact? Well, as with all the features that add code (stack overflow detection, assert points, and the like) there is a code size and execution speed impact. The impact of gathering run time information depends on the implementation of the function that returns the time stamp. If it is simply reading a register then the impact will be one read, and one write, per context switch (actually, probably a little more). If the time stamp needs to be pre-processed then the impact will be higher.

Formatting statistical information into human readable table is another matter. That takes a long time and is not really something you want to be doing outside of your debug code.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists