This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Time spent per task in RTX

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?

Parents
  • 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.

Reply
  • 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.

Children