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




Loading

Measuring task execution time with vApplicationTickHook()

Posted by swammaws on July 15, 2016

Hi, I wanted to ask how can I measure the created task execution time with vApplicationTickHook(). It gets called at tick but what should I do to calculate task execution time

Regards,

swam


Measuring task execution time with vApplicationTickHook()

Posted by richard_damon on July 15, 2016

You may want to look at http://www.freertos.org/rtos-run-time-stats.html which talks about the build in faciltiy to measure task execution time.


Measuring task execution time with vApplicationTickHook()

Posted by swammaws on July 16, 2016

Thanks for the reply.Actually the problem is like rhis there are two tasks one with higher priority and and heavy and otherwithl  low priority just printing at some regular interval and i wanted to find exection of both jobs that will occur at some intervals in milliseconds.Is it possible with to meaausre with tickhook?


Measuring task execution time with vApplicationTickHook()

Posted by rtel on July 16, 2016

It would be hard to do that with the tick hook as it is not what the hook is for, so it does not have access to the information necessary.

As Richard Damon has already highlighted, there is a run time stats facility which will give you the total amount of time each task is consuming. If you what the run time for individual executions then you could use the trace hook macros http://www.freertos.org/rtos-trace-macros.html - specifically the traceTASKSWITCHEDIN() or traceTASKSWITCHEDOUT macros - where the pxCurrentTCB variable is available to you so you know which task is being switched in or out (depending on the macro you define). A similar thread: https://sourceforge.net/p/freertos/discussion/382005/thread/d20f4bf7/


Measuring task execution time with vApplicationTickHook()

Posted by swammaws on July 16, 2016

ok thnks alot. Sorry Im new to freeRtos and I have one more thing to ask. I want to change the priority of task I created in main . in some other task as in mycase priority set task and I was having problem that when I do it the following way it doest give any output Am I doing it right?

BaseTypet yReturned; TaskHandlet communication_handle = NULL; //outside main

~~~ int main { .// new code yReturned = xTaskCreate((pdTASKCODE)communication, (signed char *)"Communication", configMINIMALSTACKSIZE, NULL, 1, &communicationhandle);

zReturned = xTaskCreate((pdTASKCODE)prioritysettask, (signed char *)"Priorityset", configMINIMALSTACKSIZE, NULL, 5, &priorityset_handle); // ......... } ~~~

Now wht i m doing is using handler of communication task not inside main but Priorityset one

I am setting the priority of communication task to new value as follows

~~~ static void priorityset_task() {

while (1) {

vTaskPrioritySet(communication_handle, 2);

}

} ~~~

Is it the right way to use handler or I need to do something else?

Thanks


Measuring task execution time with vApplicationTickHook()

Posted by rtel on July 16, 2016

Looks right.


[ 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