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


vTaskGetRunTimeStats Errors

Posted by gstenos on August 5, 2016

I'm running FreeRTOS v 7.3.0 and am having trouble getting vTaskGetRunTimeStats() to compile in my code.

In FreeRTOSConfig.h I added the following line at the top of the file; extern volatile unsigned long ulHighFrequencyTimerTicks;

This is how my code looks like for enabling run time stats in the file, in code it is just # and not (#), for some reason when I just do # as the first character on the line it turns the text into huge header text.

/* Run time stats gathering definitions. */ (#)if defined (GNUC) || defined (ICCARM) void configuretimerforruntimestats( void ); uint32t getruntimecountervalue( void );

(#)define configGENERATERUNTIMESTATS 1 (#)define portCONFIGURETIMERFORRUNTIMESTATS() ( ulHighFrequencyTimerTicks = 0UL ) (#)define portGETRUNTIMECOUNTERVALUE() ulHighFrequencyTimerTicks (#)endif

These are the errors I get, they are all located in tasks.c: undefined reference to `ulHighFrequencyTimerTicks' tasks.c 1098 Code at 1098: pxCurrentTCB = NULL;

undefined reference to `ulHighFrequencyTimerTicks' tasks.c 1594 Code at 1594: prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) pxDelayedTaskList, ulTotalRunTime );

undefined reference to `ulHighFrequencyTimerTicks' tasks.c 1851 Code at 1851: taskFIRSTCHECKFORSTACKOVERFLOW();

undefined reference to `ulHighFrequencyTimerTicks' tasks.c 2414 Code at 2414: vPortFree( pxNewTCB );

I've made certain tasks.c includes FreeRTOS.h which includes FreeRTOSConfig.h where the variable is decalred. Is there something else I need to do to the variable in order for it to be used in tasks.c?

vTaskGetRunTimeStats Errors

Posted by edwards3 on August 5, 2016

I can only see an extern declaration for ulHighFrequencyTimerTicks in the code you posted, you need also to declare the variable somewhere in a C file.

ulHighFrequencyTimerTicks is not provided with FreeRTOS, you have to provide it yourself. The example on the web shows the variable being incremented in a fast timer isr, which is ok if your app has a fast timer isr anyway, but if not its more efficient to have portCONFIGURETIMERFORRUNTIMESTATS() call a function that starts a free running timer, then have portGETRUNTIMECOUNTER_VALUE() just return the timer count value so you dont need a variable at all. I think the web has such an example too.

vTaskGetRunTimeStats Errors

Posted by gstenos on August 5, 2016

Ahhhh I see, I thought tasks.c would still have scope of the variable. If that's the case then would I be able to just use xTaskGetTickCount() instead of creating a new timer entirely?

vTaskGetRunTimeStats Errors

Posted by rtel on August 6, 2016

See the description of the portCONFIGURETIMERFORRUNTIME_STATS() macro on the following page: http://www.freertos.org/rtos-run-time-stats.html

While you could use the tick count, the resolution would not be high enough to give you accurate results because you could not measure tasks that executed for a fraction of a tick period.

[ 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