日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

三 性能調(diào)試---CPU性能分析( 三 )



cpu: cpu number (only on a multi-processor system with the -M option);
\usr: user mode;
%sys: system mode;
%wio: idle with some process waiting for I/O (only block I/O, raw I/O, or VM pageins/swapins indicated);
%idle: otherwise idle;
對結(jié)果的分析

首先,我們看%idle列的值,如果為接近零,則再看對應(yīng)%wio列的值,如果這列的大于7,則表明系統(tǒng)的磁盤或其他I/O可能有問題,需要進(jìn)一步的分析:

用iostat命令分析各個磁盤的傳輸閑忙狀況,如#iostat -t 5 2,每隔5秒取樣一次,共取2次;
用sar -d命令分析各塊設(shè)備(磁盤、磁帶)活動情況;
用sar -b命令分析系統(tǒng)的緩存的活動情況;
用sar -w命令分析進(jìn)程的deactivation/reactivation and switching activities of the system;
如果%idle列很小,而對應(yīng)的%wio列的值也很小,這時,我們查看\usr列和%sys列的值 。如果\usr列的值很大,說明有用戶進(jìn)程占用很多CPU時間;如果%sys列的值很大,則說明系統(tǒng)管理方面花了很多時間 。需要進(jìn)一步的分析:

用GlancePlus對占用CPU時間最大的進(jìn)程進(jìn)行單獨(dú)分析,為什么它會占用如此多的CPU時間 。
如果%sys列的值很大,可以用SAR -C命令對系統(tǒng)調(diào)用進(jìn)行進(jìn)一步分解,看這些系統(tǒng)調(diào)用主要是做些什么 。同時,還必須分析是否有其他瓶頸,如paging也會引起%sys的值很大,這時,可以用sar -q查看系統(tǒng)的運(yùn)行進(jìn)程隊(duì)列長度,也可以用GlancePlus和vmstat查看內(nèi)存的使用情況;

利用SAR工具分析運(yùn)行進(jìn)程隊(duì)列長度


利用SAR進(jìn)行運(yùn)行進(jìn)程隊(duì)列長度分析的命令形式:

#sar -q,這時數(shù)據(jù)是通過sa1在后臺定時生成;
#sar -q 5 100,每隔5秒取樣一次,共取100次;
SAR -q: Report average queue length while occupied, and percent of time occupied. On a multi-processor Machine, if the -M option is used together with the -q option, the per-CPU run queue as well as the average run queue of all the processors are reported. If the -M option is not used, only the average run queue information of all the processors is reported:

cpu: cpu number (only on a multi-processor system with the -M option);
runq-sz: Average length of the run queue(s) of processes (in memory and runnable);
%runocc: The percentage of time the run queue(s) were occupied by processes (in memory and runnable);
swpq-sz: Average length of the swap queue of runnable processes (processes swapped out but ready to run);
%swpocc: The percentage of time the swap queue of runnable processes (processes swapped out but ready to run) was occupied.
對結(jié)果的分析:

這些數(shù)據(jù)越小越好 。

如果runq-sz大于4,或者%swapocc大于5時,則表明系統(tǒng)的CPU或內(nèi)存可能有問題,需要進(jìn)一步的分析:

用sar -u命令分析CPU的使用情況;
用sar -w命令分析進(jìn)程的deactivation/reactivation and switching activities of the system;
也可以用GlancePlus;

利用SAR工具分析系統(tǒng)調(diào)用


利用SAR進(jìn)行系統(tǒng)調(diào)用分析的命令形式:

#sar -c,這時數(shù)據(jù)是通過sa1在后臺定時生成;
#sar -c 5 100,每隔5秒取樣一次,共取100次;
SAR -c: Report system calls:

scall/s: Number of system calls of all types per second;
sread/s: Number of read() and/or readv() system calls per second;
swrit/s: Number of write() and/or writev() system calls per second;
swpq-sz: Average length of the swap queue of runnable processes (processes swapped out but ready to run);
fork/s: Number of fork() and/or vfork() system calls per second;
exec/s: Number of exec() system calls per second;
rchar/s: Number of characters transferred by read system calls block devices only) per second;
wchar/s: Number of characters transferred by write system calls (block devices only) per second.
對結(jié)果的分析:

如果scall/s列的值很大,那么這么多的系統(tǒng)調(diào)用的原因就必須仔細(xì)分析了 。

推薦閱讀