home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
debug
/
Monitor
/
SpySystem
/
SpySystem.doc
< prev
next >
Wrap
Text File
|
1995-06-25
|
19KB
|
491 lines
SPY Process Time Monitoring System
==================================
By Supervisor Software 1989,90,91,92
Revision 3.0
The SPY system allows one to monitor the overall CPU usage and the CPU
times consumed by various tasks and processes running on the Amiga.
These new program versions are NOT compatible with the older ones. Using
different versions simultaneously may cause a system crash.
This package consists of three different programs:
Spy v3.02 - This program loads and initializes a shared library which
contains the time monitoring routines and a few other
routines called by the tools included. This program must
be run before any other tools can be used.
DSD v3.00 - A graphic display of CPU loading with numeric information
about the system uptime and CPU load.
Report v3.00 - A CLI utility for listing all tasks and processes in the
system and showing their CPU usage information.
TopCPU v3.02 - A new addition to Spy system. This program currently
lists ten most CPU intensive tasks or processes and their
relative CPU usage.
CPUTime v0.50 - A new addition to Spy system. This program measures the
CPU time and real time consumed by any CLI program. This
program is currently in it's beta testing phase.
sssystem.library v5.3
- This is a shared library which must be present for the
other tools to work. This library must be initialized by
the Spy program before any timing measurements are done.
This is because it would otherwise be impossible to pass
any options to the library.
This package is primarly designed for the new Kickstart and Workbench 2.x,
but it will also run on Kickstart 1.3, although the CPU time measurement is
very inaccurate under 1.3 unless a CIA hardware timer is used (see below).
Use 'command ?' for a template, 'command ??' for human readable help or
'command ???' for full online help in any of the programs mentioned above.
Spy, DSD, and TopCPU may also be launched wrom Workbench (new in Release 3).
USAGE:
======
Spy
~~~
First run Spy to load and initialize sssystem.library. Spy will return
immediately, thus no RUN command is required. If you wish, you can later
later remove Spy from the Amiga by running it again with the Remove option.
Spy can only be removed from the system when no DSD/TOPCpu/CPUTime/Report
programs are running.
Spy has a few command line options to control the operation of the time
monitoring system.
Install installs Spy routines in memory (initializes the library)
Remove removes Spy routines from memory (deintializes the library)
Times sets Started time to current time for all tasks
Atimer uses CIAB timer A for timing
Btimer uses CIAB timer B for timing
You must always specify either Install or Remove (only the upper case
characters of any option are needed, so you can use I for Install and R
fo Remove).
The option Times causes all tasks and processes started _before_ Spy to
receive the current time as their starting time. That is, all processes
started before Spy will look like they were started at the same time with
Spy. If this option is NOT used, the processes mentioned will have an
'unknown' starting time.
All tasks and processes started _after_ Spy was run will always get the
real starting time in their structures.
Options A and B are used to allocate a CIA B hardware timer for accurate
time keeping. If neither is used, sssystem.library will use the time in
Dos library's RootNode (under Workbench 1.x) or the system ReadEClock()
routine (under Workbench 2.x).
It is recommended to use either A or B, especially under Workbench 1.x,
where there is no good way of reading an accurate time from the system.
An inaccurate time may cause serious timing problems with DSD, Report, and
TOPCpu.
Under Workbench 2.04, the accuracy of ReadEClock() is the same as that of
the sssystem.library's own CIA timer routines. However, the routines of
the sssystem.library are more optimized and result in slightly better
overall performance. If both CIA B timers are needed by other programs,
the options can be left out and the system's ReadEClock() used instead.
SpySystem can now be installed from Workbench using tool type "INSTALL".
Timers may be specified with "ATIMER" or "BTIMER", starting times may
be set with "TIMES" and removal of SpySystem is done with "REMOVE".
If Spy is started via a project icon, the tool types of that icon are
used for the program options.
DSD
~~~
You may start DSD right after running Spy. The initial x and y coordinates
for the DSD window can be specified on the command line. For example,
DSD x400 y0 sets the coordinates to (400,0). Specifying coordinates of -1
will open the window as far right and down as possible.
Normally DSD updates its display once a second. The user can specify a
different interval time (1...3600 seconds) using the Interval option:
DSD I60
sets the interval to 60 seconds.
DSD may be terminated at any moment by clicking its close gadget or sending
a CTRL+C signal to it.
The DSD display shows the CPU usage (load) in graphical form. When the
graph is low, the CPU load is low. When the CPU is fully loaded, the graph
will fill the entire display. The graph is updated once every <interval>
seconds, thus the approximate timing of load peaks can also be determined.
The Load numbers show the CPU loading. 100% means the CPU is fully loaded.
The number on the left hand side shows the value for the last seconds, the
other shows the CPU load calculated for the total Uptime.
IdleCPU shows the total amount of time that CPU has been idle (ie. it has
had nothing to do) and Uptime shows the time that the SPY system has been
running (usually Spy is started during machine boot so this will show the
total uptime of the Amiga).
Report
~~~~~~
Report is a CLI based utility used to list all tasks and processes running
on the Amiga. It shows many kinds of information about the tasks:
FIRST, it lists the Uptime, IdleCPU and Average Load:
Uptime: 0 00:23:15.140 Idle CPU: 0 00:21:04.494 Average Load: 9.39%
THEN, it lists all tasks and processes in alphabetical order:
num taskname (args) typ id pri task ptr stack used disp CPU time
1 AmiCron bw 4 0 078C1C68 8192 314 204 0.339
2 bin/keylock bw 2 0 078AFAF8 8192 118 0 0.000
3 CD0 pw 10 0788C648 6000 182 2306 0.781
4 CON pw 5 07901C18 3200 530 0 0.000
5 CON pw 5 0790B220 3200 530 0 0.000
6 CON pw 5 078DCE70 3200 530 0 0.000
7 CON pw 5 07871C50 3200 530 16 0.059
8 console.device tw 5 0780E160 4096 90 68 0.460
9 CON pw 5 078E5E48 3200 530 544 6.959
10 DF0 pw 10 07815B40 2400 130 0 0.000
11 DF2 pw 10 078352A0 2400 130 0 0.000
12 DH0 pw 10 07817FC0 2400 130 577 0.160
13 DH1 pw 10 078379C0 2400 130 800 0.340
14 DH2 pw 10 0783D708 2400 130 54 0.000
15 dsd bw 5 0 078E30C8 8192 152 1196 8.062
16 Enhancer v1.577 pw 10 07883988 8192 94 61 0.000
17 H0 pw 10 078230C0 2400 130 10 0.000
18 H1 pw 10 07829150 2400 130 0 0.000
19 H2 pw 10 0782F1F0 2400 130 0 0.000
.. .. .. .. ........ .... ... . .....
.. .. .. .. ........ .... ... . .....
.. .. .. .. ........ .... ... . .....
If ssystem.librayry is not active, the timing information for tasks and
processes is not available. In that case, the appropriate fields of output
will be blank.
The meanings of the colunms are:
num Line number of printout (may be disabled with option
-NONumbers)
taskname Name of task or process shown. Under Workbench 2.0, the
command line arguments of CLI commands are also shown.
typ Task or process type: First letter indicates if this is a
CLI background process (b), a process (p) or a simple task
(t). Second letter shows if this task or process is doing
nothing (waiting, w) or currently ready to run (ready, r).
id CLI identifier number.
pri Priority (-128...+127) of this task or process.
task ptr Task structure pointer of this task or process.
stack Stack size for this task or process.
used This many bytes of stack are in use.
disp Number of dispatches for this task or process (shows how
many times this task has been scheduled to run or how many
times it has needed CPU time).
CPU time CPU time used by this task or process, shown in seconds and
milliseconds (or seconds only when the value exceeds 1000000
seconds). This field is not reliable under WB 1.3 for the
current version of Spy without a CIA timer (see below).
total CPU (Not shown above) Total CPU time consumed by the current
task or process AND all tasks and processes created by it.
Note that the CPU usage of the child tasks and processes is
added to total CPU number only when the child or parent dies.
created (Not shown above) Time when this task or process was
started. This may be unknown for the tasks that were
launched before Spy was started (unless -Times option is
used for Spy).
idle (Not shown above) Time which the task or process has been
sleeping, needing no CPU time. If a CLI window or an
application program is not used, it usually needs no CPU
time and the idle time is seen here. Most system processes
need CPU time several times a second and this field is
blank (meaning no idle time for that process).
sigalloc (Not shown above) The task signal bits allocated by this
task or process.
sigwaitf (Not shown above) The signal bits this task or process is
currently waiting for.
sigexcpt (Not shown above) The signal bits on which this task or
process will execute an exception routine.
sigrecvd (Not shown above) The signal bits received by the task or
process.
parent (Not shown above) Task pointer for the process which created
the current one (empty if unknown or if parent process has
already died).
Report has several command line options:
[<pattern>|$<address>|#<cli_id>] [-Time] [-Format="<fmtchars>"]
[-Header[="<header>"]] [-NOHeader] [-[NO]Status] [-[NO]Numbers]
[-CLI] [-Proc] [-SIgnals] [-TAsk] [-Waiting] [-Ready] [-Unix]
The characters shown in UPPER CASE are obligatory, while those in lower
case are optional. Option strings are case-insensitive. Thus, -H, -He,
-HEA and -HeAdEr mean all the same option.
When <pattern> is specified, Report only lists tasks and processes whose
names match the given pattern string. Under Workbench 2.x, the standard
AmigaDOS wildcards can be used. Under 1.3, if the pattern string ends with
an asterisk (*) all task and process names beginning with the given
string will be listed.
When $<address> is specified, Report will only list one task with the
Task structure pointer of <address>. The address mus be given in
hexadecimal as shown in the task ptr field of Report output. If a given
task is not found, No match will be printed instead of the task's data.
When #<cli_id> is specified, Report will only list one CLI process
with the given CLI id number. The id must be a decimal number. If a given
process is not found, No match will be printed.
-Time option selects the alternate output format of Report, showing the
task starting and idle times instead of some other information.
-Format option can be used to specify a custom output format. <fmtchars>
may contain nay combination of the following formatting characters (cols
lists the number of columns that will be needed in output):
chr cols explanation
%n 22 task name and arguments (shorter format, 22 columns)
%N 30 task name and arguments (longer format, 30 columns)
%t 3 task or process type
%c 3 CLI process id
%p 4 priority
%a 8 address of Task structure
%s 11 stack size and usage
%d 5 number of dispatches
%T 10 CPU time consumed, long format
%H 5 CPU time consumed, short format (hh:mm)
%C 7 creation time of task or process
%i 6 idle tile of task or process
%S 36 task signal bits
%h 10 total CPU time including children which have died
%P 8 parent process Task pointer
The default format string is "%n %t %c %p %a %s %d %T" and the -Time format
is "%n %t %a %T %h %C %i".
-Header enables the header line for printing. If -Header="<header>" is
specified, the custom header line will be used instead of the standard
one. The header line can be set in the environment variable (see below).
-NOHeader and -Header control the printing of header. By default, the
header line is printed unless only one task or process is listed. For
every -NOHeader, one -Header must be given to reverse the option's effect.
-NONumbers and -Numbers control the printing of line numbers. By default,
the numbers are printed unless only one task or process is listed. For
every -NONumbers, one -Numbers must be given to reverse the option's effect.
-NOStatus and -Status control the printing of status line. By default, the
status line is printed unless only one task or process is listed. For
every -NOStatus, one -Status must be given to reverse the option's effect.
-CLI causes only CLI processes to be printed.
-TAsk causes only tasks to be printed.
-Proc causes only non-CLI processes to be printed.
If several flags are specified, all the specified task types will be printed.
By default, all types of tasks and processes are printed.
-Ready filters all waiting (idle) processes off the printing causing only
ready processes to be printed. -Waiting only prints processes which are
sleeping at the moment. These flags are mutually exclusive. By default,
all tasks and processes are printed recardless of their state. These flags
can not be set in the environment variable.
-Signals lists the states of task's signal bits (found in the Task structure).
-PArent option lists the parent processes if they are known.
Options for the Report command can be given in an environment variable
called 'report'. The command line options can be used to override the
defaults or the ones set by the environment variable when needed.
TopCPU
~~~~~~
TopCPU has similar options as DSD. TopCPU shows ten most CPU intensive
tasks or processes and the relative CPU times (percents) in both numeric
and graphical format.
You may start TopCPU right after running Spy. The initial x and y
coordinates for the TopCPU window can be specified on the command line.
For example, TopCPU x0 y200 sets the coordinates to (0,200). Specifying
coordinates of -1 will open the window as far right and down as possible.
Normally TopCPU updates its display every five seconds. The user can
specify a different interval time (0.1 to 60.9 seconds) using the Interval
option:
TopCPU I0.5
sets the interval to 0.5 seconds. Using shorter interval times increases
the CPU load caused by TopCPU due to more frequent display updates.
TopCPU may be terminated at any moment by clicking its close gadget or
sending a CTRL+C signal to it.
TopCPU lists ten tasks or processes getting most of the CPU time at a
time. The calculation is done for the whole Interval time; for example,
with the default interval of five seconds, a task which has gotten 60% of
the CPU time has consumed (60/100)*5 seconds or 3 seconds of CPU time.
The mincpu option sets the minimum CPU percentage to be displayed. The
value is given in promilles (0.1 percent):
TopCPU M5
sets the minimum CPU displayed to 0.5 percent.
CPUTime
~~~~~~~
CPUTime measures the real and CPU time used by a given CLI command like
a compiler or a sort program. The only arguments needed by CPUTime are
the command to be run and its arguments.
CPUTime CLI-command arguments
Only the CPU time used by <CLI-command>'s process is measured. If the
command outputs text or uses other file-I/O, the CPU time consumed by
the console window processes etc. is NOT taken into account.
CPUTime now outputs three values:
Fast0: 10> cputime say "Hello world"
Real 00:00:01.448, PCPU 00:00:00.046, TCPU 00:00:00.046
The first number shows the real time elapsed in HH:MM:SS.mil format (mil
means milliseconds). PCPU shows the CPU time consumed by the command
(here by say). TCPU shows the total CPU time used by the command and
any processes it creates (upto the moment they die or command exits,
whichever happens first).
TCPU does NOT include the CPU time used by any process which was not
created by the command.
NOTE: CPUTime currently uses Execute() routine to launch the commands.
This may change in the future. Main processes break signals are now
passed to the child.
NEW FOR RELEASE 3
=================
Release 3 of SpySystem now supports the Workbench. DSD, TopCPU, and Spy
may now be started from Workbench in a normal way. The following tool
types are recognized:
DSD: xcoord - sets the window x coordinate (in pixels)
ycoord - sets the window y coordinate (in pixels)
interval - sets the refresh time interval (in seconds)
CLIicon - uses the icon settings also when started from CLI
TopCPU: xcoord - sets the window x coordinate (in pixels)
ycoord - sets the window y coordinate (in pixels)
interval - sets the refresh time interval (in seconds)
CLIicon - uses the icon settings also when started from CLI
mincpu - sets the lowest CPU to be shown (in promilles)
nonull - disables the listing for NULL task
Spy: install - activates the SpySystem
remove - deactivates the SpySystem
times - sets all tasks' starting times
atimer - uses CIAB timer A for time keeping
btimer - uses CIAB timer B for time keeping
DSD and Report can read the default options from the icon file even when
started from CLI. To do this, the icon file must be in the same directory
with the executable command file AND the tool type CLIicon must be set for
the icon. The icon-set defaults can always be overridden on command like.
If CLIicon is NOT used, the icon information will NOT be used when starting
DSD and TopCPU. The CLIicon tool type has no effect when the program is
started from Workbench.
The Report command now has new functions. It keeps track of the child
processes CPU times as well as parent process pointers. See the
documentation for Report for more information.
TopCPU no longer shows the NULL task if CLI option -nonull or WB tool
type NONULL is used.
Other
=====
These programs are still under development. Feel free to send bug reports
or suggestions to the author.
Thank you for your interest.
Supervisor Software
Mail: E-Mail: Voice/FAX:
Jukka Marin jmarin@messi.uku.fi int. + 358 71 232 793
Metsurintie 17 B 8
70150 Kuopio
FINLAND