cpuuse [-r]
This command may be used to print a report on the per thread
cpu usage or to reset the per thread CPU usage statistics. When
invoked with the -r
option, the CPU usage statistics
are reset.
This command returns 0 on success and non-zero if an error is encountered.
The granularity of the timing information reported is dependent upon the BSP and the manner in which RTEMS was built. In the default RTEMS configuration, if the BSP supports nanosecond granularity timestamps, then the information reported will be highly accurate. Otherwise, the accuracy of the information reported is limited by the clock tick quantum.
The following is an example of how to use cpuuse
:
SHLL [/] $ cpuuse CPU Usage by thread ID NAME SECONDS PERCENT 0x09010001 IDLE 49.745393 98.953 0x0a010001 UI1 0.000000 0.000 0x0a010002 SHLL 0.525928 1.046 Time since last CPU Usage reset 50.271321 seconds SHLL [/] $ cpuuse -r Resetting CPU Usage information SHLL [/] $ cpuuse CPU Usage by thread ID NAME SECONDS PERCENT 0x09010001 IDLE 0.000000 0.000 0x0a010001 UI1 0.000000 0.000 0x0a010002 SHLL 0.003092 100.000 Time since last CPU Usage reset 0.003092 seconds
In the above example, the system had set idle for nearly
a minute when the first report was generated. The
cpuuse -r
and cpuuse
commands were pasted
from another window so were executed with no gap between.
In the second report, only the shell
thread has
run since the CPU Usage was reset. It has consumed
approximately 3.092 milliseconds of CPU time processing
the two commands and generating the output.
This command is included in the default shell command set.
When building a custom command set, define
CONFIGURE_SHELL_COMMAND_CPUUSE
to have this
command included.
This command can be excluded from the shell command set by
defining CONFIGURE_SHELL_NO_COMMAND_CPUUSE
when all
shell commands have been configured.
The cpuuse
is implemented by a C language function
which has the following prototype:
int rtems_shell_rtems_main_cpuuse( int argc, char **argv );
The configuration structure for the cpuuse
has the
following prototype:
extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command;
Copyright © 1988-2008 OAR Corporation