1 .\" Copyright Andries Brouwer, 2000
2 .\" Some fragments of text came from the time-1.7 info file.
3 .\" Inspired by kromJx@crosswinds.net.
5 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
9 .TH TIME 1 2008-11-14 "" "Linux User's Manual"
11 time \- time a simple command or give resource usage
13 .BI "time [" options "] " command " [" arguments... "] "
17 command runs the specified program
19 with the given arguments.
24 writes a message to standard error giving timing statistics
25 about this program run.
26 These statistics consist of (i) the elapsed real time
27 between invocation and termination, (ii) the user CPU time
36 and (iii) the system CPU time (the sum of the
45 Note: some shells (e.g.,
49 command that provides less functionality than the command described here.
50 To access the real command, you may need to specify its pathname
56 When in the POSIX locale, use the precise traditional format
59 "real %f\enuser %f\ensys %f\en"
62 (with numbers in seconds)
63 where the number of decimals in the output for %f is unspecified
64 but is sufficient to express the clock tick accuracy, and at least one.
68 was invoked, the exit status is that of
70 Otherwise it is 127 if
72 could not be found, 126 if it could be found but could not be invoked,
73 and some other nonzero value (1-125) if something else went wrong.
85 The last one to search for
87 The remaining ones for the text and formatting of the output.
89 Below a description of the GNU 1.7 version of
91 Disregarding the name of the utility, GNU makes it output lots of
92 useful information, not only about time used, but also on other
93 resources like memory, I/O and IPC calls (where available).
94 The output is formatted using a format string that can be specified
101 The default format string is:
104 %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
106 %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
112 option is given the (portable) output format
124 .SS The format string
125 The format is interpreted in the usual printf-like way.
126 Ordinary characters are directly copied, tab, newline
127 and backslash are escaped using \et, \en and \e\e,
128 a percent sign is represented by %%, and otherwise %
129 indicates a conversion.
132 will always add a trailing newline itself.
133 The conversions follow.
141 Elapsed real time (in [hours:]minutes:seconds).
144 (Not in tcsh.) Elapsed real time (in seconds).
147 Total number of CPU-seconds that the process spent in kernel mode.
150 Total number of CPU-seconds that the process spent in user mode.
153 Percentage of the CPU that this job got, computed as (%U + %S) / %E.
158 Maximum resident set size of the process during its lifetime, in Kbytes.
161 (Not in tcsh.) Average resident set size of the process, in Kbytes.
164 Average total (data+stack+text) memory use of the process,
168 Average size of the process's unshared data area, in Kbytes.
171 (Not in tcsh.) Average size of the process's unshared stack space, in Kbytes.
174 Average size of the process's shared text space, in Kbytes.
177 (Not in tcsh.) System's page size, in bytes.
178 This is a per-system constant, but varies between systems.
181 Number of major page faults that occurred while the process was running.
182 These are faults where the page has to be read in from disk.
185 Number of minor, or recoverable, page faults.
186 These are faults for pages that are not valid but which have
187 not yet been claimed by other virtual pages.
189 in the page is still valid but the system tables must be updated.
192 Number of times the process was swapped out of main memory.
195 Number of times the process was context-switched involuntarily
196 (because the time slice expired).
199 Number of waits: times that the program was context-switched voluntarily,
200 for instance while waiting for an I/O operation to complete.
205 Number of file system inputs by the process.
208 Number of file system outputs by the process.
211 Number of socket messages received by the process.
214 Number of socket messages sent by the process.
217 Number of signals delivered to the process.
220 (Not in tcsh.) Name and command-line arguments of the command being timed.
223 (Not in tcsh.) Exit status of the command.
226 .BI "\-f " FORMAT ", \-\-format=" FORMAT
227 Specify output format, possibly overriding the format specified
228 in the environment variable TIME.
230 .B "\-p, \-\-portability"
231 Use the portable output format.
233 .BI "\-o " FILE ", \-\-output=" FILE
234 Do not send the results to
236 but overwrite the specified file.
239 (Used together with \-o.) Do not overwrite but append.
241 .B "\-v, \-\-verbose"
242 Give very verbose output about all the program knows about.
243 .SS GNU standard options
246 Print a usage message on standard output and exit successfully.
248 .B "\-V, \-\-version"
249 Print version information on standard output, then exit successfully.
252 Terminate option list.
254 Not all resources are measured by all versions of UNIX,
255 so some of the values might be reported as zero.
256 The present selection was mostly inspired by the data
257 provided by 4.2 or 4.3BSD.
259 GNU time version 1.7 is not yet localized.
260 Thus, it does not implement the POSIX requirements.
262 The environment variable
265 It is not unusual for systems like
269 to use environment variables with the name of a utility to override
270 the utility to be used.
271 Uses like MORE or TIME for options to programs
272 (instead of program pathnames) tend to lead to difficulties.
274 It seems unfortunate that
276 overwrites instead of appends.
279 option should be the default.)
281 Mail suggestions and bug reports for GNU
285 .I bug\-utils@prep.ai.mit.edu
287 Please include the version of
289 which you can get by running
293 and the operating system
294 and C compiler you used.
297 .\" .IP "David Keppel"
299 .\" .IP "David MacKenzie"
300 .\" POSIXization, autoconfiscation, GNU getoptization,
301 .\" documentation, other bug fixes and improvements.
302 .\" .IP "Arne Henrik Juul"
303 .\" Helped with portability
304 .\" .IP "Francois Pinard"
305 .\" Helped with portability