![](/img/trans.png)
[英]What is the meaning of every paramater returned by psutil.cpu_times() in python?
[英]What is the “ Unit ” of time returned by psutil.cpu_times()?
是秒嗎? 我試圖將它與top -n 1 | grep Cpu
的輸出相匹配 top -n 1 | grep Cpu
命令,它們看起來不一樣!
>>> psutil.cpu_times()
scputimes(user=678.99, nice=2.15, system=405.34, idle=414554.14, iowait=12.95, irq=0.0, softirq=2.43, steal=95.2, guest=0.0, guest_nice=0.0)
>>> exit()
[root@Server]# top -n 1 | grep Cpu
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
是的,這是秒。 這里的參考文檔在這里:
https://psutil.readthedocs.io/en/latest/#psutil.cpu_times
每個屬性表示CPU在給定模式下花費的秒數。
有關top
的描述,請參閱此答案:
https://superuser.com/questions/575202/understanding-top-command-in-unix
您從top
看到的值是百分比,因此它們與您從psutil
看到的值psutil
說實話,目前尚不清楚你在這里想要達到的目標。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.