Cygwin top 命令 - 查看所有用户的进程
有谁知道如何在 Cygwin 中使用 top
命令查看所有用户的进程(系统下 procps
库的一部分)。
我知道这可以在 *nix 中完成,但我在 Cygwin 中挣扎。我尝试过使用 pslist,但它在 putty SSH 控制台中不起作用。
我需要一个解决方案,让我可以使用 SSH 看到类似于 top
的对话框。我根本没有任何 NTLM SSO 访问 Win2k3 来宾的权限,因此 ssh 是唯一的进入方式。
Does anybody know how to see the processes for all users using top
command in Cygwin (part of procps
library under System).
I know this can be done in *nix but I am struggling in Cygwin. I have tried using pslist
but it does not behave in a putty SSH console.
I need to have a solution where I can see a top
like dialog using SSH. I do not have any NTLM SSO access to the Win2k3 guest at all so ssh is the only way in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
top
仅显示 Cygwin 进程。ps -W
也会列出 Windows 进程。top
only displays Cygwin processes.ps -W
will list Windows processes as well.很多时候,命令“tasklist”可以更有效地完成工作。它内置于 Windows 中,只需确保您的 System32 文件夹是您的 bash 配置文件路径的一部分。还有 Props 本身。您还应该尝试在终端上使用 mintty。您始终可以尝试将任何这些任务应用程序附加到屏幕,和/或使用手表轮询信息。
Manytimes the command "tasklist" gets the job done more effectively. It built into windows, just make sure your System32 folder is part of your bash profile PATH. There is also procps itself. You should also try using mintty for your terminal. You could always try attaching any of these task apps to screen, and or using watch to poll the information.
看来你可以做类似的事情:
用户和内核模式时间似乎以 1/10,000,000 秒表示。
您应该能够对该输出进行后处理以获得每秒的 CPU 使用率。
这里使用 cygwin 的
perl
:输出类似:
每秒。
请注意,如果空闲系统上的系统空闲进程显示略低于 800%,那是因为您的系统有 8 个 CPU 核心(至少有 8 个线程),因为这会计算所有 CPU 的 CPU 时间。
另请注意,上面的
EVERY:1
是一个谎言。wmic
似乎并没有每秒给出该输出。更有可能的是,它在每个报告之间休眠大约 1 秒,并且不会补偿计算报告所需的时间。因此,在实践中,它会每 1 秒运行一次,这意味着这些百分比不是很准确,并且略有高估。It seems you can do something like:
The User and Kernel mode times there seem to be expressed in 1/10,000,000th of second.
You should be able to post-process that output to get the CPU-usage per second.
Here using cygwin's
perl
:Outputs something like:
every second.
Note that if the System Idle Process shows just under 800% on an idle system, that's because your system has 8 CPU cores (well at least 8 threads) as that counts the CPU time of all CPUs.
Also note that the
EVERY:1
above is a lie.wmic
doesn't seem to give that output every second. More likely, it sleeps roughly 1 second between each report and doesn't compensate for the time it takes to compute the report. So in practice, it will run every 1 second and a bit which means those percentages are not very accurate and slightly overestimated.