We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
While running a multi-threaded system on coretx-M0+ using RTX, I want to measure percentage of time spent in each task on the CPU and time spent in idle task. Can anyone suggest a way to do that?
You can enable DBG_MSG in RTX
#ifdef DBG_MSG #define DBG_INIT() dbg_init() #define DBG_TASK_NOTIFY(p_tcb,create) if (dbg_msg) dbg_task_notify(p_tcb,create) #define DBG_TASK_SWITCH(task_id) if (dbg_msg && (os_tsk.new!=os_tsk.run)) \ dbg_task_switch(task_id) #else #define DBG_INIT() #define DBG_TASK_NOTIFY(p_tcb,create) #define DBG_TASK_SWITCH(task_id) #endif
DBG_TASK_SWITCH will be called every task swtich. If ms is a good enough resolution for you, you can use the SysTick to keep track of the time spent in each task. If it is not good enough you will need to enable a higher resolution timer and use that.
Sorry - you will want to replace these routines with your routines. Using the ITM is not going to do what you want. Or just use this as an example. It is making the calls in the locations that you want.