-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" Copyright (c) 1992 Drew Eckhardt, March 28, 1992
.\" and Copyright (c) 2002 Michael Kerrisk
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
.\" coverage of getrusage(2), has been split, so that the latter is
.\" document ru_maxrss
.\" 2010-05-24, mtk, enhanced description of various fields
.\"
-.TH GETRUSAGE 2 2010-06-14 "Linux" "Linux Programmer's Manual"
+.TH GETRUSAGE 2 2014-05-10 "Linux" "Linux Programmer's Manual"
.SH NAME
getrusage \- get resource usage
.SH SYNOPSIS
.TP
.BR RUSAGE_THREAD " (since Linux 2.6.26)"
Return resource usage statistics for the calling thread.
+The
+.B _GNU_SOURCE
+feature test macro must be defined (before including
+.I any
+header file)
+in order to obtain the definition of this constant from
+.IR <sys/resource.h> .
.PP
The resource usages are returned in the structure pointed to by
.IR usage ,
structure (seconds plus microseconds).
.TP
.IR ru_maxrss " (since Linux 2.6.32)"
-This is the maximum resident set size used (in kilobytes). For
+This is the maximum resident set size used (in kilobytes).
+For
.BR RUSAGE_CHILDREN ,
this is the resident set size of the largest child, not the maximum
resident set size of the process tree.
.\" On some systems, this is the number of swaps out of physical memory.
.TP
.IR ru_inblock " (since Linux 2.6.22)"
-The number of times the file system had to perform input.
+The number of times the filesystem had to perform input.
.TP
.IR ru_oublock " (since Linux 2.6.22)"
-The number of times the file system had to perform output.
+The number of times the filesystem had to perform output.
.TP
.IR ru_msgsnd " (unmaintained)"
This field is currently unused on Linux.
priority process becoming runnable or because the current process
exceeded its time slice.
.PP
-.SH "RETURN VALUE"
+.SH RETURN VALUE
On success, zero is returned.
On error, \-1 is returned, and
.I errno
.B EINVAL
.I who
is invalid.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
SVr4, 4.3BSD.
POSIX.1-2001 specifies
.BR getrusage (),
-but only specifies the fields
+but specifies only the fields
.I ru_utime
and
.IR ru_stime .
The structure definition shown at the start of this page
was taken from 4.3BSD Reno.
+Ancient systems provided a
+.BR vtimes ()
+function with a similar purpose to
+.BR getrusage ().
+For backward compatibility, glibc also provides
+.BR vtimes ().
+All new applications should be written using
+.BR getrusage ().
+
See also the description of
.IR /proc/PID/stat
in
.BR proc (5).
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR clock_gettime (2),
.BR getrlimit (2),
.BR times (2),
.BR wait (2),
.BR wait4 (2),
.BR clock (3)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.