[英]How do I get the no of processes that have been created since the last boot on a Linux machine
How do I get the no of processes that have been created since the last boot on a Linux machine. 如何获得自Linux机器上次启动以来已创建的进程数。
I want to use it in a C++ program so I prefer just knowing which proc file has it 我想在C ++程序中使用它,所以我更喜欢只知道哪个proc文件具有它
If you want to know the number of forks
there is /proc/stat
: 如果您想知道
forks
的数量,则有/proc/stat
:
processes XXXX Number of forks since boot.
自上次启动以来的叉数:
vmstat -f
Looking at processes inside /proc/stat
will show you the number of processes created which may include the processes created using fork()
as well as clone()
. 查看
/proc/stat
的进程将向您显示创建的进程数,其中可能包括使用fork()
和clone()
创建的进程。 To get the number of procceses forked since bootup you will have to run 要获取自启动以来分叉的过程数,您必须运行
vmstat -f
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.