VMSTAT — User Commands
NAME
vmstat − print virtual memory stats
SYNOPSIS
vmstat [−svmP] [−t interval] [−T maxSkip] [−l lines] [−fp threshold]
OPTIONS
−sPrint out statistics about all in-use segments instead of overall vm stats.
−vPrint out extra information when printing overall vm stats.
−t intervalPrint out a line of terse vm stats every interval seconds. If interval is specified as 0 then only a single line is printed.
−mPrint out the number of modified pages instead of kernel stack pages when using the −t option.
−l numLinesPrint out numLines lines before printing the header again when using the −t option. The default is 25 lines.
−f thresholdNumber of page faults per second before should print out stats with the −t option. No lines will be printed unless more than threshold page faults occur or the −p or −T options are in effect.
−p thresholdNumber of page-outs per second before should print out stats with the −t option. No lines will be printed unless more than threshold page-outs occur or the −f or −T options are in effect.
−T maxSkipMaximum number of times to skip printing out statistics because of the −f and −p options.
−PPrint out statistics since the last time that they were printed, not since the last interval. Used with the −t option.
DESCRIPTION
This command prints out virtual memory statistics. There are three possible formats and types of information that are printed. The default is to print overall virtual memory statistics; the volume of statistics that are printed is controlled by the −v option. If the −s option is specified then statistics about all actively used segments are printed instead. If the −t option is specified then a terse line of information is printed at regular intervals; the −TlfpPm options control how the data is formatted and how often it is printed. The next three sections describe the three printing formats in more detail.
GENERAL STATISTICS
By default vmstat prints out general statistics about the virtual memory system. If the −v option is specified then more detailed statistics will be printed. The normal information that is printed is divided into 5 sections: memory use, segment use, page fault statistics, page-out statistics and copy-on-write activity. The memory use section is titled “MEMORY STATS” and contains 6 lines of information with the following titles and information:
Page SizeThe logical page size; this is a multiple of the physical page size.
Memory SizeThe amount of physical memory in Kbytes that is available on the machine.
Kernel MemoryThe amount of memory in Kbytes that is being used by the kernel. There are four pieces of information on this line (from left to right): the total amount of memory used by the kernel, the portion of the total that is used for kernel code and data, the portion used for kernel stacks and the portion that is kept in emergency reserve.
User MemoryThe amount of memory in Kbytes that is being used by user processes. There are 3 pieces of information on this line (from left to right): the total amount of memory used by user processes, the portion of the total that is dirty and the portion that is clean.
FS MemoryThe amount of memory in Kbytes that is being used by the file system. The 3 pieces of information on this line are (from left to right): the total amount of memory used by the file system, the minimum amount of memory that has ever been used and the maximum amount that has been used.
Free MemoryThe amount of memory in Kbytes that is not being used by anyone.
The second section of statistics is entitled “SEGMENT STATS”. This section contains four lines of information, one each for active code segments, inactive code segments, heap segments and stack segments. Each contains the number of segments of the given type and the amount of memory in Kbytes that is being used by the particular type of segment.
The third section of statistics is entitled “FAULT STATS”. The first line contains the total number of faults. The second line divides the total faults into the 7 different types of faults:
ZeroPages that are filled with zeroes.
FSPages that are filled from an object file in the file system.
SwapPages that are filled from a swap file.
QuickPage faults that were handled merely by validating the page in hardware.
COWCopy-on-write faults.
CORCopy-on-reference faults.
COR-modFaults that occured because pages that were filled because of copy-on-reference faults were marked as read-only. This is done to compare copy-on-reference to copy-on-write (see vmcmd for details).
The third line divides the faults into the different segments that the faults occured in. The last line is the number of faults that collided with another process faulting on the same page.
The fourth section which is entitled “PAGE-OUTS” contains the number of pages that were written to swap space.
The last section is entitled “COPY-ON-WRITE” and contains statistics about copy-on-write and copy-on-reference behavior. The information in this section is presented as the number of faults that occured divided by the number of copy-on-write or copy-on-reference pages. Statistics are presented for both heap and stack segments separately (the entries are labeled Heap and Stack respectively) and for the sum of the heap and stack statistics (labeled Tot). The first two lines contain information about copy-on-write (COW) behavior, the second two about copy-on-reference (COR) behavior and the last two about the percentage of pages that were copied because of copy-on-reference faults that were eventually modified (COR-mod). The information about COW behavior contains an additional statistic labeled Quick which is the number of copy-on-write faults that were handled by merely changing the protection; no copy was required.
When the −v option is specified additional results are presented. These results are more obscure and are probably only of interest to those who understand the internals of the Sprite virtual memory system. The first additional statistic is a measurement of the need for modify bits and is given under the “MEMORY STATS” section. This line of statistics which is labeled Mod page stats gives three bits of information. The first entry (labeled Pot-mod) is the number of page frames that were being actively used by heap and stack segments that were taken away from the segment and given to another segment; since these segments are writable, the pages in these segments are potentially modified. The second entry (labeled Not-mod) is the number of potentially modified pages that were clean. The last entry (labeled Not-hard-mod) is the number of potentially modified pages that did not have the hardware modify bit set; pages can be marked as modified by the virtual memory system (e.g. zero-filled pages) even though they do not have the modify bit set by the hardware.
The second extra set of statistics is under the “PAGE-OUTS” section. The first extra line which is labeled Clean-wait is the number of times that processes that were exiting had to wait because a page that they were freeing was being cleaned. The second line labeled Cleaner starts is the number of times that a page cleaner was started up to write out pages.
The remaining extra statistics that are printed with the −v option are under entirely different sections. The first section which is entitled “ALLOCATION STATS” gives statistics about the allocation of memory. The first line which is labeled Vm allocs gives the following information (from left to right): the total number of pages that were allocated, the portion of this total that came from the free list, the portion that came from the file system and the portion that came from the allocate list. The second line which is labeled VM-FS stats gives statistics about the virtual memory and file system negotiation. The first two entries give the number of times that the file system asked the virtual memory system for the age of its oldest page (labeled FS-asked) and the number of these times that a free page was available (labeled Had-free-page). The second two entries give the number of pages that the file system added to its cache and the number of pages that it deleted from its cache (labeled FS-map and FS-unmap respectively).
The next two lines of statistics under the “ALLOCATION STATS” section contains information about searching the memory lists. The first line gives how many times that the lists were searched for pages and how many times the memory was found on the free list and how many times it was found on the allocation list (labeled Free and In-use respectively). The second line gives information about why multiple iterations through the allocation list were required; most of the time the first element on the list can be used. This line contains the following information from left to right: the total number of extra searches, the portion of extra searches that were required because the page frame was locked (labeled Lock), the page frame was referenced (labeled Ref) or the page frame was dirty (Dirty).
The next section of statistics is entitled “LIST STATS”. This section gives the current number of pages that are on each of the four memory list.
The next section is labeled “PAGE MAPPING STATS”. This section gives the number of times a process had to wait because the fixed number of slots that are used to map user pages into the kernel’s virtual address spacce were all in use.
The last section is entitled “HARDWARE STATS” and contains information that depends on the hardware. For Sun workstations it contains statistics about many times one of the 8 hardware contexts had to be taken away from one process and given to another and the number of times that a hardware PMEG had to be taken away from one segment and given to another. For MIPS R2000/R3000 based machines such as DecStations, the number of times TLB pids were stolen from active processes is reported.
SEGMENT STATISTICS
When the -s option is given to vmstat then statistics about all in use segments are printed. There are 6 columns of information:
SEG-NUMThe segment number.
TYPEThe type of segment. The segment type can be Inactive for inactive code segments or Code, Heap or Stack for the other three types of segments.
SIZEThe total size of the segment’s virtual addres space in Kbytes.
RES-SIZEThe amount of physical memory occupied by the segment in Kbytes.
NUM-REFSThe number of processes that are actively using this segment.
OBJECT-FILE-NAME
The name of the object file that the code segment is being demand loaded from.
After the information about each individual segment is printed a summary of the segment information is printed.
STATISTICS AT REGULAR INTERVALS
If the −t interval option is given to vmstat then a line of terse statistics is printed out at regular intervals. If interval is 0 then only a single line of statistics is printed. If interval is greater than 0 then a line of statistics is printed out every interval seconds. If the −f faultThreshold and/or −p pageoutThreshold options are used then statistics will be checked every interval seconds but only will be printed out if the number of page faults in the last interval is greater than faultThreshold or the number of pageouts is greater than pageoutThreshold. If the −T maxSkip option is used then statistics will be printed out at least every maxSkip intervals regardless whether or not enough page-outs or page faults have occured.
All memory use statistics are printed in units of 1024 bytes. Each line contains 10 columns of information:
AVAILThe total amount of physical memory available.
FREEThe amount of memory that is not being used by anyone.
USERThe amount of memory that is being used by user processes.
KMEMThe amount of memory that is being used by the kernel for code and data.
KSTKThe amount of memory that is being used for kernel stacks.
FS$The size of the file system cache.
PF-NUMThe number of page faults that have occured.
PF-SWPThe number of page faults that were filled from swap space.
PF-FSThe number of page faults that were filled from the file system.
POUTSThe number of pages that were written to swap space.
If the −m option is specified then the KSTK column will be replaced by a column labeled MOD% which contains the percentage of user memory that is modified. The number of kernel stack pages will be added into the statistics under the KMEM column.
By default a new column header line will be printed after 25 lines of output. The −l lines option can be used to force the header line to be printed after lines lines of output are printed.
The number of page faults and page-outs that are printed are by default the number since the last interval. However, many intervals can be skipped because of the −f and −p options. The −P option will force vmstat to print out the number of faults and pageouts since the last time that a line was printed instead of since the last interval.
KEYWORDS
virtual memory, statistics
Sprite version 1.0 — July 03, 1990