First determine if swapping is actually occurring.
There is a sysinfo structure in the kernel (defined in <sys/sysinfo.h>) which contains counters updated by various kernel subsystems. Typically, these counters continue to be incremented as long as the system is running and re-set to zero each time the system is booted.
The sysinfo structure has several fields regarding the swap subsystem.
Field Use
----- ---
swpque Number of "swapped-out" processes "ready-to-run"
swpocc Is the swap "queue" occupied?
bswapin Number of pages actually swapped in (read off the swap device)
bswapout Number of pages actually swapped out (written to the swap device)
If the value of these fields are all zero, no swapping has occurred on the system since it was last booted.
A quick way to look at the kernel's sysinfo structure is by using the adb(1) command in the following manner:
# adb -k /unix /dev/kmem
To display a particular field in the structure, you can use an offset as in the following adb input string.
sysinfo+0x38/X
The offsets of the fields described above are as follows:
Field Offset
----- ------
swpque 0x70
swpocc 0x74
bswapin 0x40
bswapout 0x44
In a system where no swapping has occurred, a session using the adb command to check these counters will look like this:
# adb -k /unix /dev/kmem
a.out file = /unix (COFF format)
core file = /dev/kmem
ready
sysinfo+0x70/X
sysinfo+0x70: 0x0
sysinfo+0x74/X
sysinfo+0x74: 0x0
sysinfo+0x40/X
sysinfo+0x40: 0x0
sysinfo+0x44/X
sysinfo+0x44: 0x0
<Control-d>
#
Since these counters are cumulative (if they are non-zero) swapping activity has occurred in the system. If you want to gain insight into historical activity patterns, the sar(1) command can be used with the -q and -w options to gather this kind of information.
If swapping is occurring and you want to understand the swapping characteristics better, configure and analyze the data from the System Accounting package. This will give you information on several aspects of the activities taking place in the system.
To enable the Systems Accounting Package, you need to modify the file /usr/spool/cron/crontabs/adm by removing the leading comment sign (#) from all of the lines.
To have cron(1) read the changes made to this file and schedule the processes you want executed, do the following:
# cd usr/spool/cron/crontabs
# vi adm (make the changes mentioned above or use TextEditor)
# su adm
% crontab < adm (If you do not do this and just type 'crontab', the adm crontab file will be initialized)
After this, typing the command crontab -l, should return the active crontab for the adm user
% crontab -l
0 4 * * 1-6 /usr/lib/acct/runacct 2> /usr/adm/acct/nite/fd2log
0 2 * * 4 /usr/lib/acct/dodisk
5 * * * * /usr/lib/acct/ckpacct
15 5 1 * * /usr/lib/acct/monacct
0 * * * 0,6 /usr/lib/sa/sa1
0 18-7 * * 1-5 /usr/lib/sa/sa1
0 8-17 * * 1-5 /usr/lib/sa/sa1 1200 3
# The following is an option to appear in the above directory
0 20 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:00 -i 3600 -uybd
% exit
After this, you will get a report using the sar -w command that looks similar to this:
# sar -w
A/UX hostname 3.1 SVR2 mc68040 05/18/94
00:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s
01:00:00 0.01 0.0 0.00 0.0 85
02:00:01 0.01 0.1 0.00 0.1 85
03:00:01 0.00 0.0 0.00 0.0 85
04:00:00 0.00 0.0 0.00 0.0 85
05:00:00 0.01 0.1 0.00 0.0 85
06:00:00 0.01 0.0 0.00 0.0 85
07:00:01 0.01 0.1 0.00 0.0 85
08:00:01 0.01 0.1 0.00 0.0 85
08:20:01 0.01 0.1 0.00 0.0 85
08:40:01 0.00 0.0 0.00 0.0 85
09:00:01 0.02 0.2 0.00 0.0 85
09:20:01 0.02 0.2 0.00 0.0 85
09:40:02 0.00 0.0 0.00 0.0 85
10:00:00 0.02 0.2 0.00 0.0 85
10:20:00 0.05 0.4 0.00 0.3 81
Average 0.01 0.1 0.00 0.0 85
Note: With the default values in the /usr/spool/cron/crontab/adm file, the report will get an entry every 20 minutes during the day and once an hour during the night and weekends.
We recommend reading the manual entry for sadc(1) and the "System Activity Package" section in the "A/UX Local System Administration" manual. You should also read the manual entry for acct(1).