Blame man1/time.1

Packit 7cfc04
.\" Copyright Andries Brouwer, 2000
Packit 7cfc04
.\" Some fragments of text came from the time-1.7 info file.
Packit 7cfc04
.\" Inspired by kromJx@crosswinds.net.
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
Packit 7cfc04
.\" Distributed under GPL
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH TIME 1 2017-09-15 "" "Linux User's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
time \- time a simple command or give resource usage
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.BI "time [" options "] " command " [" arguments... "] "
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.B time
Packit 7cfc04
command runs the specified program
Packit 7cfc04
.I command
Packit 7cfc04
with the given arguments.
Packit 7cfc04
When
Packit 7cfc04
.I command
Packit 7cfc04
finishes,
Packit 7cfc04
.B time
Packit 7cfc04
writes a message to standard error giving timing statistics
Packit 7cfc04
about this program run.
Packit 7cfc04
These statistics consist of (i) the elapsed real time
Packit 7cfc04
between invocation and termination, (ii) the user CPU time
Packit 7cfc04
(the sum of the
Packit 7cfc04
.I tms_utime
Packit 7cfc04
and
Packit 7cfc04
.I tms_cutime
Packit 7cfc04
values in a
Packit 7cfc04
.I "struct tms"
Packit 7cfc04
as returned by
Packit 7cfc04
.BR times (2)),
Packit 7cfc04
and (iii) the system CPU time (the sum of the
Packit 7cfc04
.I  tms_stime
Packit 7cfc04
and
Packit 7cfc04
.I tms_cstime
Packit 7cfc04
values in a
Packit 7cfc04
.I "struct tms"
Packit 7cfc04
as returned by
Packit 7cfc04
.BR times (2)).
Packit 7cfc04
.PP
Packit 7cfc04
Note: some shells (e.g.,
Packit 7cfc04
.BR bash (1))
Packit 7cfc04
have a built-in
Packit 7cfc04
.B time
Packit 7cfc04
command that provides similar information on the usage of time and
Packit 7cfc04
possibly other resources.
Packit 7cfc04
To access the real command, you may need to specify its pathname
Packit 7cfc04
(something like
Packit 7cfc04
.IR /usr/bin/time ).
Packit 7cfc04
.SH OPTIONS
Packit 7cfc04
.TP
Packit 7cfc04
.B \-p
Packit 7cfc04
When in the POSIX locale, use the precise traditional format
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
"real %f\enuser %f\ensys %f\en"
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
(with numbers in seconds)
Packit 7cfc04
where the number of decimals in the output for %f is unspecified
Packit 7cfc04
but is sufficient to express the clock tick accuracy, and at least one.
Packit 7cfc04
.SH EXIT STATUS
Packit 7cfc04
If
Packit 7cfc04
.I command
Packit 7cfc04
was invoked, the exit status is that of
Packit 7cfc04
.IR command .
Packit 7cfc04
Otherwise, it is 127 if
Packit 7cfc04
.I command
Packit 7cfc04
could not be found, 126 if it could be found but could not be invoked,
Packit 7cfc04
and some other nonzero value (1\(en125) if something else went wrong.
Packit 7cfc04
.SH ENVIRONMENT
Packit 7cfc04
The variables
Packit 7cfc04
.BR LANG ,
Packit 7cfc04
.BR LC_ALL ,
Packit 7cfc04
.BR LC_CTYPE ,
Packit 7cfc04
.BR LC_MESSAGES ,
Packit 7cfc04
.BR LC_NUMERIC ,
Packit 7cfc04
and
Packit 7cfc04
.BR NLSPATH
Packit 7cfc04
are used for the text and formatting of the output.
Packit 7cfc04
.B PATH
Packit 7cfc04
is used to search for
Packit 7cfc04
.IR command .
Packit 7cfc04
The remaining ones for the text and formatting of the output.
Packit 7cfc04
.SH GNU VERSION
Packit 7cfc04
Below a description of the GNU 1.7 version of
Packit 7cfc04
.BR time .
Packit 7cfc04
Disregarding the name of the utility, GNU makes it output lots of
Packit 7cfc04
useful information, not only about time used, but also on other
Packit 7cfc04
resources like memory, I/O and IPC calls (where available).
Packit 7cfc04
The output is formatted using a format string that can be specified
Packit 7cfc04
using the
Packit 7cfc04
.I \-f
Packit 7cfc04
option or the
Packit 7cfc04
.B TIME
Packit 7cfc04
environment variable.
Packit 7cfc04
.PP
Packit 7cfc04
The default format string is:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
Packit 7cfc04
%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
When the
Packit 7cfc04
.I \-p
Packit 7cfc04
option is given, the (portable) output format is used:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
real %e
Packit 7cfc04
user %U
Packit 7cfc04
sys %S
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.\"
Packit 7cfc04
.SS The format string
Packit 7cfc04
The format is interpreted in the usual printf-like way.
Packit 7cfc04
Ordinary characters are directly copied, tab, newline
Packit 7cfc04
and backslash are escaped using \et, \en and \e\e,
Packit 7cfc04
a percent sign is represented by %%, and otherwise %
Packit 7cfc04
indicates a conversion.
Packit 7cfc04
The program
Packit 7cfc04
.B time
Packit 7cfc04
will always add a trailing newline itself.
Packit 7cfc04
The conversions follow.
Packit 7cfc04
All of those used by
Packit 7cfc04
.BR tcsh (1)
Packit 7cfc04
are supported.
Packit 7cfc04
.PP
Packit 7cfc04
.B "Time"
Packit 7cfc04
.TP
Packit 7cfc04
.B %E
Packit 7cfc04
Elapsed real time (in [hours:]minutes:seconds).
Packit 7cfc04
.TP
Packit 7cfc04
.B %e
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
Elapsed real time (in seconds).
Packit 7cfc04
.TP
Packit 7cfc04
.B %S
Packit 7cfc04
Total number of CPU-seconds that the process spent in kernel mode.
Packit 7cfc04
.TP
Packit 7cfc04
.B %U
Packit 7cfc04
Total number of CPU-seconds that the process spent in user mode.
Packit 7cfc04
.TP
Packit 7cfc04
.B %P
Packit 7cfc04
Percentage of the CPU that this job got, computed as (%U + %S) / %E.
Packit 7cfc04
.PP
Packit 7cfc04
.B "Memory"
Packit 7cfc04
.TP
Packit 7cfc04
.B %M
Packit 7cfc04
Maximum resident set size of the process during its lifetime, in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %t
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
Average resident set size of the process, in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %K
Packit 7cfc04
Average total (data+stack+text) memory use of the process,
Packit 7cfc04
in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %D
Packit 7cfc04
Average size of the process's unshared data area, in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %p
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
Average size of the process's unshared stack space, in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %X
Packit 7cfc04
Average size of the process's shared text space, in Kbytes.
Packit 7cfc04
.TP
Packit 7cfc04
.B %Z
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
System's page size, in bytes.
Packit 7cfc04
This is a per-system constant, but varies between systems.
Packit 7cfc04
.TP
Packit 7cfc04
.B %F
Packit 7cfc04
Number of major page faults that occurred while the process was running.
Packit 7cfc04
These are faults where the page has to be read in from disk.
Packit 7cfc04
.TP
Packit 7cfc04
.B %R
Packit 7cfc04
Number of minor, or recoverable, page faults.
Packit 7cfc04
These are faults for pages that are not valid but which have
Packit 7cfc04
not yet been claimed by other virtual pages.
Packit 7cfc04
Thus the data
Packit 7cfc04
in the page is still valid but the system tables must be updated.
Packit 7cfc04
.TP
Packit 7cfc04
.B %W
Packit 7cfc04
Number of times the process was swapped out of main memory.
Packit 7cfc04
.TP
Packit 7cfc04
.B %c
Packit 7cfc04
Number of times the process was context-switched involuntarily
Packit 7cfc04
(because the time slice expired).
Packit 7cfc04
.TP
Packit 7cfc04
.B %w
Packit 7cfc04
Number of waits: times that the program was context-switched voluntarily,
Packit 7cfc04
for instance while waiting for an I/O operation to complete.
Packit 7cfc04
.PP
Packit 7cfc04
.B "I/O"
Packit 7cfc04
.TP
Packit 7cfc04
.B %I
Packit 7cfc04
Number of filesystem inputs by the process.
Packit 7cfc04
.TP
Packit 7cfc04
.B %O
Packit 7cfc04
Number of filesystem outputs by the process.
Packit 7cfc04
.TP
Packit 7cfc04
.B %r
Packit 7cfc04
Number of socket messages received by the process.
Packit 7cfc04
.TP
Packit 7cfc04
.B %s
Packit 7cfc04
Number of socket messages sent by the process.
Packit 7cfc04
.TP
Packit 7cfc04
.B %k
Packit 7cfc04
Number of signals delivered to the process.
Packit 7cfc04
.TP
Packit 7cfc04
.B %C
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
Name and command-line arguments of the command being timed.
Packit 7cfc04
.TP
Packit 7cfc04
.B %x
Packit 7cfc04
(Not in
Packit 7cfc04
.BR tcsh (1).)
Packit 7cfc04
Exit status of the command.
Packit 7cfc04
.SS GNU options
Packit 7cfc04
.TP
Packit 7cfc04
.BI "\-f " format ", \-\-format=" format
Packit 7cfc04
Specify output format, possibly overriding the format specified
Packit 7cfc04
in the environment variable TIME.
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-p, \-\-portability"
Packit 7cfc04
Use the portable output format.
Packit 7cfc04
.TP
Packit 7cfc04
.BI "\-o " file ", \-\-output=" file
Packit 7cfc04
Do not send the results to
Packit 7cfc04
.IR stderr ,
Packit 7cfc04
but overwrite the specified file.
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-a, \-\-append"
Packit 7cfc04
(Used together with \-o.) Do not overwrite but append.
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-v, \-\-verbose"
Packit 7cfc04
Give very verbose output about all the program knows about.
Packit 7cfc04
.SS GNU standard options
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-\-help"
Packit 7cfc04
Print a usage message on standard output and exit successfully.
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-V, \-\-version"
Packit 7cfc04
Print version information on standard output, then exit successfully.
Packit 7cfc04
.TP
Packit 7cfc04
.B "\-\-"
Packit 7cfc04
Terminate option list.
Packit 7cfc04
.SH BUGS
Packit 7cfc04
Not all resources are measured by all versions of UNIX,
Packit 7cfc04
so some of the values might be reported as zero.
Packit 7cfc04
The present selection was mostly inspired by the data
Packit 7cfc04
provided by 4.2 or 4.3BSD.
Packit 7cfc04
.PP
Packit 7cfc04
GNU time version 1.7 is not yet localized.
Packit 7cfc04
Thus, it does not implement the POSIX requirements.
Packit 7cfc04
.PP
Packit 7cfc04
The environment variable
Packit 7cfc04
.B TIME
Packit 7cfc04
was badly chosen.
Packit 7cfc04
It is not unusual for systems like
Packit 7cfc04
.BR autoconf (1)
Packit 7cfc04
or
Packit 7cfc04
.BR make (1)
Packit 7cfc04
to use environment variables with the name of a utility to override
Packit 7cfc04
the utility to be used.
Packit 7cfc04
Uses like MORE or TIME for options to programs
Packit 7cfc04
(instead of program pathnames) tend to lead to difficulties.
Packit 7cfc04
.PP
Packit 7cfc04
It seems unfortunate that
Packit 7cfc04
.I \-o
Packit 7cfc04
overwrites instead of appends.
Packit 7cfc04
(That is, the
Packit 7cfc04
.I \-a
Packit 7cfc04
option should be the default.)
Packit 7cfc04
.PP
Packit 7cfc04
Mail suggestions and bug reports for GNU
Packit 7cfc04
.B time
Packit 7cfc04
to
Packit 7cfc04
.IR bug\-utils@prep.ai.mit.edu .
Packit 7cfc04
Please include the version of
Packit 7cfc04
.BR time ,
Packit 7cfc04
which you can get by running
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
time \-\-version
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
and the operating system
Packit 7cfc04
and C compiler you used.
Packit 7cfc04
.\" .SH AUTHORS
Packit 7cfc04
.\" .TP
Packit 7cfc04
.\" .IP "David Keppel"
Packit 7cfc04
.\" Original version
Packit 7cfc04
.\" .IP "David MacKenzie"
Packit 7cfc04
.\" POSIXization, autoconfiscation, GNU getoptization,
Packit 7cfc04
.\" documentation, other bug fixes and improvements.
Packit 7cfc04
.\" .IP "Arne Henrik Juul"
Packit 7cfc04
.\" Helped with portability
Packit 7cfc04
.\" .IP "Francois Pinard"
Packit 7cfc04
.\" Helped with portability
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR bash (1),
Packit 7cfc04
.BR tcsh (1),
Packit 7cfc04
.BR times (2),
Packit 7cfc04
.BR wait3 (2)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.