Linux下如何获取进程信息

发布于 2024-10-31 07:44:20 字数 280 浏览 0 评论 0原文

如何从内核获取进程统计信息并返回 buf,如下所示?

进程数:ticks_user:ticks_system:ticks_interrupt:cpu秒:procsizes:驻留段大小

我在/proc/[pid]/stat中找到了一些信息,但是没有关于ticks系统的数据, ticks_interrupt 和 cpusecond。

我在哪里可以找到有关这些的信息?

任何指向 API 或文档的指针都会有所帮助。

How can I get process statistics from the kernel and return the buf as the following?

number of processes : ticks_user : ticks_system : ticks_interrupt : cpuseconds : procsizes : resident segment sizes

I found some information in /proc/[pid]/stat, but there is no data about ticks system, ticks_interrupt, and cpusecond.

Where can I find information about these?

Any pointers to API or documentation will be helpful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

亣腦蒛氧 2024-11-07 07:44:20

用于

ps ax
top
htop

开始,阅读手册页,对于 top/htop,按 h 获取帮助屏幕 q 退出;

然而,没有一个联机帮助页提到刻度 - 它是什么?

Use

ps ax
top
htop

for the start, read the manpage, and for top/htop press h to get a help screen q to quit;

However, none of the manpages mentions ticks - what is it?

神仙妹妹 2024-11-07 07:44:20

您可以尝试vmstat。它不是用蜱虫来表示的,但为什么需要蜱虫呢?

CPU
   These are percentages of total CPU time.
   us: Time spent running non-kernel code. (user time, including nice time)
   sy: Time spent running kernel code. (system time)
   id: Time spent idle. Prior to Linux 2.5.41, this includes I/O-wait time.
   wa: Time spent waiting for I/O. Prior to Linux 2.5.41, included in idle.
   st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

您打算如何处理这些信息?

有时它也可能grep通过内核源代码,尝试你的流行语。

You may can give vmstat a try. It is not in ticks, but why do you need ticks?

CPU
   These are percentages of total CPU time.
   us: Time spent running non-kernel code. (user time, including nice time)
   sy: Time spent running kernel code. (system time)
   id: Time spent idle. Prior to Linux 2.5.41, this includes I/O-wait time.
   wa: Time spent waiting for I/O. Prior to Linux 2.5.41, included in idle.
   st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

What are you planing to do with this information?

Sometimes it may also to grep through the kernel sources, trying your buzzwords.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文