RTEMS Logo

RTEMS 4.9.3 On-Line Library


RTEMS Specific Commands cpuuse - print or reset per thread cpu usage

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

5.2.1: cpuuse - print or reset per thread cpu usage

SYNOPSYS:

cpuuse [-r]

DESCRIPTION:

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.

EXIT STATUS:

This command returns 0 on success and non-zero if an error is encountered.

NOTES:

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.

EXAMPLES:

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.

CONFIGURATION:

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.

PROGRAMMING INFORMATION:

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;


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation