The key difference between Proctool and the above mentioned tools is that Proctool provides a Motif graphical user interface. Also unlike ps, Proctool will periodically sample the processes and the kernel at user specified intervals. It also provides a way of graphing the data and in general, much more functionality.
The basic idea of Proctool was inspired by top, a freeware Unix tool available through most ftp archives.
Proctool's main window is split into three main panes:
The Control Area on the top contains control gadgets for Proctool. The Process Area is a list of processes similar to a ps(1) output. Processes in this window are selectable with the mouse button. The bottom pane is the System Area. This contains the system-wide information along with a per-CPU information line. The footer area of the main window is used as the message area. Most error messages are printed there.There are a number of popup command and property windows that are also useful and interesting. The graph window is the most visually entertaining. There is a process property window that lets you examine a process in detail and a system property window that lets you delve more deeply into the system as a whole.
A typical monitor expression is as follows:
which evaluates to all C-shell processes owned by the user walter.
Actions are invoked when a monitor's logical expression evaluates to true. Actions may consist of reminders such as beeps, mail and popups. Actions may also change the visual representation of the process in proctool, for instance displaying a process in another color such as red or yellow.
Some typical use of a monitor by a system's administrator:
Monitors are defined through the COMMANDS => MONITOR menu. All monitors must have a name associated with them and must be entered into the monitor list. Monitors may be active or inactive. An inactive monitor is ignored until activated. Normally activated monitors remain active until user intervention. Monitors may also be defined so that their actions are executed exactly once. These monitors deactivate themselves once their actions have been triggered.
Monitors are explained in greater detail in the section titled Monitor Window. The syntax of a monitor expression is shown in Appendix A.
Without root privileges, the user is restricted so they are unable to kill, renice, change the priority, or bring up a process property popup window on a process not owned by them.
The following is a description of the menus and menu items at the top of the main Proctool window.
Show Transcript | Brings up a window which holds a transcript of activities in the current proctool session. All commands that affect the state of a process, such as kill are transcripted. Monitors that are activated are also transcripted. The transcript is saved in a file. |
Save Current State | Saves the current tool state into an initialization file. The current viewpoint, sort parameters, current monitors and sampling rate are saved. The initialization file is called ".proc.init". Proctool first searches the user's home directory, followed by the value of the environment variable PROCDIR for the initialization file. |
Log Data | Enables one to create an ASCII log file that is updated at every sample period. |
Viewpoint | Selects which variables to show for the processes displayed in the Process Area |
Sort | Sort the processes in the main process window using process variables as keys |
Show/Hide Control Area | Toggle whether or not the control area is visible |
Show/Hide System Panel | Toggle visibility of the system pane |
Monitors | Brings up a window to define, activate, inactivate, or edit a monitor |
Process Control | Brings up a command window to change the priorities and scheduling parameters of all time-sharing and or real-time processes. On a MP box, allows one to bind a process to a particular CPU. |
Send Signal | Command window to send a signal to selected processes |
Processor Control | Gives the user the ability to selectively turn off and on a set of CPUs |
Set UID | Brings up a popup window which allows the user to enter the root passwd. This allows the user to run Proctool under privileged mode. |
Show Version | Shows the current version of the tool in the Message Area |
System Graphs | Brings up a graph window showing system-wide data |
Process Graphs | Brings up a graph window which graphs variables for a set of processes |
Process Paging Graph | Brings up a graph window which graphs detail paging information for one process only. |
Tool Properties | Set properties applicable to all of Proctool |
Process Properties | Brings up a property window showing a selected process's parameters. Typically a user will just double-click on a process in the Process Area instead of using this menu-item. |
System Properties | Brings up a detailed property window on system wide parameters. Typically, a user will just double-click anywhere in the System Area instead of using this menu-item. |
The following is description of the gadgets available in Proctool control area, the portion between the menu area and the process pane.
Kill -QUIT Button | Send a kill -QUIT command to the selected processes.
A user not running in privileged mode is not allowed to kill a process that has a different effective UID. |
Kill -KILL Button | Send a kill -KILL command to the selected processes.
A user not running in privileged mode is not allowed to kill a process that has a different effective UID. |
Renice Button | Renice the selected processes by the increment specified in the text field on the right. A user not running in privileged mode is not allowed to change the priority of a process that has a different effective UID. |
Sample Time Field | Set the sampling time to the interval specified.
After entering a new value, type the RETURN key for it to take effect. The value entered must be a valid base-10 integer value. Note: We generally recommend sampling times of at least 2 or 3 seconds. Smaller sampling times will cause Proctool to skew the data since Proctool itself will consume a lot of system resources. Certain operations invoked by the Process Property Window require a sizeable amount of CPU resources, so the sampling should be set accordingly. |
Update View Button | Get an update of the process and system data. This does not affect the sampling period. This will also update any visible graphs. |
Resume/Suspend Sampling Button | Turn off and on sampling. |
Find Text Field | Will find and select a process in the Process Area that matches what is in this field. The user can enter either a string, in which case it will try to match by CMD. They can also enter an integer value, in which case it will try to match by PID. In the case of a string, hitting the RETURN key repeatedly will cycle through all processes with the same CMD value. |
The Process Area show the list of current processes running on the system. The fields displayed for each process depends upon the viewpoint selected. The order of processes displayed in this window depends on the sort criteria selected. One may also use monitors to selectively hide or color processes displayed within the Process Area.
Processes may be selected from the Process Area. Many of the property and command windows requires the user to select one or more processes first. To select a process, point to it with the mouse and clicking it with either the left or middle button. Multiple processes may be selected by sweeping with the middle button down. (The selection behavior is based roughly on OpenWindows mechanism).
Double clicking on a process will bring up the Process Property Window. This window allows the user to examine in detail various aspects of the process.
The system pane shows system wide and per CPU information.
The system-wide statistics show the total number of processes and the number categorized by whether they are sleeping, running, idle, etc. On a single CPU system, there will be exactly one running process, namely Proctool itself.
Proctool will automatically detect the number of CPUs in a system and show the utilization times for each. One a single CPU system, the last PID field is not too interesting as it will always be Proctool. The time utilization field may be interesting on a multiple CPU system since it may show the load balance on the system.
The viewpoint command window allows the user to select which process parameters (resource variables) they want to see in the main process window pane. To change the current viewpoint, just enter a list of variables in the lower text field and hit the Apply button.
Viewpoints can be named and saved. This is done by entering the list of resource variables, then entering a viewpoint name in the top half of the command window, then hitting the Insert button. To replace an existing viewpoint definition, first select a viewpoint, edit the resource variable list on the bottom then hit replace. Hitting Reset resets the viewpoint to the previously set viewpoint.
The sort command window allows one to define the sort keys used to sort the processes visible in the Process Area. The default sort key is by PID.
Multiple sort keys can be specified, up to 20. By default, Proctool sorts in ascending order. One can choose to sort on a key in descending order by selecting the Sort Descending toggle switch before selecting a resource variable in the upper scrolling list.
Sort keys that are used in descending order are preceded by a tilde '~' in the textual representation.
For example, the sort window shows two keys, ~CPU% and RSS. This means that processes will be sorted so that the process consuming the most CPU resources (highest CPU% value) will be show first. In the event that two or more processes have the same value of CPU%, they will be sorted in ascending RSS usage.
A new set of keys specified in this window will take affect once the Apply button is selected.
The monitor window consists of the following components:
Monitor list | A scrolling list of monitor names. Activated monitors are preceded with an asterisk '*'. | |
Monitor Popup menu | There is a menu associated with the scrolling list of monitor names. Use this to easily activate or deactivate one or all the monitors. | |
Monitor name text field | The name of the current monitor or new monitor. | |
Monitor expression text field | Text field associated with the current monitor expression or a to be inserted monitor definition. You can manually enter the expression here or use the subexpression pane to do so. | |
Insert button | Inserts a monitor into the monitor list based on the current values in the current Monitor name, Monitor Expression, and Monitor Action fields. There can no more than one monitor with the same name. | |
Delete button | Deletes the currently selected monitor. | |
Replace button | Replaces the definition of the currently selected monitor with the values found in the Monitor name, Monitor Expression, and Monitor Action fields. |
To edit the definition of an existing monitor, first select it. The name, expression, and action fields will show its current definitions. The user may then change any of these fields and then replace it by hitting the Replace button.
Conflicts may occur during monitor evaluation. For example, one monitor may want to change a process to be shown in red, another to be shown in orange. In these cases, the action of the last monitor takes precedence, using the rules described previously.
The user may choose to customize the standard template. To do so, just edit this popup window. The edited template now becomes associated with the particular action. All other unedited monitor mail templates are not affected.
Note that the $USER, $CMD, $PID, and $EXPR are macros that are expanded at the time the action is invoked. They are replaced with the actual values of the process that triggered the monitor. In addition, the macro $EXPR expands to the actual monitor expression that was triggered. Note that all process resource variables may be used in the template (e.g. $RSS, $CPU, $NICE, etc.).
The command string does macro expansion just as the Monitor Mail text does (see above).
NOTE. Discretion should be observed on what kind of command is used here. In this version of Proctool, Proctool will hang until the command is completed.
ONCE | Trigger once and deactivate itself. |
ONCE PER PID | Trigger once per unique PID. The monitor keeps trackof each PID it triggered on. |
INDEFINITELY | Keep on triggering. |
Allows one to send any signal to the list of processes selected in Proctool main process window area. If more than one process is selected, the same signal is sent to each of the selected processes but the order is undefined. The user must have root privileges to send a signal to a process which they do not own. The results of sending the signal is shown in the transcript window. Hint - not a good idea to try this on Proctool itself!
The Process Control Window provides two set of functions.
Use this command window to obtain root privileges. Proctool starts up in a non-privileged mode unless invoked as root. By entering the root password, the user is then granted super-user privileges. Having this permission allows users to nice, kill, send signals, set run-time priorities and examine processes that they do not own.
This option is available only on multi-processor systems. It allows one to selectively turn off and on processors. When using this option, Proctool will check the status of the processors when this window is first popped up. After the user selects a change in status for one or more of the processors and hits the APPLY button, it will once again check the current status of the processors before applying the change. This is to avoid getting into situations where ALL of the processors are turned off !!
Processor ids are not necessarily numbered sequentially starting from 0. For example, on an SS10, a 2 processor system has CPUs number 0 and 2.
All graphs can be shown in either line mode or bar mode. The line mode charts the history, up to 60 samples. In bar mode, Proctool will always show at least two bar graphs, one representing the most current values and the other one showing the average values for all samples in its history buffer. Currently there are no facilities for history greater than 60 samples or graph replay capabilities.
Once a graph window is opened and it starts graphing, the updates occur in sync every time the main process window is updated. If a graph window is iconized, it's data is still updated though not rendered. If an user QUITs a graph window, then updating terminates.
page reclaims | vmstat re | pages reclaimed the free list (ie. without forcing a major page fault) |
minor faults | vmstat mf | A memory fault which doesn't necessarily require I/O |
pages in | vmstat pi | Kbytes/s read for memory management or generic I/O |
pages out | vmstat po | Kbytes/s written for memory management or generic I/O |
pages freed | vmstat fr | Kbytes/s put onto the free list by the page scanner |
pages desired | vmstat de | Kbytes of anticipated short-term memory shortfall |
pages scanned | vmstat sr | pages scanned by clock algorithm |
This window allows the user to graph a set of variables for a set of processes. There can be up to 4 graph areas in this window and you can choose up to 8 processes for each graph area.
size | - process size (in Kbytes) |
cpu% | - cpu percentage |
cpu | - cpu tick count (as from ps) |
cpu# | - The CPU id where the process last ran (always 0 for non-MP) |
ctime | - user+system time in seconds for child processes |
esec | - elapsed wallclock execution time in seconds |
io/s | - avg # blocks read/written per second by process |
heap | - process heap size (in Kbytes) |
lwp# | - maximum assigned LWP number |
mem% | - memory utilization percentage |
stack | - process stack size (in Kbytes) |
rss | - resident set size (in Kbytes) |
sys/s | - number of system calls per second |
time | - user+system time in seconds for this process |
mpf/s | - minor page faults per second |
msgs/s | - Messages sent/received per second |
pf/s | - major page faults per second |
cs/s | - context switches per second |
Here are the steps to graph a set of processes (see Processor Control Window):
This is a specialized graph for showing detail virtual memory page access patterns for one process. On Solaris 2.x, one can instruct the kernel to keep detailed accounting of which virtual memory pages a process accesses. Proctool breaks down the selected processes page usage with some detail, showing the of new text vs. data and read vs. write accesses on a per page granularity.
Only one process can be displayed in this graph. The selection mechanism is exactly the same as in the process graph.
NOTE: Using this option on a process will put a slight load on a system, it should not be used while doing a benchmark.
Also note that if you use "kill -9" to terminate Proctool, then it will not have any opportunity to disable the accounting which is being done by the kernel. If proctool is allowed to exit normally (or via any catchable signal), then it will reset this state gracefully.
The tool property window allows the user to set various parameters which apply to all of Proctool. The control gadgets in the window are described below:
The process property window presents information for a particular process. The kind of information presented here is generally too expensive (CPU-wise) to show for all processes in the main process window.
To invoke this window, double click on a process in the main window's process area. The contents of the Process Property Window can be updated by hitting the Update button. One can also turn on the auto-update mode. When this is done, the contents are updated after every sampling time interval.
The system property window presents information that apply to the system as a whole. There are three available views. Selecting the Update button updates the data should it be changed from within or without Proctool. This window may be selected through the PROPERTIES menu -> SYSTEM PROPERTIES menu item or by double clicking on the system pane.
% ftp sunsite.unc.edu Name (sunsite.unc.edu:morgan): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: 230 Guest login ok, access restrictions apply. ftp> cd /pub/sun-info/mde/proctool 250 CWD command successful. ftp> binary 200 Type set to I. ftp> get proctool_2.6.1_for_solaris_2.6_sparc.tar.Z ftp> quit 221 Goodbye.
% cd /opt/proctool % zcat proctool_2.6.1_for_solaris_2.6_sparc.tar.Z | tar xvf -
This will unpack the following files:
README | (Ascii) Simple installation guide (this section). |
proctool | Shell script used to invoke the proctool binary |
bin/proctool | (ELF Binary) GUI front end component. |
bin/pmon | (ELF Binary) Backend. Must be owned by root and set UID. |
bin/.proc.init | (Binary) Optional initialization file. |
bin/proc.help.txt | (Ascii) Help text. |
bin/proc.help.idx | (Ascii) Help index file. |
doc/proctool.html | (HTML) User's guide. |
doc/*.gif | (GIF) Images used in the User's guide |
% su root passwd: # chown root bin/pmon # chmod u+s bin/pmon # ^D % ls -l bin/pmon -r-sr-xr-x 1 root staff 524288 Aug 16 1996 pmon*
We've also implemented some special resources which may also be specified in the same locations:
Proctool is actually two processes, proctool and pmon. proctool is the GUI front-end. pmon is a setuid (to root) program that reads the /proc and kernel data structures to get the necessary information and passes it to proctool. There are a number of reasons for having two processes:
1) To preserve security of the system. Many of the operations done by pmon require root privileges hence pmon is setuid to root; proctool is not.
2) Future distributed systems. A future enhancement may involve having multiple pmons on various systems and a centralized proctool. This would allow monitoring multiple systems.
Proctool's GUI was implemented using Motif on Solaris 2.x using ANSI C.
Traceback - Occasionally is unable to find an entry point, and prints it out as "???????". Does not work on a.out files running under Binary compatibility mode. Tracebacks are extremely slow and could use optimization work.
Memory map- There is some guesswork in the description of some memory map segments. For example, if a segment maps to a shared library, then if it has execute but not write privileges, it is assumed to be the text. Doesn't work on a.out files running under Binary compatibility mode.
Error messages- When displayed in the footer area of the main window or a popup, they sometimes get quickly overwritten by something else. Most errors are also written into the transcript but not all.
Customizing fonts, etc. Most fonts, colors, etc. can be customized using your standard Xt resources. In some cases, Proctool has some fixed non-customizable resources. Examples are the font type in the process and system window. This may change in the future.
If the problem isn't easy to reproduce, and if either of the programs dump core, then please include the core file in the bug report (or at least include a traceback from dbx or adb).
If the display program (proctool) is dying without leaving a core file, you can invoke it under a debugger and ask for a traceback when it quits. This could also be done with the monitor program (pmon), but is more difficult since you would have to attach to the running program.
For pmon problems, try setting the environment variable PROCTOOL_DEBUG and re-running. This will generally cause the program to dump information about what went wrong and what it was doing.
One other useful debugging technique is to run Proctool under truss; and include the last few hundred lines of output in the bug report, for example:
<expr> | ::== | <expr_list> |
<expr_list> | ::== | <subexpr> [ <logical op> <expr_list> ] |
| | <paren_list list> [ <logical op> <expr_list> ] | |
<paren_list> | ::== | '(' <expr_list> ')' |
<subexpr> | ::== | <valvar> <relational op> <valvar> |
<valvar> | ::== | <value> |
| | <varname> | |
<logical op> | ::== | 'AND' | 'OR' |
<relational op> | ::== | '==' | '!=' | '<' | '>' | '>=' | '=<' |
<value> | ::== | <integer value> | <string> | <float value> |
O | On processor | On the currently running process. On a uniprocessor, this will always be the monitor process, pmon, since it is obviously running while it is probing the system. |
R | Runnable | The process is in the run queue and is ready to be dispatched. |
Z | Zombie | The process has terminated and its parent process is not waiting for it. |
T | Stopped | The process is in the stopped state. Contrary to the ps man page, it is not necessarily being traced. |
S | Sleeping | The process is waiting for an event to complete. |
I | Idle | The process is being created. |
X | SXBRK | The process is waiting for more primary memory. |
TS | Time Share Class | Most user application processes |
IA | Interactive Class | Processes run under the X window manager |
SYS | System Class | Scheduler, pageout daemon |
RT | Real Time Class | Real-time data acquisition process |
0x0001 | PR_STOPPED | The LWP is stopped. |
0x0008 | PR_ASLEEP | The LWP is sleeping in a system call. |
0x0010 | PR_FORK | Inherit-on-fork is in effect. |
0x0020 | PR_RLC | Run-on-last-close is in effect. |
0x0100 | PR_ISSYS | System Process. |
0x0200 | PR_STEP | The LWP has a single-step directive in effect. |
0x0400 | PR_KLC | Kill-on-last-close is in effect. |
0x1000 | PR_PCOMPAT | Ptrace compatibility mode is in effect |