VxWorks Reference Manual : Libraries

spyLib

NAME

spyLib - spy CPU activity library

ROUTINES

spyLibInit( ) - initialize task cpu utilization tool package

DESCRIPTION

This library provides a facility to monitor tasks' use of the CPU. The primary interface routine, spy( ), periodically calls spyReport( ) to display the amount of CPU time utilized by each task, the amount of time spent at interrupt level, the amount of time spent in the kernel, and the amount of idle time. It also displays the total usage since the start of spy( ) (or the last call to spyClkStart( )), and the change in usage since the last spyReport( ).

CPU usage can also be monitored manually by calling spyClkStart( ) and spyReport( ), instead of spy( ). In this case, spyReport( ) provides a one-time report of the same information provided by spy( ).

Data is gathered by an interrupt-level routine that is connected by spyClkStart( ) to the auxiliary clock. Currently, this facility cannot be used with CPUs that have no auxiliary clock. Interrupts that are at a higher level than the auxiliary clock's interrupt level cannot be monitored.

All user interface routine except spyLibInit( ) are available through usrLib.

EXAMPLE

The following call:

    -> spy 10, 200
will generate a report in the following format every 10 seconds, gathering data at the rate of 200 times per second.
NAME          ENTRY       TID   PRI  total % (ticks)  delta % (ticks)
--------     --------    -----  ---  ---------------  ---------------
tExcTask     _excTask    fbb58    0    0% (       0)    0% (       0)
tLogTask     _logTask    fa6e0    0    0% (       0)    0% (       0)
tShell       _shell      e28a8    1    0% (       4)    0% (       0)
tRlogind     _rlogind    f08dc    2    0% (       0)    0% (       0)
tRlogOutTask _rlogOutTa  e93e0    2    2% (     173)    2% (      46)
tRlogInTask  _rlogInTas  e7f10    2    0% (       0)    0% (       0)
tSpyTask     _spyTask    ffe9c    5    1% (     116)    1% (      28)
tNetTask     _netTask    f3e2c   50    0% (       4)    0% (       1)
tPortmapd    _portmapd   ef240  100    0% (       0)    0% (       0)
KERNEL                                 1% (     105)    0% (      10)
INTERRUPT                              0% (       0)    0% (       0)
IDLE                                  95% (    7990)   95% (    1998)
TOTAL                                 99% (    8337)   98% (    2083)
The "total" column reflects CPU activity since the initial call to spy( ) or the last call to spyClkStart( ). The "delta" column reflects activity since the previous report. A call to spyReport( ) will produce a single report; however, the initial auxiliary clock interrupts and data collection must first be started using spyClkStart( ).

Data collection/clock interrupts and periodic reporting are stopped by calling:

    -> spyStop

INCLUDE FILES

spyLib.h

SEE ALSO

spyLib, usrLib


Libraries : Routines

spyLibInit( )

NAME

spyLibInit( ) - initialize task cpu utilization tool package

SYNOPSIS


void spyLibInit (void)

DESCRIPTION

This routine initializes the task cpu utilization tool package. If the configuration macro INCLUDE_SPY is defined, it is called by the root task, usrRoot( ), in usrConfig.c.

RETURNS

N/A

SEE ALSO

spyLib, usrLib