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

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



我們可以查看fork/s和exec/s列的值,看看系統(tǒng)是否在創(chuàng)建大量新的進(jìn)程 。



利用time命令測試某個命令和程序的執(zhí)行效率


我們可以利用time命令來測試一個命令的執(zhí)行效率,語法為:

time command

command is executed. Upon completion, time prints the elapsed time during the command, the time spent in the system, and the time spent executing the command. Times are reported in seconds.

Execution time can depend on the performance of the memory in which the program is running.

當(dāng)我們覺得某個進(jìn)程的性能不好時,最簡單的方法就是利用time命令來查看一下進(jìn)程執(zhí)行時它的 時間分布情況,然后再用其他工具進(jìn)一步分析 。


利用top命令查看最耗CPU資源的進(jìn)程


我們可以利用top命令來查看最耗CPU資源的進(jìn)程 。top命令還會根據(jù)進(jìn)程占用CPU資源的多少而動態(tài)改變 。

它的語法為:

top [-s time] [-d count] [-q] [-u] [-h] [-n number]

其中各選項的含義為:

-s time: 屏幕刷新的時間間隔time,缺省為5秒;
-d count: 屏幕刷新count次后,top命令自己也退出;
-q: This option runs the top program at the same priority as if it is executed via a nice -20 command so that it will execute faster (see nice(1)). This can be very useful in discovering any system problem when the system is very sluggish. This option is accessibly only to users who have appropriate privileges.
-u: User ID (uid) numbers are displayed instead of usernames. This improves execution speed by eliminating the additional time required to map uid numbers to user names.
-h: Hides the individual CPU state information for systems having multiple processors. Only the average CPU status will be displayed.
-n number: Show only number processes per screen. Note that this option is ignored if number is greater than the maximum number of processes that can be displayed per screen.
在top命令運行時,我們可用以下幾個快捷鍵來翻屏:

j: 向前翻;
k: 向后翻;
t: 回到第一頁;
對結(jié)果的分析:

通過top命令,我們可以快速了解到目前系統(tǒng)的CPU資源使用情況,尤其是占用CPU資源最多的進(jìn)程是我們必須關(guān)注的對象 。

我們通過RES(the current size of the process resident in memory)列可以知道每個進(jìn)程占用內(nèi)存的數(shù)量 。

我們通過NICE列可以知道系統(tǒng)是否使用NICE值來調(diào)節(jié)該進(jìn)程的工作負(fù)載平衡 。

利用uptime命令查看系統(tǒng)整體情況


uptime prints the current time, the length of time the system has been up, the number of users logged on to the system, and the average number of jobs in the run queue over the last 1, 5, and 15 minutes.

w is linked to uptime and prints the same output as uptime -w, displaying a summary of the current activity on the system.

它的語法為:

uptime [-hlsuw] [user]

w [-hlsuw] [user]

其中各選項的含義為:

-h: Suppress the first line and the heading line. This option should not be used with the -u option. This option assumes the use of the -w option to uptime.
-l: Use long output. This option assumes the use of the -w option to uptime.
-s: Use the short form of output for displaying terminal information. The terminal name is abbreviated; the login time and CPU times are suppressed.
-u: Print only the first line describing the overall state of the system. This is the default for the uptime command.ormation for systems having multiple processors. Only the average CPU status will be displayed.
-w: Print a summary of the current activity on the system for each user. This is the default for the w command.

利用GlancePlus分析系統(tǒng)CPU資源利用率


利用HP的GlancePlus工具可以對進(jìn)程的整體情況和單獨的某個進(jìn)程都詳細(xì)分析 。

1)對CPU的整體使用情況的分析:

推薦閱讀