开阔未来
全部博文(102)
分类: LINUX
2008-12-29 11:46:57
【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 */
};