1TIME(1)                       Linux User's Manual                      TIME(1)
2
3
4

NAME

6       time - time a simple command or give resource usage
7

SYNOPSIS

9       time [options] command [arguments...]
10

DESCRIPTION

12       The  time  command  runs  the  specified program command with the given
13       arguments.  When command finishes, time writes a  message  to  standard
14       error  giving  timing statistics about this program run.  These statis‐
15       tics consist of (i) the elapsed real time between invocation and termi‐
16       nation, (ii) the user CPU time (the sum of the tms_utime and tms_cutime
17       values in a struct tms as returned by times(2)), and (iii)  the  system
18       CPU  time  (the  sum of the tms_stime and tms_cstime values in a struct
19       tms as returned by times(2)).
20
21       Note: some shells (e.g., bash(1)) have a  built-in  time  command  that
22       provides less functionality than the command described here.  To access
23       the real command, you may need to specify its pathname (something  like
24       /usr/bin/time).
25

OPTIONS

27       -p     When in the POSIX locale, use the precise traditional format
28
29                  "real %f\nuser %f\nsys %f\n"
30
31              (with  numbers  in  seconds) where the number of decimals in the
32              output for %f is unspecified but is sufficient  to  express  the
33              clock tick accuracy, and at least one.
34

EXIT STATUS

36       If  command was invoked, the exit status is that of command.  Otherwise
37       it is 127 if command could not be found, 126 if it could be  found  but
38       could not be invoked, and some other nonzero value (1-125) if something
39       else went wrong.
40

ENVIRONMENT

42       The variables LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_NUMERIC, NLSPATH,
43       and  PATH are used.  The last one to search for command.  The remaining
44       ones for the text and formatting of the output.
45

GNU VERSION

47       Below a description of the GNU 1.7 version of time.   Disregarding  the
48       name  of  the  utility, GNU makes it output lots of useful information,
49       not only about time used, but also on other resources like memory,  I/O
50       and  IPC calls (where available).  The output is formatted using a for‐
51       mat string that can be specified using the -f option or the TIME  envi‐
52       ronment variable.
53
54       The default format string is:
55
56           %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
57           %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
58
59       When the -p option is given the (portable) output format
60
61           real %e
62           user %U
63           sys %S
64
65       is used.
66
67   The format string
68       The format is interpreted in the usual printf-like way.  Ordinary char‐
69       acters are directly copied, tab,  newline  and  backslash  are  escaped
70       using \t, \n and \\, a percent sign is represented by %%, and otherwise
71       % indicates a conversion.  The program time will always add a  trailing
72       newline  itself.  The conversions follow.  All of those used by tcsh(1)
73       are supported.
74
75       Time
76
77       %E     Elapsed real time (in [hours:]minutes:seconds).
78
79       %e     (Not in tcsh.) Elapsed real time (in seconds).
80
81       %S     Total number of CPU-seconds that the  process  spent  in  kernel
82              mode.
83
84       %U     Total number of CPU-seconds that the process spent in user mode.
85
86       %P     Percentage of the CPU that this job got, computed as (%U + %S) /
87              %E.
88
89       Memory
90
91       %M     Maximum resident set size of the process during its lifetime, in
92              Kbytes.
93
94       %t     (Not  in  tcsh.)  Average  resident  set size of the process, in
95              Kbytes.
96
97       %K     Average total (data+stack+text) memory use of  the  process,  in
98              Kbytes.
99
100       %D     Average size of the process's unshared data area, in Kbytes.
101
102       %p     (Not  in  tcsh.)  Average  size  of the process's unshared stack
103              space, in Kbytes.
104
105       %X     Average size of the process's shared text space, in Kbytes.
106
107       %Z     (Not in tcsh.) System's page size, in bytes.  This is a per-sys‐
108              tem constant, but varies between systems.
109
110       %F     Number  of major page faults that occurred while the process was
111              running.  These are faults where the page has to be read in from
112              disk.
113
114       %R     Number  of minor, or recoverable, page faults.  These are faults
115              for pages that are not valid but which have not yet been claimed
116              by  other  virtual  pages.   Thus  the data in the page is still
117              valid but the system tables must be updated.
118
119       %W     Number of times the process was swapped out of main memory.
120
121       %c     Number of times the process was  context-switched  involuntarily
122              (because the time slice expired).
123
124       %w     Number  of  waits:  times  that the program was context-switched
125              voluntarily, for instance while waiting for an I/O operation  to
126              complete.
127
128       I/O
129
130       %I     Number of file system inputs by the process.
131
132       %O     Number of file system outputs by the process.
133
134       %r     Number of socket messages received by the process.
135
136       %s     Number of socket messages sent by the process.
137
138       %k     Number of signals delivered to the process.
139
140       %C     (Not  in  tcsh.)  Name and command-line arguments of the command
141              being timed.
142
143       %x     (Not in tcsh.) Exit status of the command.
144
145   GNU options
146       -f FORMAT, --format=FORMAT
147              Specify output format, possibly overriding the format  specified
148              in the environment variable TIME.
149
150       -p, --portability
151              Use the portable output format.
152
153       -o FILE, --output=FILE
154              Do  not  send the results to stderr, but overwrite the specified
155              file.
156
157       -a, --append
158              (Used together with -o.) Do not overwrite but append.
159
160       -v, --verbose
161              Give very verbose output about all the program knows about.
162
163   GNU standard options
164       --help Print a usage message on standard output and exit successfully.
165
166       -V, --version
167              Print version information on standard output, then exit success‐
168              fully.
169
170       --     Terminate option list.
171

BUGS

173       Not  all resources are measured by all versions of UNIX, so some of the
174       values might be reported as zero.  The  present  selection  was  mostly
175       inspired by the data provided by 4.2 or 4.3BSD.
176
177       GNU time version 1.7 is not yet localized.  Thus, it does not implement
178       the POSIX requirements.
179
180       The environment variable TIME was badly chosen.  It is not unusual  for
181       systems  like  autoconf(1) or make(1) to use environment variables with
182       the name of a utility to override the utility to be  used.   Uses  like
183       MORE  or  TIME  for  options to programs (instead of program pathnames)
184       tend to lead to difficulties.
185
186       It seems unfortunate that -o overwrites instead of appends.  (That  is,
187       the -a option should be the default.)
188
189       Mail suggestions and bug reports for GNU time to
190       bug-utils@prep.ai.mit.edu
191       Please include the version of time, which you can get by running
192       time --version
193       and the operating system and C compiler you used.
194

SEE ALSO

196       tcsh(1), times(2), wait3(2)
197

COLOPHON

199       This  page  is  part of release 3.53 of the Linux man-pages project.  A
200       description of the project, and information about reporting  bugs,  can
201       be found at http://www.kernel.org/doc/man-pages/.
202
203
204
205                                  2008-11-14                           TIME(1)
Impressum