原文地址:http://wangjunle23.blog.163.com/blog/static/1178381712012119111317650/

学习/proc/uptime

学习/proc虚拟文件系统(六)_虚拟文件系统

第一个数字:表示系统从启动到现在运行的时间

第二个数字:处于空闲状态的时间

学习/proc/vmstat

  1. nr_anon_pages 25831 
  2. nr_mapped 4268 
  3. nr_file_pages 31079 
  4. nr_slab 10141 
  5. nr_page_table_pages 1309 
  6. nr_dirty 1 
  7. nr_writeback 0 
  8. nr_unstable 0 
  9. nr_bounce 0 
  10. numa_hit 14421023 
  11. numa_miss 0 
  12. numa_foreign 0 
  13. numa_interleave 58330 
  14. numa_local 14421023 
  15. numa_other 0 
  16. pgpgin 725990 
  17. pgpgout 9307062 
  18. pswpin 0 
  19. pswpout 28 
  20. pgalloc_dma 8 
  21. pgalloc_dma32 14483571 
  22. pgalloc_normal 0 
  23. pgalloc_high 0 
  24. pgfree 14668385 
  25. pgactivate 220266 
  26. pgdeactivate 104548 
  27. pgfault 25478890 
  28. pgmajfault 2978 
  29. pgrefill_dma 0 
  30. pgrefill_dma32 253509 
  31. pgrefill_normal 0 
  32. pgrefill_high 0 
  33. pgsteal_dma 0 
  34. pgsteal_dma32 779738 
  35. pgsteal_normal 0 
  36. pgsteal_high 0 
  37. pgscan_kswapd_dma 0 
  38. pgscan_kswapd_dma32 783232 
  39. pgscan_kswapd_normal 0 
  40. pgscan_kswapd_high 0 
  41. pgscan_direct_dma 0 
  42. pgscan_direct_dma32 1120 
  43. pgscan_direct_normal 0 
  44. pgscan_direct_high 0 
  45. pginodesteal 0 
  46. slabs_scanned 233472 
  47. kswapd_steal 778669 
  48. kswapd_inodesteal 46133 
  49. pageoutrun 14387 
  50. allocstall 17 
  51. 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