【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 */

    };

    返回说明:

    成功执行时,返回0。失败返回-1,errno被设为以下的某个值

    EFAULT:usage指针指向的空间不可访问

    EINVAL:who参数无效


GitHub 加速计划 / li / linux-dash
11
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