The use of Getrusage in Linux

Source: Internet
Author: User
Tags switches

Declaration:int getrusage (int who, struct rusage *usage);  

The Getrusage function returns the current resource usage. Returns the resource usage for the current process when the WHO parameter is rusage_self, and returns the resource used by the child process with a status of terminating or waiting when it is rusage_children.

The returned result exists in struct struct rusage:

struct Rusage {    struct timeval ru_utime;/* User Time used the duration of use */    struct timeval ru_stime;/* System " D The time of the kernel usage */    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 */};


Use of Getrusage in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.