当前位置:文档之家› linux系统性能监测

linux系统性能监测

1.1 CPU消耗在文件"/proc/stat"里面就包含了CPU的信息。

#cat /proc/stat可通过mpstat系统性能检测工具对当前cpu使用情况进行查看,如下:语法:mpstat [ options... ] [ <interval> [ <count> ] ][root@reg ~]# mpstat 1Linux 2.6.9-89.ELsmp (WebServer) 08/18/0910:08:25 CPU %user %nice %system %iowait %irq %soft %idle intr/s 10:08:26 all 0.00 0.00 0.00 0.00 0.00 0.00 100.00 1005.00 10:08:27 all 0.00 0.00 0.00 0.12 0.00 0.00 99.88 1031.00 10:08:28 all 0.00 0.00 0.00 0.00 0.00 0.00 100.00 1009.00 10:08:29 all 0.00 0.00 0.00 0.00 0.00 0.00 100.00 1030.00 10:08:30 all 0.00 0.00 0.00 0.00 0.00 0.00 100.00 1006.00 ....................................................................................各项的注释:CPU //处理器编号,all表示所有处理器的平均数值Processor number. The keyword all indicates that statistics are calculated as averages among all processors.%user //用户态的CPU利用率百分比Show the percentage of CPU utilization that occurred while executing at the user level(application).%nice //用户态的优先级别CPU的利用率百分比Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.%system //内核态的CPU利用率百分比Show the percentage of CPU utilization that occurred while executing at the system level (kernel). Note thatthis does not include the time spent servicing interrupts or softirqs.%iowait //在interval间段内io的等待百分比,interval 为采样频率,如本文的1为每一秒钟采样一次Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.%irq //在interval间段内,CPU的中断百分比Show the percentage of time spent by the CPU or CPUs to service interrupts.%soft //在interval间段内,CPU的软中断百分比Show the percentage of time spent by the CPU or CPUs to service softirqs. A softirq (software interrupt) is one of up to 32 enumerated software interrupts which can run on multiple CPUs at once.%idle //在interval间段内,CPU的闲置百分比,不包括I/O请求的等待Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.intr/s //在interval间段内所有的CPU每秒中断数Show the total number of interrupts received per second by the CPU or CPUs. 1.2 内存消耗文件"/proc/meminfo"里面包含的就是内存的信息,还包括了swap的信息[root@reg ~]# cat /proc/meminfoMemTotal: 1035864 kBMemFree: 746112 kBBuffers: 32308 kBCached: 151136 kBSwapCached: 0 kBActive: 144168 kBInactive: 113932 kBHighTotal: 131008 kBHighFree: 256 kBLowTotal: 904856 kBLowFree: 745856 kBSwapTotal: 2048276 kBSwapFree: 2048276 kBDirty: 68 kBWriteback: 0 kBMapped: 110628 kBSlab: 21268 kBCommitted_AS: 215084 kBPageTables: 2032 kBVmallocTotal: 106488 kBVmallocUsed: 3672 kBVmallocChunk: 102576 kBHugePages_Total: 0HugePages_Free: 0Hugepagesize: 4096 kB注:可通过vmstat系统性能检测工具对当前内存使用情况进行查看,如下:语法:vmstat [-V] [-n] [delay [count]][root@reg ~]# vmstat 1procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----r b swpd free buff cache si so bi bo in cs us sy id wa0 0 0 766992 19416 149164 0 0 561 86 1042 252 5 22 55 180 0 0 766896 19416 149164 0 0 0 0 948 231 2 4 94 0 0 0 0 766896 19416 149164 0 0 0 0 961 209 2 4 94 0 0 0 0 766896 19416 149168 0 0 0 20 953 226 2 4 94 00 0 0 766896 19416 149164 0 0 0 0 983 227 2 4 94 01 0 0 766912 19424 149164 0 0 0 112 950 218 23 94 1 0 0 0 766912 19424 149164 0 0 0 0 969 224 35 91 0 0 0 0 766912 19424 149164 0 0 0 0 946 212 2 4 94 0 0 0 0 766912 19432 149164 0 0 0 896 1045 211 2 6 92 00 0 0 766912 19432 149164 0 0 0 0 1030 308 2 8 90 01 0 0 766912 19432 149164 0 0 0 0 1140 435 7 9 83 02 0 0 765944 19432 149164 0 0 0 0 1218 605 13 19 69 00 0 0 766776 19432 149164 0 0 0 0 1154 471 8 11 82 00 0 0 766776 19432 149164 0 0 0 0 947 220 2 4 94 0 0 0 0 766776 19432 149164 0 0 0 0 956 212 1 3 96 0 0 0 0 766776 19432 149164 0 0 0 0 939 217 1 5 94 0 0 0 0 766776 19432 149164 0 0 0 0 1163 468 7 12 81 00 0 0 766776 19432 149164 0 0 0 0 1007 275 3 5 91 0.................................................... ................................................... ...................................................Procs:r: The number of processes 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. (作为buffer cache的内存,对块设备的读写进行缓冲)cache: the amount of memory used as cache. (作为page cache的内存,文件系统的cache)inact: the amount of inactive memory. (-a option) (不活动的内存数)active: the amount of active memory. (-a option) (活动的内存数)Swap :si: Amount of memory swapped in from disk (/s).(每秒从SWAP交换分区换入到内存的数量)so: Amount of memory swapped to disk (/s).(每秒从内存换出到SWAP交换分区的数量)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.us: Time spent running non-kernel code. (user time, including nice time) (用户进程消耗的CPU时间百分比)sy: Time spent running kernel code. (system time) (内核进程消耗的CPU时间百分比)id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. (IO等待消耗的CPU时间百分比)wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero. (CPU处于空闲状态时间百分比)1.3 磁盘空间磁盘分区的数据有可能分布在:/proc/mounts、/proc/diskstats、/proc/partitions等等。

相关主题