linux下getrusage()
2014-01-12 21:11
357 查看
#include <sys/resource.h>
/* Return resource usage information on process indicated by WHO
and put it in *USAGE. Returns 0 for success, -1 for failure. */
extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
参数:
who:可能选择有
RUSAGE_SELF:获取当前进程的资源使用信息。
RUSAGE_CHILDREN:获取子进程的资源使用信息。
usage:指向存放资源使用信息的结构指针
#include <bits/resources.>
/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long int ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long int ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long int ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long int ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long int ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long int ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long int ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long int ru_inblock;
/* Number of output operations via the file system. */
long int ru_oublock;
/* Number of IPC messages sent. */
long int ru_msgsnd;
/* Number of IPC messages received. */
long int ru_msgrcv;
/* Number of signals delivered. */
long int ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long int ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long int ru_nivcsw;
};
/* Return resource usage information on process indicated by WHO
and put it in *USAGE. Returns 0 for success, -1 for failure. */
extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
参数:
who:可能选择有
RUSAGE_SELF:获取当前进程的资源使用信息。
RUSAGE_CHILDREN:获取子进程的资源使用信息。
usage:指向存放资源使用信息的结构指针
#include <bits/resources.>
/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long int ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long int ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long int ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long int ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long int ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long int ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long int ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long int ru_inblock;
/* Number of output operations via the file system. */
long int ru_oublock;
/* Number of IPC messages sent. */
long int ru_msgsnd;
/* Number of IPC messages received. */
long int ru_msgrcv;
/* Number of signals delivered. */
long int ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long int ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long int ru_nivcsw;
};
相关文章推荐
- Unix/Linux下 getrusage 的用法
- Linux中,getrlimit(),setrlimit(),getrusage()
- Linux系统调用--getrusage函数详解
- Measure time in Linux - getrusage vs clock_gettime vs clock vs gettimeofday
- Linux:getrusage的用法
- Linux中getrusage的使用
- Linux:getrusage的用法
- Unix/Linux下 getrusage 的用法
- 新华linux桌面操作系统3.0
- 只有偏执狂才能生存-Oracle开始对Red Hat Linux用户提供服务支持
- linux下重启网络服务
- linux下安装apache与php
- linux使环境变量生效
- linux security tools
- Linux下程式开发2 变量数据类型的代码以及编译&运算符与表达式
- linux 2.6.14内核的移植(基于gec2410开发板)
- linux 网卡负载均衡
- 如何在ext3上恢复数据&&数据恢复 linux
- Quick guide for porting linux to ALTERA DE2-70
- linux 2.6.32 在arm9(s3c2440)平台的移植2 -- Kconfig和Makefile(2)