本文主要介紹基於Linux的 sar (System Accounting Report) 及 vmstat , iostat ,prstat 等工具。Windows請參考使用資源監視器(能夠在任務管理器調出)和命令typeperf。node
性能監控特別關注CPU、內存、磁盤的使用率。涉及到網絡的須要增長網絡使用率。python
短時間CPU使用要儘量高。CPU閒的緣由:同步原語阻塞;等待響應;無事可幹。linux
若是磁盤寫沒有緩衝,I/O會很低;固然I/O也有大量使用致使過載的狀況。ios
NAME 名字api
iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS). 報告CPU統計和設備、分區及NFS的I/O統計信息 緩存
SYNOPSIS 語法
iostat [ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] [ -j { ID | LABEL | PATH | UUID | ... } [ device [...]
| ALL ] ] [ device [...] | ALL ] [ -p [ device [,...] | ALL ] ] [ interval [ count ] ]網絡
DESCRIPTION 描述
The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks.app
iostat命令經過觀察設備活動時間的平均傳輸速率,以監控系統的I/O設備負載。 iostat命令生成的報告可用於改變系統配置,以更好地平衡I/O負載和物理磁盤。less
The first report generated by the iostat command provides statistics concerning the time since the system was booted, unless the -y option isused, when this first report is omitted. Each subsequent report covers the time since the previous report. All statistics are reported each time the iostat command is run. The report consists of a CPU header row followed by a row of CPU statistics. On multiprocessor systems, CPU statistics are calculated system-wide as averages among all processors. A device header row is displayed followed by a line of statistics for
each device that is configured. When option -n is used, an NFS header row is displayed followed by a line of statistics for each network
filesystem that is mounted.dom
The interval parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since
system startup (boot), unless the -y option is used, when this report is omitted. Each subsequent report contains statistics collected during
the interval since the previous report. The count parameter can be specified in conjunction with the interval parameter. If the count parameter
is specified, the value of count determines the number of reports generated at interval seconds apart. If the interval parameter is specified
without the count parameter, the iostat command generates reports continuously.
NAME 名字
vmstat - Report virtual memory statistics 報告虛擬內存的統計信息
SYNOPSIS 語法
vmstat [options] [delay [count]]
DESCRIPTION 描述
vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.
vmstat報告進程、內存、頁和 I/O 塊、中斷及 CPU信息。
The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.
第一次報告啓動至今的平均狀況。後面的信息是按取樣間隔按期顯示。進程和內存信息都是瞬間的。
#vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 6842592 1736 5226384 0 0 0 1 1 1 0 0 100 0 0
OPTIONS 選項
delay The delay between updates in seconds. If no delay is specified, only one report is printed with the average values since boot.
取樣間隔,即每隔幾秒更新一次。若是沒有隻輸出啓動至今的平均狀況。
#vmstat 1 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 6842708 1736 5226384 0 0 0 1 1 1 0 0 100 0 0 0 0 0 6842708 1736 5226384 0 0 0 0 51 121 0 0 100 0 0 0 0 0 6842708 1736 5226384 0 0 0 0 46 108 0 0 100 0 0
count Number of updates. In absence of count, when delay is defined, default is infinite.
更新的次數。若是沒有指定切定義了取樣間隔,則是無窮次。
-a, --active
Display active and inactive memory, given a 2.5.41 kernel or better.
2.5.41內核之後用於顯示active和inactive內存。Active是指應用程序正在使用的內存;Inactive是以前的應用程序使用過的內存,可是爲了之後可以快速從新加載而遺留在系統中的內存;
#vmstat -a procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free inact active si so bi bo in cs us sy id wa st 0 0 0 6842964 1365836 5773756 0 0 0 1 1 1 0 0 100 0 0
-f, --forks
The -f switch displays the number of forks since boot. This includes the fork, vfork, and clone system calls, and is equivalent to the total number of tasks created. Each process is represented by one or more tasks, depending on thread usage. This display does not repeat.
顯示啓動後的調用數,包含fork, vfork和克隆的系統調用,等同於總共建立的任務。一個進程根據線程使用狀況可能有一個或多個任務。
#vmstat -f 1393526 forks
-m, --slabs
Displays slabinfo.顯示slabinfo。
#vmstat -m Cache Num Total Size Pages fuse_inode 21 21 768 21 kvm_vcpu 0 0 16064 2 kvm_mmu_page_header 0 0 168 24 nfsd4_delegations 0 0 368 22 nfsd4_openowners 0 0 392 20 rpc_inode_cache 25 25 640 25 xfs_dqtrx 0 0 576 28 xfs_icr 0 0 144 28 xfs_ili 169390 169390 152 26 xfs_inode 1127244 1127328 1024 16 xfs_efd_item 160 260 400 20 xfs_da_state 64 64 488 16 xfs_btree_cur 76 76 208 19 xfs_log_ticket 353 396 184 22 scsi_cmd_cache 438 450 448 18 kcopyd_job 0 0 3312 9 dm_uevent 0 0 2608 12 dm_rq_target_io 0 0 424 19 UDPLITEv6 0 0 1152 28 UDPv6 112 112 1152 28 tw_sock_TCPv6 0 0 256 16 TCPv6 64 64 2048 16 cfq_queue 382 476 232 17 bsg_cmd 0 0 312 26 mqueue_inode_cache 18 18 896 18 hugetlbfs_inode_cache 52 52 608 26 configfs_dir_cache 46 46 88 46 dquot 0 0 256 16 pid_namespace 0 0 2176 15 posix_timers_cache 0 0 248 16 UDP-Lite 0 0 1024 16 ip_fib_trie 292 292 56 73 RAW 612 612 960 17 UDP 80 80 1024 16 tw_sock_TCP 176 272 256 16 TCP 102 102 1920 17 blkdev_queue 51 51 1920 17 blkdev_requests 70376 70455 384 21 blkdev_ioc 195 195 104 39 fsnotify_event_holder 18700 18700 24 170 fsnotify_event 18355 18598 120 34 sock_inode_cache 745 825 640 25 net_namespace 28 28 4224 7 shmem_inode_cache 1557 1584 680 24 Acpi-ParseExt 2856 2856 72 56 Acpi-Namespace 1992 2958 40 102 taskstats 96 96 328 24 proc_inode_cache 45997 46176 656 24 sigqueue 100 100 160 25 bdev_cache 76 76 832 19 sysfs_dir_cache 19620 19620 112 36 inode_cache 26514 26514 592 27 dentry 1722408 1722567 192 21 iint_cache 0 0 80 51 selinux_inode_security 10883 11577 80 51 buffer_head 845296 845481 104 39 vm_area_struct 24487 24606 216 18 mm_struct 200 200 1600 20 files_cache 225 225 640 25 signal_cache 442 504 1152 28 sighand_cache 278 315 2112 15 task_xstate 590 684 832 19 task_struct 457 506 2912 11 anon_vma 9521 9920 64 64 Cache Num Total Size Pages shared_policy_node 2550 2550 48 85 numa_policy 31 31 264 31 radix_tree_node 69536 69636 584 28 idr_layer_cache 345 345 2112 15 dma-kmalloc-8192 0 0 8192 4 dma-kmalloc-4096 0 0 4096 8 dma-kmalloc-2048 0 0 2048 16 dma-kmalloc-1024 0 0 1024 16 dma-kmalloc-512 0 0 512 16 dma-kmalloc-256 0 0 256 16 dma-kmalloc-128 0 0 128 32 dma-kmalloc-64 0 0 64 64 dma-kmalloc-32 0 0 32 128 dma-kmalloc-16 0 0 16 256 dma-kmalloc-8 0 0 8 512 dma-kmalloc-192 0 0 192 21 dma-kmalloc-96 0 0 96 42 kmalloc-8192 49 72 8192 4 kmalloc-4096 184 200 4096 8 kmalloc-2048 485 512 2048 16 kmalloc-1024 1712 1808 1024 16 kmalloc-512 927 1008 512 16 kmalloc-256 8123 9056 256 16 kmalloc-192 5862 6405 192 21 kmalloc-128 7650 7872 128 32 kmalloc-96 17094 17094 96 42 kmalloc-64 687907 689728 64 64 kmalloc-32 19003 19328 32 128 kmalloc-16 8448 8448 16 256 kmalloc-8 17920 17920 8 512 kmem_cache_node 320 320 64 64 kmem_cache 128 128 256 16
-n, --one-header
Display the header only once rather than periodically.只顯示一次表頭。
-s, --stats
Displays a table of various event counters and memory statistics. This display does not repeat.顯示時間計數器和內存統計信息,不會重複。
-d, --disk
Report disk statistics (2.5.70 or above required).2.5.70內核以上顯示磁盤信息。
#vmstat -s 16331568 K total memory 9488356 K used memory 5773836 K active memory 1365836 K inactive memory 6843212 K free memory 1736 K buffer memory 5226384 K swap cache 8200188 K total swap 0 K used swap 8200188 K free swap 5786965 non-nice user cpu ticks 91652 nice user cpu ticks 3658782 system cpu ticks 2778978158 idle cpu ticks 802294 IO-wait cpu ticks 212 IRQ cpu ticks 47689 softirq cpu ticks 0 stolen cpu ticks 2456734 pages paged in 17256284 pages paged out 0 pages swapped in 0 pages swapped out 878734186 interrupts 2721774223 CPU context switches 1172493713 boot time 1393536 forks
-D, --disk-sum
Report some summary statistics about disk activity.磁盤活動統計信息。
]#vmstat -D 7 disks 2 partitions 365229200 total reads 1456581 merged reads 46899177474 read sectors 2734703813 milli reading 6043002 writes 255914 merged writes 132721664 written sectors 227815975 milli writing 0 inprogress IO 190847 milli spent IO
-p, --partition device
Detailed statistics about partition (2.5.70 or above required).
2.5.70內核以上顯示分區信息。
#vmstat -p /dev/md126p1 md126p1 reads read sectors writes requested writes 0 0 0 0
-S, --unit character
Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the swap (si/so) or block (bi/bo) fields.
切換輸出單位:1000 (k), 1024 (K), 1000000 (m)或1048576 (M) bytes,注意不會影響swap (si/so)和block (bi/bo)。
#vmstat -S M procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 6682 1 5103 0 0 0 1 1 1 0 0 100 0 0
-t, --timestamp
Append timestamp to each line。每行增長時間戳。
#vmstat -t -w 1 procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- -----timestamp----- r b swpd free buff cache si so bi bo in cs us sy id wa st CST 0 0 0 6842716 1736 5226496 0 0 0 1 1 1 0 0 100 0 0 2015-06-27 14:55:20 0 0 0 6842956 1736 5226496 0 0 0 0 81 171 0 0 100 0 0 2015-06-27 14:55:21
-w, --wide
Wide output mode (useful for systems with higher amount of memory, where the default output mode suffers from unwanted column breakage). The output is wider than 80 characters per line.寬行輸出,行可能超過80個字符,須要更多內存。
-V, --version
Display version information and exit. 顯示版本信息並退出。
-h, --help
Display help and exit.顯示幫助信息並退出。
FIELD DESCRIPTION FOR VM MODE VM模式域描述
Procs
r: The number of runnable processes (running or waiting for run time). 等待運行的進程數
b: The number of processes in uninterruptible sleep.處在非中斷睡眠狀態的進程數
Memory
swpd: the amount of virtual memory used. 虛擬內存
free: the amount of idle memory. 空閒內存
buff: the amount of memory used as buffers. 緩存的內存數
cache: the amount of memory used as cache (excluding tmpfs memory for
kernels 2.6.32+) cache內存數,kernels 2.6.32不包含tmpfs。
inact: the amount of inactive memory. (-a option) inactive內存
active: the amount of active memory. (-a option) active內存
Swap
si: Amount of memory swapped in from disk (/s). 來自磁盤交換頁佔用的內存數量
so: Amount of memory swapped to disk (/s).從內存交換到磁盤的交換頁數量
IO
bi: Blocks received from a block device (blocks/s).從塊設備接收到的塊數,單位:塊/秒
bo: Blocks sent to a block device (blocks/s).發送到塊設備的塊數,單位:塊/秒
System
in: The number of interrupts per second, including the clock. 每秒的中斷數,包括時鐘中斷
cs: The number of context switches per second. 每秒上下文切換次數
CPU
These are percentages of total CPU time. 下面是總CPU時間的百分比。
us: Time spent running non-kernel code. (user time, including nice time) 非內核代碼時間(用戶時間,包含nice時間)
sy: Time spent running kernel code. (system time) 內核代碼時間(系統時間)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. 空閒時間。內核2.5.41之前包含IO等待時間。
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. IO等待時間
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown. 虛擬機時間,Linux 2.6.11之前無效。
FIELD DESCRIPTION FOR DISK MODE 磁盤模式域描述
Reads
total: Total reads completed successfully 總成功讀數
merged: grouped reads (resulting in one I/O) 組讀次數(多個I/O合做一個)
sectors: Sectors read successfully 成功讀扇區數
ms: milliseconds spent reading 讀消耗的毫秒數
Writes
total: Total writes completed successfully 成功寫數
merged: grouped writes (resulting in one I/O) 寫次數(多個I/O合做一個)
sectors: Sectors written successfully 寫成功讀扇區數
ms: milliseconds spent writing 寫消耗的毫秒數
IO
cur: I/O in progress 處理的I/O數
s: seconds spent for I/O耗時的秒數
FIELD DESCRIPTION FOR DISK PARTITION MODE 磁盤分區模式域描述
reads: Total number of reads issued to this partition 總讀次數
read sectors: Total read sectors for partition 總讀扇區數
writes : Total number of writes issued to this partition 總寫次數
requested writes: Total number of write requests made for partition 分區總寫請求數
FIELD DESCRIPTION FOR SLAB MODE SLAB模式域描述
cache: Cache name 緩存名
num: Number of currently active objects 當前活動對象數
total: Total number of available objects 總可用對象數
size: Size of each object 每一個對象的大小
pages: Number of pages with at least one active object 每一個活動對象的頁數。
NOTES 說明
vmstat does not require special permissions. vmstat的不須要特殊權限。
These reports are intended to help identify system bottlenecks. Linux vmstat does not count itself as a running process.
這些報告摯愛幫助肯定系統瓶頸。 Linux的vmstat的不算自己做爲一個正在運行的進程。
All linux blocks are currently 1024 bytes. Old kernels may report blocks as 512 bytes, 2048 bytes, or 4096 bytes.
全部Linux塊是目前1024個字節。舊的內核可能爲512字節,2048字節,或4096個字節。
Since procps 3.1.9, vmstat lets you choose units (k, K, m, M). Default is K (1024 bytes) in the default mode.
procps的3.1.9之後vmstat的讓你選擇的單位(K,K,M,M)。默認爲K(1024字節)在默認模式。
vmstat uses slabinfo 1.1 vmstat的使用slabinfo1.1
FILES 文件
/proc/meminfo
/proc/stat
/proc/*/stat
SEE ALSO 相似命令
free(1), iostat(1), mpstat(1), ps(1), sar(1), top(1)
BUGS
Does not tabulate the block io per device or count the number of system calls.
不能基於設備計算IO塊或系統調用數。
AUTHORS 做者
Henry Ware al172@yfn.ysu.edu
Fabian Frédérick ffrederick@users.sourceforge.net(diskstat, slab, partitions...)
REPORTING BUGS BUG 報告
procps@freelists.org
類型:翻譯
概述 pmap - report memory map of a process
Pmap 提供了進程的內存映射,pmap命令用於顯示一個或多個進程的內存狀態。其報告進程的地址空間和內存狀態信息。Pmap其實是一個Sun OS上的命令,linux僅支持其有限的功能。可是它仍是對查看完整的進程地址空間頗有幫助。咱們須要PID或者運行的進程的惟一進程ID來查看進程內存 狀態,咱們能夠經過/proc或者常規命令好比top或ps獲得它
pmap [options] pid [...]
The pmap command reports the memory map of a process or processes.
-x, --extended Show the extended format. -d, --device Show the device format. -q, --quiet Do not display some header or footer lines. -A, --range low,high Limit results to the given range to low and high address range. Notice that the low and high arguments are single string separated with comma. -X Show even more details than the -x option. WARNING: format changes according to /proc/PID/smaps -XX Show everything the kernel provides -p, --show-path Show full path to files in the mapping column -c, --read-rc Read the default configuration -C, --read-rc-from file Read the configuration from file -n, --create-rc Create new default configuration -N, --create-rc-to file Create new configuration to file -h, --help Display help text and exit. -V, --version Display version information and exit.
Address: start address of map 映像起始地址
Kbytes: size of map in kilobytes 映像大小(KB)
RSS: resident set size in kilobytes 駐留內存大小
Dirty: dirty pages (both shared and private) in kilobytes 髒頁大小
Mode: 內存的權限: permissions on map 映像權限: r=read, w=write, x=execute, s=shared, p=private (copy on write)
Mapping: file backing the map , or '[ anon ]' for allocated memory, or '[ stack ]' for the program stack. 文件後臺映射,[anon]爲已分配內存 [stack]爲程序堆棧
Offset: offset into the file 文件偏移
Device: evice name (major:minor) 設備名
上面參數經過man ps均可以看到。
EXIT STATUS 0 Success. 1 Failure. 42 Did not find all processes asked for. SEE ALSO ps(1), pgrep(1) STANDARDS No standards apply, but pmap looks an awful lot like a SunOS command.
# pmap 25798 -d 25798: python backup_server Address Kbytes Mode Offset Device Mapping 0000000000400000 4 r-x-- 0000000000000000 0fd:00001 python2.7 0000000000600000 4 r---- 0000000000000000 0fd:00001 python2.7 0000000000601000 4 rw--- 0000000000001000 0fd:00001 python2.7 0000000001065000 3688 rw--- 0000000000000000 000:00000 [ anon ] 00007f49297ce000 8 r-x-- 0000000000000000 0fd:00001 grpmodule.so 00007f49297d0000 2044 ----- 0000000000002000 0fd:00001 grpmodule.so 00007f49299cf000 4 r---- 0000000000001000 0fd:00001 grpmodule.so 00007f49299d0000 4 rw--- 0000000000002000 0fd:00001 grpmodule.so 00007f49299d1000 72 r-x-- 0000000000000000 0fd:00001 cPickle.so 00007f49299e3000 2048 ----- 0000000000012000 0fd:00001 cPickle.so 00007f4929be3000 4 r---- 0000000000012000 0fd:00001 cPickle.so 00007f4929be4000 4 rw--- 0000000000013000 0fd:00001 cPickle.so 00007f4929be5000 32 r-x-- 0000000000000000 0fd:00001 _ssl.so 00007f4929bed000 2044 ----- 0000000000008000 0fd:00001 _ssl.so 00007f4929dec000 4 r---- 0000000000007000 0fd:00001 _ssl.so 00007f4929ded000 4 rw--- 0000000000008000 0fd:00001 _ssl.so 00007f4929dee000 12 r-x-- 0000000000000000 0fd:00001 _functoolsmodule.so 00007f4929df1000 2044 ----- 0000000000003000 0fd:00001 _functoolsmodule.so 00007f4929ff0000 4 r---- 0000000000002000 0fd:00001 _functoolsmodule.so 00007f4929ff1000 4 rw--- 0000000000003000 0fd:00001 _functoolsmodule.so 00007f4929ff2000 60 r-x-- 0000000000000000 0fd:00001 _socketmodule.so 00007f492a001000 2044 ----- 000000000000f000 0fd:00001 _socketmodule.so 00007f492a200000 4 r---- 000000000000e000 0fd:00001 _socketmodule.so 00007f492a201000 20 rw--- 000000000000f000 0fd:00001 _socketmodule.so 00007f492a206000 260 rw--- 0000000000000000 000:00000 [ anon ] 00007f492a247000 16 r-x-- 0000000000000000 0fd:00001 cStringIO.so 00007f492a24b000 2044 ----- 0000000000004000 0fd:00001 cStringIO.so 00007f492a44a000 4 r---- 0000000000003000 0fd:00001 cStringIO.so 00007f492a44b000 8 rw--- 0000000000004000 0fd:00001 cStringIO.so 00007f492a44d000 28 r-x-- 0000000000000000 0fd:00001 _struct.so 00007f492a454000 2044 ----- 0000000000007000 0fd:00001 _struct.so 00007f492a653000 4 r---- 0000000000006000 0fd:00001 _struct.so 00007f492a654000 8 rw--- 0000000000007000 0fd:00001 _struct.so 00007f492a656000 12 r-x-- 0000000000000000 0fd:00001 fcntlmodule.so 00007f492a659000 2044 ----- 0000000000003000 0fd:00001 fcntlmodule.so 00007f492a858000 4 r---- 0000000000002000 0fd:00001 fcntlmodule.so 00007f492a859000 4 rw--- 0000000000003000 0fd:00001 fcntlmodule.so 00007f492a85a000 20 r-x-- 0000000000000000 0fd:00001 selectmodule.so 00007f492a85f000 2044 ----- 0000000000005000 0fd:00001 selectmodule.so 00007f492aa5e000 4 r---- 0000000000004000 0fd:00001 selectmodule.so 00007f492aa5f000 8 rw--- 0000000000005000 0fd:00001 selectmodule.so 00007f492aa61000 12 r-x-- 0000000000000000 0fd:00001 _randommodule.so 00007f492aa64000 2044 ----- 0000000000003000 0fd:00001 _randommodule.so 00007f492ac63000 4 r---- 0000000000002000 0fd:00001 _randommodule.so 00007f492ac64000 4 rw--- 0000000000003000 0fd:00001 _randommodule.so 00007f492ac65000 144 r-x-- 0000000000000000 0fd:00001 liblzma.so.5.0.99 00007f492ac89000 2044 ----- 0000000000024000 0fd:00001 liblzma.so.5.0.99 00007f492ae88000 4 r---- 0000000000023000 0fd:00001 liblzma.so.5.0.99 00007f492ae89000 4 rw--- 0000000000024000 0fd:00001 liblzma.so.5.0.99 00007f492ae8a000 380 r-x-- 0000000000000000 0fd:00001 libpcre.so.1.2.0 00007f492aee9000 2048 ----- 000000000005f000 0fd:00001 libpcre.so.1.2.0 00007f492b0e9000 4 r---- 000000000005f000 0fd:00001 libpcre.so.1.2.0 00007f492b0ea000 4 rw--- 0000000000060000 0fd:00001 libpcre.so.1.2.0 00007f492b0eb000 132 r-x-- 0000000000000000 0fd:00001 libselinux.so.1 00007f492b10c000 2048 ----- 0000000000021000 0fd:00001 libselinux.so.1 00007f492b30c000 4 r---- 0000000000021000 0fd:00001 libselinux.so.1 00007f492b30d000 4 rw--- 0000000000022000 0fd:00001 libselinux.so.1 00007f492b30e000 8 rw--- 0000000000000000 000:00000 [ anon ] 00007f492b310000 88 r-x-- 0000000000000000 0fd:00001 libresolv-2.17.so 00007f492b326000 2048 ----- 0000000000016000 0fd:00001 libresolv-2.17.so 00007f492b526000 4 r---- 0000000000016000 0fd:00001 libresolv-2.17.so 00007f492b527000 4 rw--- 0000000000017000 0fd:00001 libresolv-2.17.so 00007f492b528000 8 rw--- 0000000000000000 000:00000 [ anon ] 00007f492b52a000 12 r-x-- 0000000000000000 0fd:00001 libkeyutils.so.1.5 00007f492b52d000 2044 ----- 0000000000003000 0fd:00001 libkeyutils.so.1.5 00007f492b72c000 4 r---- 0000000000002000 0fd:00001 libkeyutils.so.1.5 00007f492b72d000 4 rw--- 0000000000003000 0fd:00001 libkeyutils.so.1.5 00007f492b72e000 52 r-x-- 0000000000000000 0fd:00001 libkrb5support.so.0.1 00007f492b73b000 2044 ----- 000000000000d000 0fd:00001 libkrb5support.so.0.1 00007f492b93a000 4 r---- 000000000000c000 0fd:00001 libkrb5support.so.0.1 00007f492b93b000 4 rw--- 000000000000d000 0fd:00001 libkrb5support.so.0.1 00007f492b93c000 84 r-x-- 0000000000000000 0fd:00001 libz.so.1.2.7 00007f492b951000 2044 ----- 0000000000015000 0fd:00001 libz.so.1.2.7 00007f492bb50000 4 r---- 0000000000014000 0fd:00001 libz.so.1.2.7 00007f492bb51000 4 rw--- 0000000000015000 0fd:00001 libz.so.1.2.7 00007f492bb52000 200 r-x-- 0000000000000000 0fd:00001 libk5crypto.so.3.1 00007f492bb84000 2044 ----- 0000000000032000 0fd:00001 libk5crypto.so.3.1 00007f492bd83000 8 r---- 0000000000031000 0fd:00001 libk5crypto.so.3.1 00007f492bd85000 4 rw--- 0000000000033000 0fd:00001 libk5crypto.so.3.1 00007f492bd86000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007f492bd87000 12 r-x-- 0000000000000000 0fd:00001 libcom_err.so.2.1 00007f492bd8a000 2044 ----- 0000000000003000 0fd:00001 libcom_err.so.2.1 00007f492bf89000 4 r---- 0000000000002000 0fd:00001 libcom_err.so.2.1 00007f492bf8a000 4 rw--- 0000000000003000 0fd:00001 libcom_err.so.2.1 00007f492bf8b000 832 r-x-- 0000000000000000 0fd:00001 libkrb5.so.3.3 00007f492c05b000 2048 ----- 00000000000d0000 0fd:00001 libkrb5.so.3.3 00007f492c25b000 52 r---- 00000000000d0000 0fd:00001 libkrb5.so.3.3 00007f492c268000 12 rw--- 00000000000dd000 0fd:00001 libkrb5.so.3.3 00007f492c26b000 284 r-x-- 0000000000000000 0fd:00001 libgssapi_krb5.so.2.2 00007f492c2b2000 2048 ----- 0000000000047000 0fd:00001 libgssapi_krb5.so.2.2 00007f492c4b2000 4 r---- 0000000000047000 0fd:00001 libgssapi_krb5.so.2.2 00007f492c4b3000 8 rw--- 0000000000048000 0fd:00001 libgssapi_krb5.so.2.2 00007f492c4b5000 1772 r-x-- 0000000000000000 0fd:00001 libcrypto.so.1.0.1e 00007f492c670000 2048 ----- 00000000001bb000 0fd:00001 libcrypto.so.1.0.1e 00007f492c870000 104 r---- 00000000001bb000 0fd:00001 libcrypto.so.1.0.1e 00007f492c88a000 48 rw--- 00000000001d5000 0fd:00001 libcrypto.so.1.0.1e 00007f492c896000 16 rw--- 0000000000000000 000:00000 [ anon ] 00007f492c89a000 392 r-x-- 0000000000000000 0fd:00001 libssl.so.1.0.1e 00007f492c8fc000 2044 ----- 0000000000062000 0fd:00001 libssl.so.1.0.1e 00007f492cafb000 16 r---- 0000000000061000 0fd:00001 libssl.so.1.0.1e 00007f492caff000 28 rw--- 0000000000065000 0fd:00001 libssl.so.1.0.1e 00007f492cb06000 12 r-x-- 0000000000000000 0fd:00001 _hashlib.so 00007f492cb09000 2044 ----- 0000000000003000 0fd:00001 _hashlib.so 00007f492cd08000 4 r---- 0000000000002000 0fd:00001 _hashlib.so 00007f492cd09000 4 rw--- 0000000000003000 0fd:00001 _hashlib.so 00007f492cd0a000 20 r-x-- 0000000000000000 0fd:00001 binascii.so 00007f492cd0f000 2044 ----- 0000000000005000 0fd:00001 binascii.so 00007f492cf0e000 4 r---- 0000000000004000 0fd:00001 binascii.so 00007f492cf0f000 4 rw--- 0000000000005000 0fd:00001 binascii.so 00007f492cf10000 28 r-x-- 0000000000000000 0fd:00001 math.so 00007f492cf17000 2044 ----- 0000000000007000 0fd:00001 math.so 00007f492d116000 4 r---- 0000000000006000 0fd:00001 math.so 00007f492d117000 8 rw--- 0000000000007000 0fd:00001 math.so 00007f492d119000 16 r-x-- 0000000000000000 0fd:00001 timemodule.so 00007f492d11d000 2044 ----- 0000000000004000 0fd:00001 timemodule.so 00007f492d31c000 4 r---- 0000000000003000 0fd:00001 timemodule.so 00007f492d31d000 8 rw--- 0000000000004000 0fd:00001 timemodule.so 00007f492d31f000 12 r-x-- 0000000000000000 0fd:00001 _heapq.so 00007f492d322000 2044 ----- 0000000000003000 0fd:00001 _heapq.so 00007f492d521000 4 r---- 0000000000002000 0fd:00001 _heapq.so 00007f492d522000 8 rw--- 0000000000003000 0fd:00001 _heapq.so 00007f492d524000 40 r-x-- 0000000000000000 0fd:00001 itertoolsmodule.so 00007f492d52e000 2044 ----- 000000000000a000 0fd:00001 itertoolsmodule.so 00007f492d72d000 4 r---- 0000000000009000 0fd:00001 itertoolsmodule.so 00007f492d72e000 20 rw--- 000000000000a000 0fd:00001 itertoolsmodule.so 00007f492d733000 32 r-x-- 0000000000000000 0fd:00001 operator.so 00007f492d73b000 2048 ----- 0000000000008000 0fd:00001 operator.so 00007f492d93b000 4 r---- 0000000000008000 0fd:00001 operator.so 00007f492d93c000 8 rw--- 0000000000009000 0fd:00001 operator.so 00007f492d93e000 24 r-x-- 0000000000000000 0fd:00001 _collectionsmodule.so 00007f492d944000 2044 ----- 0000000000006000 0fd:00001 _collectionsmodule.so 00007f492db43000 4 r---- 0000000000005000 0fd:00001 _collectionsmodule.so 00007f492db44000 8 rw--- 0000000000006000 0fd:00001 _collectionsmodule.so 00007f492db46000 103580 r---- 0000000000000000 0fd:00001 locale-archive 00007f493406d000 1752 r-x-- 0000000000000000 0fd:00001 libc-2.17.so 00007f4934223000 2048 ----- 00000000001b6000 0fd:00001 libc-2.17.so 00007f4934423000 16 r---- 00000000001b6000 0fd:00001 libc-2.17.so 00007f4934427000 8 rw--- 00000000001ba000 0fd:00001 libc-2.17.so 00007f4934429000 20 rw--- 0000000000000000 000:00000 [ anon ] 00007f493442e000 1028 r-x-- 0000000000000000 0fd:00001 libm-2.17.so 00007f493452f000 2044 ----- 0000000000101000 0fd:00001 libm-2.17.so 00007f493472e000 4 r---- 0000000000100000 0fd:00001 libm-2.17.so 00007f493472f000 4 rw--- 0000000000101000 0fd:00001 libm-2.17.so 00007f4934730000 8 r-x-- 0000000000000000 0fd:00001 libutil-2.17.so 00007f4934732000 2044 ----- 0000000000002000 0fd:00001 libutil-2.17.so 00007f4934931000 4 r---- 0000000000001000 0fd:00001 libutil-2.17.so 00007f4934932000 4 rw--- 0000000000002000 0fd:00001 libutil-2.17.so 00007f4934933000 12 r-x-- 0000000000000000 0fd:00001 libdl-2.17.so 00007f4934936000 2044 ----- 0000000000003000 0fd:00001 libdl-2.17.so 00007f4934b35000 4 r---- 0000000000002000 0fd:00001 libdl-2.17.so 00007f4934b36000 4 rw--- 0000000000003000 0fd:00001 libdl-2.17.so 00007f4934b37000 88 r-x-- 0000000000000000 0fd:00001 libpthread-2.17.so 00007f4934b4d000 2048 ----- 0000000000016000 0fd:00001 libpthread-2.17.so 00007f4934d4d000 4 r---- 0000000000016000 0fd:00001 libpthread-2.17.so 00007f4934d4e000 4 rw--- 0000000000017000 0fd:00001 libpthread-2.17.so 00007f4934d4f000 16 rw--- 0000000000000000 000:00000 [ anon ] 00007f4934d53000 1504 r-x-- 0000000000000000 0fd:00001 libpython2.7.so.1.0 00007f4934ecb000 2048 ----- 0000000000178000 0fd:00001 libpython2.7.so.1.0 00007f49350cb000 4 r---- 0000000000178000 0fd:00001 libpython2.7.so.1.0 00007f49350cc000 248 rw--- 0000000000179000 0fd:00001 libpython2.7.so.1.0 00007f493510a000 60 rw--- 0000000000000000 000:00000 [ anon ] 00007f4935119000 132 r-x-- 0000000000000000 0fd:00001 ld-2.17.so 00007f4935168000 1776 rw--- 0000000000000000 000:00000 [ anon ] 00007f4935337000 8 rw--- 0000000000000000 000:00000 [ anon ] 00007f4935339000 4 r---- 0000000000020000 0fd:00001 ld-2.17.so 00007f493533a000 4 rw--- 0000000000021000 0fd:00001 ld-2.17.so 00007f493533b000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007fff931c2000 132 rw--- 0000000000000000 000:00000 [ stack ] 00007fff931fe000 8 r-x-- 0000000000000000 000:00000 [ anon ] ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ] mapped: 195512K writeable/private: 6548K shared: 0K [root@localhost opt]# [root@localhost opt]# ^C [root@localhost opt]# cat /proc/25798/stat | awk '{print $23 / 1024}' 195512 [root@localhost opt]# cat /proc/25798/status | grep -i vmsize VmSize: 195512 kB
其中6548K表示實際使用的內存,195512K表示虛擬內存,這個比ps中的內存看得準確,由於多個進程使用同一動態連接庫。