|
|
1.1 ! root 1: .TH GETRUSAGE 2 "18 July 1983" ! 2: .UC 4 ! 3: .SH NAME ! 4: getrusage \- get information about resource utilization ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .ft B ! 8: #include <sys/time.h> ! 9: #include <sys/resource.h> ! 10: .PP ! 11: .ft B ! 12: .ta \w'#define 'u +\w'RUSAGE_CHILDREN 'u +\w'-1 'u ! 13: #define RUSAGE_SELF 0 /* calling process */ ! 14: #define RUSAGE_CHILDREN -1 /* terminated child processes */ ! 15: .DT ! 16: .PP ! 17: .ft B ! 18: getrusage(who, rusage) ! 19: int who; ! 20: struct rusage *rusage; ! 21: .fi ! 22: .SH DESCRIPTION ! 23: .I Getrusage ! 24: returns information describing the resources utilized by the current ! 25: process, or all its terminated child processes. ! 26: The ! 27: .I who ! 28: parameter is one of RUSAGE_SELF and RUSAGE_CHILDREN. ! 29: If ! 30: .I rusage ! 31: is non-zero, the buffer it points to will be filled in with ! 32: the following structure: ! 33: .PP ! 34: .nf ! 35: .RS ! 36: .ta \w'struct 'u +\w'struct 'u +3u*\w'struct 'u ! 37: struct rusage { ! 38: struct timeval ru_utime; /* user time used */ ! 39: struct timeval ru_stime; /* system time used */ ! 40: int ru_maxrss; ! 41: int ru_ixrss; /* integral shared memory size */ ! 42: int ru_idrss; /* integral unshared data size */ ! 43: int ru_isrss; /* integral unshared stack size */ ! 44: int ru_minflt; /* page reclaims */ ! 45: int ru_majflt; /* page faults */ ! 46: int ru_nswap; /* swaps */ ! 47: int ru_inblock; /* block input operations */ ! 48: int ru_oublock; /* block output operations */ ! 49: int ru_msgsnd; /* messages sent */ ! 50: int ru_msgrcv; /* messages received */ ! 51: int ru_nsignals; /* signals received */ ! 52: int ru_nvcsw; /* voluntary context switches */ ! 53: int ru_nivcsw; /* involuntary context switches */ ! 54: }; ! 55: .RE ! 56: .DT ! 57: .fi ! 58: .PP ! 59: The fields are interpreted as follows: ! 60: .TP 15 ! 61: ru_utime ! 62: the total amount of time spent executing in user mode. ! 63: .TP 15 ! 64: ru_stime ! 65: the total amount of time spent in the system executing on behalf ! 66: of the process(es). ! 67: .TP 15 ! 68: ru_maxrss ! 69: the maximum resident set size utilized (in kilobytes). ! 70: .TP 15 ! 71: ru_ixrss ! 72: an \*(lqintegral\*(rq value indicating the amount of memory used ! 73: which was also shared among other processes. This value is expressed ! 74: in units of kilobytes * seconds-of-execution and is calculated by ! 75: summing the number of shared memory pages in use each time the internal ! 76: system clock ticks and then averaging over 1 second intervals. ! 77: .TP 15 ! 78: ru_idrss ! 79: an integral value of the amount of unshared memory residing in the ! 80: data segment of a process (expressed in units of ! 81: kilobytes * seconds-of-execution). ! 82: .TP 15 ! 83: ru_isrss ! 84: an integral value of the amount of unshared memory residing in the ! 85: stack segment of a process (expressed in units of ! 86: kilobytes * seconds-of-execution). ! 87: .TP 15 ! 88: ru_minflt ! 89: the number of page faults serviced without any i/o activity; here ! 90: i/o activity is avoided by \*(lqreclaiming\*(rq a page frame from ! 91: the list of pages awaiting reallocation. ! 92: .TP 15 ! 93: ru_majflt ! 94: the number of page faults serviced which required i/o activity. ! 95: .TP 15 ! 96: ru_nswap ! 97: the number of times a process was \*(lqswapped\*(rq out of main ! 98: memory. ! 99: .TP 15 ! 100: ru_inblock ! 101: the number of times the file system had to perform input. ! 102: .TP 15 ! 103: ru_outblock ! 104: the number of times the file system had to perform output. ! 105: .TP 15 ! 106: ru_msgsnd ! 107: the number of ipc messages sent. ! 108: .TP 15 ! 109: ru_msgrcv ! 110: the number of ipc messages received. ! 111: .TP 15 ! 112: ru_nsignals ! 113: the number of signals delivered. ! 114: .TP 15 ! 115: ru_nvcsw ! 116: the number of times a context switch resulted due to a process ! 117: voluntarily giving up the processor before its time slice was ! 118: completed (usually to await availability of a resource). ! 119: .TP 15 ! 120: ru_nivcsw ! 121: the number of times a context switch resulted due to a higher ! 122: priority process becoming runnable or because the current process ! 123: exceeded its time slice. ! 124: .SH NOTES ! 125: The numbers ! 126: .I ru_inblock ! 127: and ! 128: .I ru_outblock ! 129: account only for real ! 130: i/o; data supplied by the cacheing mechanism is charged only ! 131: to the first process to read or write the data. ! 132: .SH SEE ALSO ! 133: gettimeofday(2), wait(2) ! 134: .SH BUGS ! 135: There is no way to obtain information about a child process ! 136: which has not yet terminated.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.