原文地址:http://wangjunle23.blog.163.com/blog/static/1178381712012119111317650/
学习/proc/uptime
第一个数字:表示系统从启动到现在运行的时间
第二个数字:处于空闲状态的时间
学习/proc/vmstat
- nr_anon_pages 25831
- nr_mapped 4268
- nr_file_pages 31079
- nr_slab 10141
- nr_page_table_pages 1309
- nr_dirty 1
- nr_writeback 0
- nr_unstable 0
- nr_bounce 0
- numa_hit 14421023
- numa_miss 0
- numa_foreign 0
- numa_interleave 58330
- numa_local 14421023
- numa_other 0
- pgpgin 725990
- pgpgout 9307062
- pswpin 0
- pswpout 28
- pgalloc_dma 8
- pgalloc_dma32 14483571
- pgalloc_normal 0
- pgalloc_high 0
- pgfree 14668385
- pgactivate 220266
- pgdeactivate 104548
- pgfault 25478890
- pgmajfault 2978
- pgrefill_dma 0
- pgrefill_dma32 253509
- pgrefill_normal 0
- pgrefill_high 0
- pgsteal_dma 0
- pgsteal_dma32 779738
- pgsteal_normal 0
- pgsteal_high 0
- pgscan_kswapd_dma 0
- pgscan_kswapd_dma32 783232
- pgscan_kswapd_normal 0
- pgscan_kswapd_high 0
- pgscan_direct_dma 0
- pgscan_direct_dma32 1120
- pgscan_direct_normal 0
- pgscan_direct_high 0
- pginodesteal 0
- slabs_scanned 233472
- kswapd_steal 778669
- kswapd_inodesteal 46133
- pageoutrun 14387
- allocstall 17
- pgrotated 28
该文件展示了kernel的虚拟内存统计。下面的多数计数器只有在你编译kernel时使用了打开VM_EVENT_CONTERS配置选项才生效。因此,大多数参数对于kernel本身没有函数。只用于调试和统计。
Number of pages that are dirty, under writeback or unstable:
nr_dirty 1550 #脏页数
nr_writeback 0 #(write-cache)不直接写磁盘,先写cache
nr_unstable 0 #不稳定数?
Number of pages allocated to page tables, mapped by files or allocated by the kernel slab allocator:
nr_page_table_pages 699 #分配给页表的页数
nr_mapped 139596 #映身文件的页数
nr_slab 42723 #slab分配的页数
Number of pageins and pageouts (since the last boot):
pgpgin 33754195 #从boot到现在,pagein的数目
pgpgout 38985992 #从boot到现在,pagein的数目
disk io 监控
平均每秒把数据从硬盘读到物理内存的数据量:
读取/proc/vmstat文件得出最近240秒内pgpgin的增量,把pgpgin的增量再除以240得到每秒的平均增量
平均每秒把数据从物理内存写到硬盘的数据量
读取/proc/vmstat文件得出最近240秒内pgpgout的增量,把pgpgout的增量再除以240得到每秒的平均增量
Number of swapins and swapouts (since the last boot):
pswpin 2473
pswpout 2995
平均每秒把数据从磁盘交换区装到内存的数据量
读取/proc/vmstat文件得出最近240秒内pswpin的增量,把pswpin的增量再除以240得到每秒的平均增量
平均每秒把数据从内存装到磁盘交换区的数据量
读取/proc/vmstat文件得出最近240秒内pswpout的增量,把pswpout的增量再除以240得到每秒的平均增量
Number of page allocations per zone (since the last boot):
pgalloc_high 0
pgalloc_normal 110123213
pgalloc_dma32 0
pgalloc_dma 415219
Number of page frees, activations and deactivations (since the last boot):
pgfree 110549163
pgactivate 4509729
pgdeactivate 2136215
Number of minor and major page faults (since the last boot):
pgfault 80663722
pgmajfault 49813
Number of page refills (per zone, since the last boot):
pgrefill_high 0
pgrefill_normal 5817500
pgrefill_dma32 0
pgrefill_dma 149176
Number of page steals (per zone, since the last boot):
pgsteal_high 0
pgsteal_normal 10421346
pgsteal_dma32 0
pgsteal_dma 142196
Number of pages scanned by the kswapd daemon (per zone, since the last boot):
pgscan_kswapd_high 0
pgscan_kswapd_normal 10491424
pgscan_kswapd_dma32 0
pgscan_kswapd_dma 156130
Number of pages reclaimed directly (per zone, since the last boot):
pgscan_direct_high 0
pgscan_direct_normal 11904
pgscan_direct_dma32 0
pgscan_direct_dma 225
Number of pages reclaimed via inode freeing (since the last boot):
pginodesteal 11
Number of slab objects scanned (since the last boot):
slabs_scanned 8926976
Number of pages reclaimed by kswapd (since the last boot):
kswapd_steal 10551674
Number of pages reclaimed by kswapd via inode freeing (since the last boot):
kswapd_inodesteal 338730
Number of kswapd's calls to page reclaim (since the last boot):
pageoutrun 181908
Number of direct reclaim calls (since the last boot):
allocstall 160
Miscellaneous statistics:
pgrotated 3781
nr_bounce 0