FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2014 Threads]
I want to know a simple method to calculate running task execution time.
Is there any FREE RTOS API can do this?
There are several ways of doing this, but in each case you need to supply a fast clock as a time base. The fast clock needs to provide time at a rate many times higher than the tick count increment, otherwise you will not get the resolution you need.
If you are using a Cortex-M then a convenient method is to use the cycle counter from the debug circuitry - if you are using Cortex-M (would have been easier if you had stated which chip you were using in your original question) then let me know and I can point you in the direction of the appropriate code. Otherwise here is a generic page on the subject:
http://www.freertos.org/rtos-run-time-stats.html
In addition you can define the traceTASKSWITCHEDIN or traceTASKSWITCHEDOUT macros to do whatever you want, including keeping your own run time date. Finally you could the FreeRTOS+Trace tool.
Regards.
I am using Cortex-M3 (Atmel SAM3U4E).
FreeRTOS Resolution of 1 ms is very small to what I want to measure. It will be good if I have a resolution of 50-100 Micro Sec if possible.
You can use the run-time stats implementation found in the SAM4E demo. Look at the file RunTimeStatsTimer.c in FreeRTOSDemoCORTEXM4ATSAM4EAtmelStudiosrc, and the run time stats related FreeRTOSConfig.h settings in FreeRTOSDemoCORTEXM4ATSAM4EAtmelStudiosrcconfigFreeRTOSConfig.h.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.