| ![]() | |||||||||
Appendix B: Kernel Variable Work Page B 1
Information Technology Honours Thesis October 1994
Appendix B Kernel Variable Work
Chapter 41 refers to research done in obtaining meaningful kernel variables. This Appendix
provides a kernel variable summary as well as sample output and source code from the kernel
variable querying program outlined in the text.
Kernel Variable Summary
Table 132 provides a comprehensive list of kernel variables encountered while conducting
research. Information held within this table was obtained from personal experience and
miscellaneous source code for system utilities (e.g. top and vmstat) and system include files.
The name and datatype columns are self explanatory. The access method refers to the
addresses parameter to be used in the kvm_read() system call. The next column states whether
the kernel variable has been used in the load sharing daemon presented in Chapter 6. Finally a
description is given based on the apparent meaning and use of the variable.
1. From the Section entitled ?Kernel Variables? on page 29, through other Sections up to page 33. 2. Footnotes associated with the table are located at the end of the table (on page B-3).
Table 13: Summary of kernel variable knowledge.
Name Datatype Access Method In
LSD
Description
_acctbuf struct accta acct; &acct no System accounting structure.
_avenrun intb aven[3]; (int *)aven yes Short, medium and long term system load averages.
_boottime time_t boottime; (&boottime) yes Machine boottime.
_ccpu int ccpu; (int *)(&ccpu) no Experientially based CPU property. Used by top.
_cnt struct vmmeterc
vm;
&vm no Virtual memory statistics
(1 second interval statistics).
_cp_time int time
[CPUSTATESd];
(int *)time yes Cumulative representation of a
machine?s CPU time distribution
in terms of user, niced, system and
idle processes.
_dk_bps int bps[DRIVESe]; (bps) no Drive speed in bits per second.
_dk_busy int busy; (int *)(&busy) no Indicates disk activity. Takes the
value of 1 if data is being
transferred to disk.
Appendix B: Kernel Variable Work Page B 2
Information Technology Honours Thesis October 1994
_dk_ndrive int drives; (int *)(&drives) no Maximum number of attached drives.
_dk_read int read[DRIVES]; (read) no Number of bytes read.
_dk_seek int seek[DRIVES]; (seek) no Drive seek time if available.
_dk_time int time[DRIVES]; (time) no Disk drive time information.
_dk_wds int wds[DRIVES]; (wds) no Disk drive information.
_dk_xfer int xfer[DRIVES]; (xfer) yes Transferred data specified in bytes.
_eintrcnt int cnt; (int *)(&cnt) no Cumulative interrupt counter with the initial value _intrcnt.
_epages pointer (type *)(&page) no A pointer to the end of the page structure. Used by top.
_free unsigned int
free;
(int *)(&free) yes Amount of memory free expressed
in number of pages.f
_hz int hz; (int *)(&hz) yes Clock frequency used for the control of regular interrupts.
_intrcnt int cnt; (int *)(&cnt) no Initial interrupt counter.
_maxmem unsigned long
max;
(int *)(&max) yes Physical free memory capacity
expressed in number of pages.
_mpid int mpid; (int *)(&mpid) no Process id of the most recently executed process.
_mp_time int time[NCPU]
[CPUSTATES];
(int **)time no Same as _cp_time, but for a
multiprocessor system.
_nproc unknown (int *)(&nproc) no Used by top. It appears to be the
number of processes or the size of
the process table.
_pages pointer (type *)(&page) no A pointer to the beginning of the page structure. Used by top.
_phz int phz; (int *)(&phz) no Alternate clock frequency (see _hz).
_proc pointer (type *)(&proc) no Pointer to the process table. Used by top.
_rate struct vmmeterg
vm;
&vm no Virtual memory statistics
(5 second average statistics).
Table 13: Summary of kernel variable knowledge.
Name Datatype Access Method In
LSD
Description
Appendix B: Kernel Variable Work Page B 3
Information Technology Honours Thesis October 1994
Sample Program Output
Section 4.1.2 (?Kernel Variables?) on page 29 presents a program for displaying kernel
variables to the screen. The following is some sample output from the program run on thor.
Note that some values in the output are consistent with those seen in Table 1 on page 1.
Kernel Variables
~~~~~~~~~~~~~~~~
LOADS (short,medium,long) ARE: 45 57 72 -> 0.18 0.22 0.28
CP_TIME: 0 = user processes | 1 = nice | 2 = system | 3 = idle CP_TIME 0 is 1803807 |CP_TIME 1 is 9799615 |CP_TIME 2 is 3801707 |CP_TIME 3 is 5447216 | Total CP_TIME : 20852345
MPID (last pid) : 5588
Memory Available: 30732288 KBytes Memory Free : 2400256 KBytes
Initial interrupt counter is : 0 Cumulative interrupt counter is: 20852346
PAGES (start of page structure): 0xF8246500 EPAGES(end of page structure): 0xF8290B50
FORKSTATS: 32785 forks, 377668 pages, average 11.52 2680 vforks, 102183 pages, average 38.13
a. Refer to system include file <sys/acct.h> for definitions. b. int refers to long int unless otherwise specified. c. Defined in the system include file <sys/vmmeter.h>. d. System constant CPUSTATES as defined by the include file, <sys/dk.h>. e. Refer to system include file <sys/dk.h> for definitions. f. The page size is defined by the constant PAGESIZE in the include file, <machine/param.h>. g. Defined in the system include file <sys/vmmeter.h>. h. Defined in the system include file <sys/vmmeter.h>.
_sum struct vmmeterh
vm;
&vm yes Virtual memory statistics
(Free running counter).
_tk_nin int nin; (int *)(&nin) no Disk input statistic.
_tk_nout int nout; (int *)(&nout) no Disk output statistic.
_total int total; (int *)(&total) no Used by top and vmstat.
_xp_time int time[NCPU]
[XPSTATES];
(int **)time no Extra states for multiprocessor
system (Similar to _mp_time).
Table 13: Summary of kernel variable knowledge.
Name Datatype Access Method In
LSD
Description
Appendix B: Kernel Variable Work Page B 4
Information Technology Honours Thesis October 1994
CLOCK FREQUENCY: default is 100 (alternative is 0)
BOOTTIME: System booted at time 780097679, some 208499 seconds ago
Sun 4c architecture: yes Machine Implementation: SPARCstation 2
DVMA Size: 246
Virtual Address Cache: yes shm_allignment:(for VAC) 0x10000
DISK INPUT/OUTPUT INFORMATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TK: Number in: 138279
TK: Number out: 5631783
Drive busy (writing data): no Number of virtual drives : 32
Drive Times: (non zero figures only) 00 : 329945 : Average = 1.58
Drive Seeks: (non zero figures only)
Drive XFERs: (non zero figures only) 00 : 176820 : Average = 0.85
Drive WDS s: (non zero figures only) 00 : 23191400 : Average = 111.23
Drive BPS s: (non zero figures only) 00 : 2457600 : Average = 11.79
Drive READs: (non zero figures only) 00 : 58716 : Average = 0.28
VMMETER VARIABLES
~~~~~~~~~~~~~~~~~
CNT: (5 second interval accum)
122 :context switches
178 :calls to trap
595 :calls to syscall()
251 :device interrupts
0 :pseudo-dma interrupts [UNUSED]
0 :pages swapped in
0 :pages swapped out
6 :pageins
0 :pageouts
12 :pages paged in
Appendix B: Kernel Variable Work Page B 5
Information Technology Honours Thesis October 1994
0 :pages paged out 2 :intransit blocking page faults 0 :total page reclaims (includes pageout) 0 :found in free list rather than on swapdev 0 :found in free list rather than in filsys 0 :pages filled on demand from executables [UNUSED] 15 :pages zero filled on demand 0 :fills of pages mapped by vread() [UNUSED] 0 :number of exfods created [UNUSED] 0 :number of zfods created [UNUSED] 0 :number of vrfods created [UNUSED] 0 :page reclaims from free list 155 :total page faults taken 0 :page examinations in page out daemon 0 :revolutions of the paging daemon hand 0 :pages taken from sequential programs [UNUSED] 0 :pages freed by daemon 0 :fast reclaims in locore [UNUSED] 0 :swapins (different time duration)** 0 :swapouts(different time duration)**
SUM: (free running counter)
7934460 :context switches
7383148 :calls to trap
28031653 :calls to syscall()
26442296 :device interrupts
0 :pseudo-dma interrupts [UNUSED]
99188 :pages swapped in
99364 :pages swapped out
52905 :pageins
3928 :pageouts
128909 :pages paged in
35815 :pages paged out
5007 :intransit blocking page faults
510061 :total page reclaims (includes pageout)
3778 :found in free list rather than on swapdev
505017 :found in free list rather than in filsys
0 :pages filled on demand from executables [UNUSED]
556408 :pages zero filled on demand
0 :fills of pages mapped by vread() [UNUSED]
0 :number of exfods created [UNUSED]
0 :number of zfods created [UNUSED]
0 :number of vrfods created [UNUSED]
508795 :page reclaims from free list
4476563 :total page faults taken
183143 :page examinations in page out daemon
24 :revolutions of the paging daemon hand
0 :pages taken from sequential programs [UNUSED]
85309 :pages freed by daemon
0 :fast reclaims in locore [UNUSED]
124716 :swapins (different time duration)**
0 :swapouts(different time duration)**
Appendix B: Kernel Variable Work Page B 6
Information Technology Honours Thesis October 1994
RATE:(previous interval)
88 :context switches
164 :calls to trap
562 :calls to syscall()
197 :device interrupts
0 :pseudo-dma interrupts [UNUSED]
0 :pages swapped in
0 :pages swapped out
0 :pageins
0 :pageouts
2 :pages paged in
0 :pages paged out
0 :intransit blocking page faults
0 :total page reclaims (includes pageout)
0 :found in free list rather than on swapdev
0 :found in free list rather than in filsys
0 :pages filled on demand from executables [UNUSED]
8 :pages zero filled on demand
0 :fills of pages mapped by vread() [UNUSED]
0 :number of exfods created [UNUSED]
0 :number of zfods created [UNUSED]
0 :number of vrfods created [UNUSED]
0 :page reclaims from free list
147 :total page faults taken
0 :page examinations in page out daemon
0 :revolutions of the paging daemon hand
0 :pages taken from sequential programs [UNUSED]
0 :pages freed by daemon
0 :fast reclaims in locore [UNUSED]
5 :swapins (different time duration)**
0 :swapouts(different time duration)**
Accounting buffer:
~~~~~~~~~~~~~~~~~
0 :Accounting flag
0 :Exit status
0 :Accounting user ID
0 :Accounting group ID
0 :control typewriter
0 :Beginning time
0 :Accounting user time
0 :Accounting system time
0 :Accounting elapsed time
0 :average memory usage
0 :chars transferred
0 :blocks read or written
:Accounting command name
Appendix B: Kernel Variable Work Page B 7
Information Technology Honours Thesis October 1994
Miscellaneous
~~~~~~~~~~~~~
CPU Speed: 243 -> -0.052116
Unknown pointers
~~~~~~~~~~~~~~~~
PROC: 4163044088 : 0xF82302F8
Unknown output
~~~~~~~~~~~~~~
TOTAL: 0
NPROC: 202
NINODE: 438
Source Code
The following few pages contain the source code of the program. Refer to Appendix H entitled
?Summary of Disk Contents? for the location of the source code.