Task Stack Info & Profiling Features
Most RTOS give stack space info and profiling. While FreeRTOS has the stackfree function, the tskTCB record doesn’t seem to retain the orignal stack space. I find it difficut to remember how much stack space I gave a task unless I go back and look it up in the code. I added that to my task.c tskTCB record and changed the prvListTaskWithinSingleList() function to report the USED space and the TOTAL space, which I think is far more useful. My console task list output now looks like this:
Task Stack Info & Profiling Features
I agree. I have written some similar tools when I was involved in properiary RTOS and it proved to be exteremely useful.
But you have to remember that FreeRTOS runs on micros with very small memory footprint, so these tools should be optionally compiled by enabling them in FreeRTOSConfig.h file
Task Stack Info & Profiling Features
I have one suggestion: why not put both informations on the same table?
it would make it much easyer to use and probably smaller…
I would like very much to have that… where can I find it?
Richard, can you consider including that in FreeRTOS? please?
Alain
Task Stack Info & Profiling Features
Yes I too would very much like to see the source code made available for the CPU % usage. Is there a way for you to post it this forum? Or somewhere else?
Bob
Task Stack Info & Profiling Features
Sounds like a good idea to (optionally) include some profiling features. I would like to see how you have done it, either posted here (formatting can be a problem) or you could send it to me at r (dot) barry (at) freertos.org.
I have done similar things using the trace macros whereby the traceTASK_SWITCHED_IN() macro is used in combination with a high frequency timer to "count" the time each task is running for. A function can then be written to either simply display the total time, or if processing overhead is not an issue display the time each task is running as a percentage.
Regards.
Task Stack Info & Profiling Features
Doing the Profiling only takes a few hundred bytes of ROM on an ARM7 and minimal RAM. But I also have some other features in here such as a Performance Timer that has uSec resolution. I find it indispensible for timing routines and performance tuning. FreeRTOS doesn’t do anything with the main Timer Prescale, it is set to div by 1. Much better default would be to always set this up to provide a 1MHz master clock into the main Timer Counter, and then you have a standard 1uSec resolution time base.
I also have a single file module for a stand alone Console/printf/sprintf that dumps out the task info and profiling on demand to a RS232 terminal, and also takes commands from the terminal. Does not use any lib functions so that usually saves ROM space. You can easily add custom command support also to display anything you want.
I don’t think there’s anyway to attach files here, and it’s probably too much to stick in the msg portion. I will send Richard an email with the stuff.
Task Stack Info & Profiling Features
Hi Chris, I would like to test that code too…
Could you please put that code in some public repositoty, like www.pastebin.ca so that you can add just the link here in nthe forum.
Thanks, Alain
Task Stack Info & Profiling Features
Hi,
I wonder how many stack space should be defined during creating a task. Does a task stack size relate to a queue size which is used in the task? for example, if I create a queue in size of 400 bytes, does it mean the task stack size must be bigger than 400 bytes? I could not find any information regarding set task stack info in FreeRTOS.org.
Also I am interested in Chris Strahm mentioned above the Task Stack Profiling and other features. I wonder if Richard got the source code. Could you please email the source code to me? Or let me know where it posted. My email address: yyang@parvus.com
Regards,
Bill Yang
Task Stack Info & Profiling Features
xQueueCreate calls pvPortMalloc which uses xHeap which is a global (whose size is defined by configTOTAL_HEAP_SIZE), so no.
You can use this function: http://www.freertos.org/uxTaskGetStackHighWaterMark.html
Task Stack Info & Profiling Features
I am a novice to FreeRtos. I find it very hard to keep track of size size, cpu time utilitization of each task. Many things that I do, for example, changing a priority of a task that does nothing causes
the lwip stack to fail completely. or overflowing the stack or RAM with two much dynamic memory allocation. Many times, the processor would stop working completely.
Does anyone know where I can find the source code to find out stack watermark level, and cpu profiling? I do not think i can continue developing in freertos without this tool. Please help.
Thank you.
Task Stack Info & Profiling Features
http://www.freertos.org/Stacks-and-stack-overflow-checking.html
http://www.freertos.org/rtos-run-time-stats.html
http://www.freertos.org/uxTaskGetStackHighWaterMark.html
http://www.freertos.org/a00021.html#vTaskList
http://www.freertos.org/a00021.html#vTaskGetRunTimeStats
Regards.