Tải bản đầy đủ
Figure 7.2 MemTool GUI: File System Cache Memory

Figure 7.2 MemTool GUI: File System Cache Memory

Tải bản đầy đủ

250

Memory Monitoring

Table 7-6 MemTool Buffer Cache Fields
Field
Resident
Used

Shared
Pageins
Pageouts
Filename

Description
The amount of physical memory that this file has associated with it.
The amount of physical memory that this file has
mapped into a process segment or SEGMAP. Generally,
the difference between this and the resident figure is
what is on the free list associated with this file.
The amount of memory that this file has in memory that
is shared with more than one process.
The amount of minor and major page-ins for this file.
The amount of page-outs for this file.
The file name if known; otherwise, the file system
mount point and inode number are shown.

7.4.3.2 Process Memory
The second mode of the MemTool GUI is the process memory display. Click on the
Process Memory checkbox at the left of the GUI to select this mode. The process
memory display shows the process table with a memory summary for each process. Each line of the process table is the same as the per-process summary from
the pmap command. Figure 7.3 shows the fields; Table 7-7 describes them.

MemTool: Unbundled Memory Tools

251

Figure 7.3 MemTool GUI: Process Memory

Table 7-7 MemTool Process Table Field
Field
PID
Virtual
Resident

Description
Process ID of process.
The virtual size of the process, including swapped-out
and unallocated memory.
The amount of physical memory that this process has,
including shared binaries, libraries, etc.

252

Memory Monitoring

Table 7-7 MemTool Process Table Field (Continued)
Field
Shared

Private

Process

Description
The amount of memory that this process is sharing with
another process, that is, shared libraries, shared memory, etc.
The amount of resident memory this process has that is
not shared with other processes. This figure is essentially Resident - Shared.
The full process name and arguments.

To select the individual process map for a process, click on one of the process
entries.

7.4.3.3 Process Matrix
The process matrix, Figure 7.4, shows the relationship between processes and
mapped files. Across the top of the display is the list of processes that we viewed in
the process memory display, and down the side is a list of the files that are mapped
into these processes. Each column of the matrix shows the amount of memory
mapped into that process for each file, with an extra row for the private memory
associated with that process.
The matrix can be used to show the total memory usage of a group of processes.
By default, the summary box at the top right-hand corner shows the memory used
by all of the processes displayed. We can select a group of processes with the left
mouse button and then summarize by pressing the Selection button at the
top-middle of the display. Selecting the All/Filt button returns the full display.

Other Memory Tools

253

Figure 7.4 MemTool GUI: Process/File Matrix

7.5

Other Memory Tools
Two other memory tools—Workspace Monitor (wsm) and memstat (an extended
vmstat)—provide additional information.

7.5.1 The Workspace Monitor Utility: WSM
Another good utility for monitor memory usage is the workspace monitor. It shows
a live status of a processes memory map and lists the amount of memory that has
been read or written to in the sampled interval. This information is particularly

254

Memory Monitoring

useful for determining how much memory a process is using at any given instant.
The wsm command is invoked against a single process.
# wsm -p 732 -t 10
Read
235
10
207
14
2
0
0
0
1
1
0
0
0
0
0
0
0
26
2
0
0
0
0
0
2
0
500

Write
0
11
384
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
3
401

Mapped
782
36
2690
74
3
1
1
1
2
1
56
4
3
2
1
9
1
54
3
4
1
1
1
14
2
6
3753

PROT
(R-X)
(RWX)
(RWX)
(R-X)
(RWX)
(RWX)
(R-X)
(RWX)
(R-X)
(RWX)
(R-X)
(RWX)
(RWX)
(R-X)
(RWX)
(R-X)
(RWX)
(R-X)
(RWX)
(R-X)
(RWX)
(RWX)
(R-X)
(R-X)
(RWX)
(RWX)

Segment
maker5X.exe(pid 683) Mon Jul 21 15:44:10 1997
maker
maker
Bss & Heap
/usr/lib/libc.so.1
/usr/lib/libc.so.1
/dev/zero
/usr/lib/straddr.so
/usr/lib/straddr.so
/usr/platform/SUNW,Ultra-2/lib/libc_psr.so.1
/dev/zero
/usr/lib/libnsl.so.1
/usr/lib/libnsl.so.1
/dev/zero
/usr/lib/libmp.so.2
/usr/lib/libmp.so.2
/usr/openwin/lib/libXext.so.0
/usr/openwin/lib/libXext.so.0
/usr/openwin/lib/libX11.so.4
/usr/openwin/lib/libX11.so.4
/usr/lib/libsocket.so.1
/usr/lib/libsocket.so.1
/dev/zero
/usr/lib/libdl.so.1
/usr/lib/ld.so.1
/usr/lib/ld.so.1
Stack
Totals

The counters in the wsm utility are in units of pages.

7.5.2 An Extended vmstat Command: memstat
Additional paging statistics are provided in the Solaris 7 kernel. Later, in Solaris
8, a new vmstat option (-p) was added to examine these statistics. The statistics
can be observed on Solaris 7 with a simple command-line utility: memstat.
memstat shows the paging activity, page-ins, page-outs, and page-frees separated into three classes: file system paging, anonymous memory paging, and executable/shared library paging.

