分类:
2012-10-24 20:28:52
原文地址:Linux系统调用--getrusage函数详解 作者:raul.liu
【getrusage系统调用】
功能描述:
获取进程的资源使用信息。
用法:
#include
#include
int getrusage(int who, struct rusage *usage);
参数:
who:可能选择有
RUSAGE_SELF:获取当前进程的资源使用信息。
RUSAGE_CHILDREN:获取子进程的资源使用信息。
usage:指向存放资源使用信息的结构指针
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss; /* maximum resident set size */
long ru_ixrss; /* integral shared memory size */
long ru_idrss; /* integral unshared data size */
long ru_isrss; /* integral unshared stack size */
long ru_minflt; /* page reclaims */
long ru_majflt; /* page faults */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary context switches */
};