# Profiling task execution

**URL:** <https://forums.freertos.org/t/profiling-task-execution/1697>\
**Category:** Kernel\
**Created:** [July 10, 2008, 5:13pm UTC](https://forums.freertos.org/t/profiling-task-execution/1697 "2008-07-10T17:13:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 10, 2008, 5:13pm UTC](https://forums.freertos.org/t/profiling-task-execution/1697/1 "2008-07-10T17:13:41Z")

</div>

**[jakbird](https://sourceforge.net/u/jakbird/)** wrote on [Thursday, July 10, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/4bcc91b9/#9422):

I’d like to profile task execution in a STR750 ARM environment, running FreeRTOS.&nbsp; Is it possible, with trace enabled, to add some code to the timer hook to look at the pxCurentTCB task block and count the number of times a task is active at the time tick, using the uxTCBNumber field as an index into an array of counters?&nbsp; Does pxCurrentTCB still point to the last running task when vApplicationTickHook is called?

I already have a low priority operator command line task running, which I can use to process the counter array and display percentage execution time by task.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 10, 2008, 5:26pm UTC](https://forums.freertos.org/t/profiling-task-execution/1697/2 "2008-07-10T17:26:52Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Thursday, July 10, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/4bcc91b9/#9422/f43a):

The old tick hook is called before a task is selected to run. Look at using the trace macros instead which provide greater flexibility. [http://www.freertos.org/rtos-trace-macros.html](http://www.freertos.org/rtos-trace-macros.html)
