2013-12-20 33 views
0

Linux服務器大不同的CPU使用率是這樣的: Linux hostname 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux爲什麼PS的輔助顯示了頂部

而且ps aux顯示不正確的CPU使用率和值是不合理的。該值不會經常更新爲top

例如,對於相同的進程,ps顯示CPU使用率爲210.0,並保持在多次執行中顯示該值。但在另一個終端中,頂部顯示杯子的使用情況在1xx至2xx之間不斷變化。頂端的價值是合理的。任何想法爲什麼ps aux不能很好地工作?

回答

2

雙方應該工作,但他們的工作方式不同:

從PS的MAN:

%cpu  %CPU  cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been 
        running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu). 

和頂部

k: %CPU -- CPU usage 
      The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. In a true SMP envi- 
      ronment, if ’Irix mode’ is Off, top will operate in ’Solaris mode’ where a task’s cpu usage will be divided by the total number of CPUs. 
      You toggle ’Irix/Solaris’ modes with the ’I’ interactive command. 
相關問題