Other Memory Tools

255

free = free memory measured in pages

Global Paging Counters
re = pages reclaimed from the free list
mf = minor faults – the page was in memory but was not mapped
pi = pages paged in from file system or swap device
po = pages paged out to file system or swap device
fr = pages that have been destroyed or freed
de = pages freed after writes

Executable Paging Counters

CPU Summary

epi = executable and library pages that are paged in
epo = executable and library pages that are paged out (should be zero)
epf = executable and library pages that are freed

us = user cpu time
sy = kernel cpu time
wt = wait cpu time
id = idle cpu time

Anonymous Paging Counters
api = anonymous pages that are paged in from swap
apo = anonymous pages that are paged out to swap
apf = anonymous pages that are freed

File Paging Counters
api = file pages that are paged in
apo = file pages that are paged out
apf = file pages that are freed

# memstat 3
memory
--free
16128
15184
15152
14968
15184
15704
16192
16976
17376

---------- paging ----------- - executable re mf
8
0
12
0
6
0
19
0
23 192
8
0
16 15
4 54
1 83

pi
341
354
160
162
242
194
202
200
194

po
1629
1720
1522
1688
2232
480
189
40
2

fr de sr epi epo epf
1677
0 18
0
0
0
2434
0 437
0
0
2
2541
0 490
0
0
16
3285
0 698
0
0
18
3573
0 595
0
0
16
581
0 53
0
0
0
189
0
0
0
0
0
40
0
0
0
0
0
2
0
0
0
0
0

- anonymous api
0
0
0
0
0
0
0
0
0

apo
0
85
85
168
128
0
0
0
0

apf
0
88
114
181
149
0
0
0
0

-- filesys -- --- cpu

fpi
341
354
160
162
242
194
202
200
194

fpo
1629
1634
1437
1520
2104
480
189
40
2

fpf us sy wt id
1677 4 35 34 27
2344 1 19 35 45
2410 2 20 40 38
3085 1 29 34 36
3408 2 27 33 38
581 1 16 46 38
189 1 11 41 47
40 1 16 37 46
2 2 14 39 44

The columns for the memstat command are described in Table 7-8.

Table 7-8 Statistics from the memstat Command
Counter
Description
free
The amount of free memory as reported by vmstat, which
reports the combined size of the cache list and free list. Free
memory on Solaris 7 may contain some of the file system cache.

256

Memory Monitoring

Table 7-8 Statistics from the memstat Command (Continued)
Counter
Description
re
Page reclaims — The number of pages reclaimed since the last
sample. Some of the file system cache is in the free list, and
when a file page is reused and removed from the free list, a
reclaim occurs. File pages in the free list can be either regular
files or executable/library pages.
mf
Minor faults — The number of pages attached to an address
space since the last sample. If the page is already in memory,
then a minor fault simply reestablishes the mapping to it
pi
Page-ins — The number of pages paged in since the last sample. A page-in occurs whenever a page is brought back in from
the swap device or brought from a file system into the file system cache.
po
Page-outs — The number of pages paged out and freed. A
page-out will be counted whenever a page is written and freed,
often as a result of the pageout scanner, fsflush, or file close.
fr
Page-frees — The number of pages that have been freed by
either the page scanner or by the file system (free-behind).
de
The precalculated anticipated short-term memory shortfall.
Used by the page scanner to free ahead enough pages to satisfy
requests.
sr
The number of pages scanned by the page scanner per second.
epi
Executable and library page-ins — The number of pages from
executable or shared library files paged in since the last sample. An executable/library page-in occurs whenever a page for
the executable binary or shared library is brought back in from
the file system.
epo
Executable and library page-outs. Should be zero.
epf
Executable and library page-frees — The number of executable
and library pages that have been freed by the page scanner.
api
Anonymous memory page-ins — The number of anonymous
(application heap and stack) pages paged in from the swap
device since the last sample.
apo
Anonymous memory page-outs — The number of anonymous
(application heap and stack) pages paged out to the swap device
since the last sample.
apf
Anonymous memory page-frees — The number of anonymous
(application heap and stack) pages that have been freed, after
they have been paged out.

Other Memory Tools

Table 7-8 Statistics from the memstat Command (Continued)
Counter
Description
fpi
Regular file page-ins — The number of pages from regular files
paged in since the last sample. A file page-in occurs whenever a
page for a regular file is read in from the file system (part of the
normal file system read process).
fpo
Regular file page-outs — The number of regular file pages that
were paged out and freed, usually as a result of being paged out
by the page scanner or by write free-behind (when free memory
is less than lotsfree + pages_before_pager).
fpf
Regular file page-frees — The number of regular file pages that
were freed, usually as a result of being paged out by the page
scanner or by write free-behind (when free memory is less than
lotsfree + pages_before_pager).

257

258

Memory Monitoring

Part Three
THREADS, PROCESSES,
AND IPC

• The Solaris Multi-threaded Process Architecture
• The Solaris Kernel Dispatcher
• Interprocess Communication

259

260