Per-Task Statistics Run-Time
µC/OS-III maintains statistics for each task at run-time. This information is saved in the task’s OS_TCB
.
.CPUUsage
This variable keeps track of CPU usage of the task (multiplied by 100). For example if the task’s .CPUUsage
is 200 then the task consumes 2.00% of total CPU usage.
The variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to DEF_ENABLED
in os_cfg.h
.
.CPUUsageMax
This variable keeps track of the maximum (i.e. peak) CPU usage of the task (multiplied by 100). For example if the task’s .CPUUsageMax
is 571 then the task maximum CPU usage that the task consumed at any given time is 5.71% of total CPU usage. This variable is reset by OSStatReset()
.
The variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.CtxSwCtr
This variable keeps track of the number of times a task is context switched-in. This variable should increment. If it does not increment, the task is not running. At a minimum, the counter should at least have a value of one since a task is always created ready-to-run. However, if higher priority tasks prevent the task from ever running, the value would be 0.
This variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.IntDisTimeMax
This variable keeps track of the maximum interrupt disable time of a task (in CPU_TS
units). This variable shows how each task affects interrupt latency.
The variable is declared only when CPU_CFG_INT_DIS_MEAS_EN
in cpu_cfg.h
is set to
DEF_ENABLED
.
.MsgQ.NbrEntries
This variable indicates the number of entries currently waiting in the message queue of a task. This variable is declared only when OS_CFG_TASK_Q_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.MsgQ.NbrEntriesMax
This variable indicates the maximum number of entries placed in the message queue of a task. This variable is declared only when OS_CFG_TASK_Q_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.MsgQ.NbrEntriesSize
This variable indicates the maximum number of entries that a task message queue is able to accept before it is full.
This variable is declared only when OS_CFG_TASK_Q_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.MsgQPendTime
This variable indicates the amount of time it took for a task or an ISR to send a message to the task (in CPU_TS
units).
The variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.MsgQPendTimeMax
This variable indicates the maximum amount of time it took for a task or an ISR to send a message to the task (in CPU_TS
units).
This variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.PendOn
This variable indicates what a task is pending on if the task is in a pend state. Possible values are:
- 0 Nothing
- 1 Pending on an event flag group
- 2 Pending on the task’s message queue
- 3 Pending on multiple objects
- 4 Pending on a mutual exclusion semaphore
- 5 Pending on a message queue
- 6 Pending on a semaphore
- 7 Pending on a task’s semaphore
.Prio
This corresponds to the priority of the task. This might change at run time depending on whether or not the task owns a mutual exclusion semaphore, or the user changes the priority of the task by calling OSTaskChangePrio()
.
.SchedLockTimeMax
This variable keeps track of the maximum time a task locks the scheduler (in CPU_TS
units). This variable allows the application to see how each task affects task latency. The variable is declared only when OS_CFG_SCHED_LOCK_TIME_MEAS_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.SemPendTime
This variable indicates the amount of time it took for a task or ISR to signal the task (in CPU_TS
units).
This variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.SemPendTimeMax
This variable indicates the maximum amount of time it took for a task or an ISR to signal the task (in CPU_TS
units).
This variable is declared only when OS_CFG_TASK_PROFILE_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.State
This variable indicates the current state of a task. The possible values are:
- 0 Ready
- 1 Delayed
- 2 Pending
- 3 Pending with Timeout
- 4 Suspended
- 5 Delayed and Suspended
- 6 Pending and Suspended
- 7 Pending, Delayed and Suspended
.StkFree
This variable indicates the amount of stack space (in number of stack entries) unused by a task. This value is determined by the statistic task if OS_CFG_TASK_STAT_STK_CHK_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.StkUsed
This variable indicates the maximum stack usage (in number of stack entries) of a task. This value is determined by the statistic task if OS_CFG_TASK_STAT_STK_CHK_EN
is set to
DEF_ENABLED
in os_cfg.h
.
.TickRemain
This variable indicates the amount of time left (in clock ticks) until a task time delay expires, or the task times out waiting on a kernel object such as a semaphore, message queue, or other. This value is actually a ‘relative’ value based on the position of the OS_TCB
in the delta list. In other words, .TickRemain
does not contain the actual count left.