This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 months ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
ps(1) 手册页显示您可以使用
psr
字段:或者您可以使用 cpuid 字段,它可以执行相同的操作。
使用两个名称的原因是为了与 Solaris (
psr
) 和 NetBSD/OpenBSD (cpuid
)。要也获取线程,请添加
-L
选项(如果使用-o
,则添加lwp
字段)。没有线程:
有线程:
还有一个未记录的
-P
选项,它将psr
添加到普通字段:The ps(1) man page says you can use the
psr
field:Or you can use the
cpuid
field, which does the same thing.The reason for two names is for compatibility with Solaris (
psr
) and NetBSD/OpenBSD (cpuid
).To get threads too, add the
-L
option (and thelwp
field if you are using-o
).Without threads:
With threads:
There's also an undocumented
-P
option, which addspsr
to the normal fields:哪个是多个处理器?根据联机帮助页,它没有提供此选项。但在我的 Debian 稳定系统上,它接受未记录的
-o cpu
after looking at the source, and the output of
ps L
, I believe your answer is either thecpuid
orsgi_p
output options, column IDs CPUID and P, respectively.And 'cpu' should work according to this note in output.c, but it's currently tied to the 'nop' output pr_nop():
{"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, /* FIXME ... HP-UX 希望将此作为 SMP 的 CPU 编号? */
which of multiple processors? it does not offer an option for that according to the manpage. but on my Debian stable system it accepts the undocumented
-o cpu
after looking at the source, and the output of
ps L
, I believe your answer is either thecpuid
orsgi_p
output options, column IDs CPUID and P, respectively.And 'cpu' should work according to this note in output.c, but it's currently tied to the 'nop' output pr_nop():
{"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
同样被低估的是:
您可以添加迭代计数(例如仅一次迭代的 mpstat 1 1 )。
要仍然有彩色终端输出,请告诉
mpstat
:要在终端上静态更新而不滚动:
Also much underrated:
You can add an iteration count (like
mpstat 1 1
for just one iteration).To still have color terminal output, tell
mpstat
:To have it statically updating on a terminal without scrolling:
我在Arch上这样做了,它可能会帮助那里的人:
I did it this way on Arch, it might help someone out there: