The application may dynamically report the CPU usage for every
task in the system by calling the
rtems_cpu_usage_report
routine.
This routine prints a table with the following information per task:
The following is an example of the report generated:
CPU Usage by thread ID NAME TICKS PERCENT 0x04010001 IDLE 0 0.000 0x08010002 TA1 1203 0.748 0x08010003 TA2 203 0.126 0x08010004 TA3 202 0.126 Ticks since last reset = 1600 Total Units = 1608
Notice that the "Total Units" is greater than the ticks per reset. This is an artifact of the way in which RTEMS keeps track of CPU usage. When a task is context switched into the CPU, the number of clock ticks it has executed is incremented. While the task is executing, this number is incremented on each clock tick. Otherwise, if a task begins and completes execution between successive clock ticks, there would be no way to tell that it executed at all.
Another thing to keep in mind when looking at idle time, is that many systems -- especially during debug -- have a task providing some type of debug interface. It is usually fine to think of the total idle time as being the sum of the IDLE task and a debug task that will not be included in a production build of an application.
Copyright © 1988-2008 OAR Corporation