linux c 结束子进程,[急]linux对于c 如何获得一个进程及其子进程从开始到结束 它的最大CPU% MEM%使用率...

对于c 如何获得一个进程及其子进程从开始到结束 它的最大CPU% MEM%使用率

|

再多说些:

用最普通的fopen, fread读取:

/proc/stat

可以获得整个系统使用的CPU切片数

/proc/ /stat

一个进程从某一时刻的CPU切片数 utime + stime, MEM%使用数量 (vsize)

utime %lu

The number of jiffies that this process has been scheduled in user mode.

stime %lu

The number of jiffies that this process has been scheduled in kernel mode.

vsize %lu

Virtual memory size in bytes.

rss %ld

Resident Set Size: number of pages the process has in real memory, minus 3 for adminis-

trative  purposes.  This  is  just  the  pages which count towards text, data, or stack

space.  This does not include pages which have not been demand-loaded in, or which  are

swapped out.

最后通过这些基本参数,自己用公式计算你想要的比值即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值