當我在 Linux 機器上執行 ps -ef 時,我得到: UID PID PPID C STIME TTY TIME CMD
請幫我解釋一下C,TIME 的意思。 TIME 是分配給進程的實際CPU 時間嗎?
答案1
如果您運行man ps
然後輸入/SpaceShift+CSpaceEnter,您應該會看到這一行。
C pcpu cpu utilization
但這是在OBSOLETE SORT KEYS
標題下,所以不是我們要找的。
按下n
尋找下一個匹配項:
c C processor utilization. Currently, this is the
integer value of the percent usage over the
lifetime of the process.
(see %cpu).
聽起來不錯。欲了解更多詳情,我們搜尋%cpu
並找到:
%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. ...
(alias pcpu).
並且TIME
有兩個匹配項,但只有一個匹配hh:mm:ss
格式:
cputime TIME cumulative CPU time, "[DD-]hh:mm:ss" format. (alias time).
累積 CPU 時間是處理器運作過程所花費的時間量,也就是實際使用 CPU 週期,而不是休眠、等待運作或等待 I/O 的時間。
它是透過對中所描述的utime
和值求和來決定的stime
proc(5) 手冊頁。
utime %lu Amount of time that this process has been scheduled in user mode...
stime %lu Amount of time that this process has been scheduled in kernel mode...