查找运行进程的处理器ID(通过类似于顶部的命令/界面) [英] Finding processor id in which process is running [through command/interface similar to top]
本文介绍了查找运行进程的处理器ID(通过类似于顶部的命令/界面)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法可以让CPU获得进程正在运行的CPU?
Is there any way i can get the CPU which CPU the process is running?
推荐答案
您可以使用/proc/[id]/stat
文件并读取第39个值(用空格分隔).这说明[pid]的进程当前在哪个CPU ID上运行:
You can use /proc/[id]/stat
file and read the 39th value (seperated by spaces). This tells which cpu id the process of [pid] is currently running on:
cat /proc/[id]/stat | awk '{print $39}'
有关更多信息: man proc
.
For more info: man proc
.
这篇关于查找运行进程的处理器ID(通过类似于顶部的命令/界面)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文