proc/{pid}/stat

Linux中,某个进程消耗的CPU,
需要查看proc/{pid}/stat

该数据结构体如下:

typedef struct statstruct_proc {
int pid; /** The process id. **/
char exName [_POSIX_PATH_MAX]; /** The filename of the executable **/
char state; /** 1 **/ /** R is running, S is sleeping,
D is sleeping in an uninterruptible wait,
Z is zombie, T is traced or stopped **/
unsigned euid, /** effective user id **/
egid; /** effective group id */
int ppid; /** The pid of the parent. **/
int pgrp; /** The pgrp of the process. **/
int session; /** The session id of the process. **/
int tty; /** The tty the process uses **/
int tpgid; /** (too long) **/
unsigned int flags; /** The flags of the process. **/
unsigned int minflt; /** The number of minor faults **/
unsigned int cminflt; /** The number of minor faults with childs **/
unsigned int majflt; /** The number of major faults **/
unsigned int cmajflt; /** The number of major faults with childs **/
int utime; /** user mode jiffies **/
int stime; /** kernel mode jiffies **/
int cutime; /** user mode jiffies with childs **/
int cstime; /** kernel mode jiffies with childs **/
int counter; /** process's next timeslice **/
int priority; /** the standard nice value, plus fifteen **/
unsigned int timeout; /** The time in jiffies of the next timeout **/
unsigned int itrealvalue; /** The time before the next SIGALRM is sent to the process **/
int starttime; /** 20 **/ /** Time the process started after system boot **/
unsigned int vsize; /** Virtual memory size **/
unsigned int rss; /** Resident Set Size **/
unsigned int rlim; /** Current limit in bytes on the rss **/
unsigned int startcode; /** The address above which program text can run **/
unsigned int endcode; /** The address below which program text can run **/
unsigned int startstack; /** The address of the start of the stack **/
unsigned int kstkesp; /** The current value of ESP **/
unsigned int kstkeip; /** The current value of EIP **/
int signal; /** The bitmap of pending signals **/
int blocked; /** 30 **/ /** The bitmap of blocked signals **/
int sigignore; /** The bitmap of ignored signals **/
int sigcatch; /** The bitmap of catched signals **/
unsigned int wchan; /** 33 **/ /** (too long) **/
int sched, /** scheduler **/
sched_priority; /** scheduler priority **/

} procinfo;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值