# Finding Task Creation time in FreeRTOS

**URL:** <https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866>\
**Category:** Kernel\
**Tags:** monitoring\
**Created:** [November 11, 2021, 2:58am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866 "2021-11-11T02:58:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinceab](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@vinceab](https://forums.freertos.org/u/vinceab)\
**Post date:** [November 11, 2021, 2:58am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/1 "2021-11-11T02:58:44Z")

</div>

Hi, I want to measure some parameters such as Boot Time, Task Creation Time, Mutex Lock Time, in order to do a performance analysis. How could I go about doing it?. xTaskGetTickCount() doesn’t seem to work as it only returns the ticks after the scheduler has started the tasks.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [November 11, 2021, 3:04am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/2 "2021-11-11T03:04:47Z")

</div>

First is to understand how to configure the system for throughput. For example, the thing that takes the longest in a context switch is checking for a stack overflow - but that is actually nothing to do with the context switch. See [https://freertos.org/FAQMem.html#ContextSwitchTime](https://freertos.org/FAQMem.html#ContextSwitchTime) for hints on configuration. Next is to decide what it is you are measuring. For example, are you measuring the number of instructions to perform an operation, or the speed at which you are clocking the MCU? If the former then the easiest way is to use a simulator that allows you to see the number of clock cycles. If the later then you can use an oscilloscope with digital IO marking times, or a fast clock on the MCU. You can also use a trace tool - but by doing so you are also measuring the time taken to make the trace recordings.

[edit] Should also say to understand the nuances of the system. For example: [https://freertos.org/2020/09/decrease-ram-footprint-and-accelerate-execution-with-freertos-notifications.html](https://freertos.org/2020/09/decrease-ram-footprint-and-accelerate-execution-with-freertos-notifications.html) [/edit]

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [November 11, 2021, 3:52am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/3 "2021-11-11T03:52:53Z")

</div>

It depends a LOT on the CPU and the resources you have available, and how long of a span you might need.  
Many processors have hardware timers that you can read and the differences will give you the elapsed time in some defined unit (at least until the counter wraps).

---

<div class="post-metadata">

**Author:** ![johankraft](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@johankraft](https://forums.freertos.org/u/johankraft)\
**Post date:** [November 12, 2021, 5:19am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/4 "2021-11-12T05:19:06Z")

</div>

Are you aware of our Tracealyzer tool? It allows ypu to add “user events” in the code and measure the time in between (using “custom intervals”).

---

<div class="post-metadata">

**Author:** ![vinceab](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@vinceab](https://forums.freertos.org/u/vinceab)\
**Post date:** [November 12, 2021, 5:27am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/5 "2021-11-12T05:27:50Z")

</div>

Where can I get it from? I’m currently using the SPIKE simulator for simulating a RISC-V processor.

---

<div class="post-metadata">

**Author:** ![johankraft](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@johankraft](https://forums.freertos.org/u/johankraft)\
**Post date:** [November 12, 2021, 6:27am UTC](https://forums.freertos.org/t/finding-task-creation-time-in-freertos/13866/6 "2021-11-12T06:27:57Z")

</div>

See [https://percepio.com/tz/freertostrace](https://percepio.com/tz/freertostrace).
