1 .\" Copyright Andries Brouwer, 2000
3 .\" This page is distributed under GPL.
4 .\" Some fragments of text came from the time-1.7 info file.
5 .\" Inspired by kromJx@crosswinds.net.
7 .TH TIME 1 2008-11-14 "" "Linux User's Manual"
9 time \- time a simple command or give resource usage
11 .BI "time [" options "] " command " [" arguments... "] "
15 command runs the specified program
17 with the given arguments.
22 writes a message to standard error giving timing statistics
23 about this program run.
24 These statistics consist of (i) the elapsed real time
25 between invocation and termination, (ii) the user CPU time
34 and (iii) the system CPU time (the sum of the
43 Note: some shells (e.g.,
47 command that provides less functionality than the command described here.
48 To access the real command, you may need to specify its pathname
54 When in the POSIX locale, use the precise traditional format
57 "real %f\enuser %f\ensys %f\en"
60 (with numbers in seconds)
61 where the number of decimals in the output for %f is unspecified
62 but is sufficient to express the clock tick accuracy, and at least one.
66 was invoked, the exit status is that of
68 Otherwise it is 127 if
70 could not be found, 126 if it could be found but could not be invoked,
71 and some other non-zero value (1-125) if something else went wrong.
83 The last one to search for
85 The remaining ones for the text and formatting of the output.
87 Below a description of the GNU 1.7 version of
89 Disregarding the name of the utility, GNU makes it output lots of
90 useful information, not only about time used, but also on other
91 resources like memory, I/O and IPC calls (where available).
92 The output is formatted using a format string that can be specified
99 The default format string is:
102 %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
104 %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
110 option is given the (portable) output format
122 .SS "The format string"
123 The format is interpreted in the usual printf-like way.
124 Ordinary characters are directly copied, tab, newline
125 and backslash are escaped using \et, \en and \e\e,
126 a percent sign is represented by %%, and otherwise %
127 indicates a conversion.
130 will always add a trailing newline itself.
131 The conversions follow.
139 Elapsed real time (in [hours:]minutes:seconds).
142 (Not in tcsh.) Elapsed real time (in seconds).
145 Total number of CPU-seconds that the process spent in kernel mode.
148 Total number of CPU-seconds that the process spent in user mode.
151 Percentage of the CPU that this job got, computed as (%U + %S) / %E.
156 Maximum resident set size of the process during its lifetime, in Kbytes.
159 (Not in tcsh.) Average resident set size of the process, in Kbytes.
162 Average total (data+stack+text) memory use of the process,
166 Average size of the process's unshared data area, in Kbytes.
169 (Not in tcsh.) Average size of the process's unshared stack space, in Kbytes.
172 Average size of the process's shared text space, in Kbytes.
175 (Not in tcsh.) System's page size, in bytes.
176 This is a per-system constant, but varies between systems.
179 Number of major page faults that occurred while the process was running.
180 These are faults where the page has to be read in from disk.
183 Number of minor, or recoverable, page faults.
184 These are faults for pages that are not valid but which have
185 not yet been claimed by other virtual pages.
187 in the page is still valid but the system tables must be updated.
190 Number of times the process was swapped out of main memory.
193 Number of times the process was context-switched involuntarily
194 (because the time slice expired).
197 Number of waits: times that the program was context-switched voluntarily,
198 for instance while waiting for an I/O operation to complete.
203 Number of file system inputs by the process.
206 Number of file system outputs by the process.
209 Number of socket messages received by the process.
212 Number of socket messages sent by the process.
215 Number of signals delivered to the process.
218 (Not in tcsh.) Name and command-line arguments of the command being timed.
221 (Not in tcsh.) Exit status of the command.
224 .BI "\-f " FORMAT ", \-\-format=" FORMAT
225 Specify output format, possibly overriding the format specified
226 in the environment variable TIME.
228 .B "\-p, \-\-portability"
229 Use the portable output format.
231 .BI "\-o " FILE ", \-\-output=" FILE
232 Do not send the results to \fIstderr\fP, but overwrite the specified file.
235 (Used together with \-o.) Do not overwrite but append.
237 .B "\-v, \-\-verbose"
238 Give very verbose output about all the program knows about.
239 .SS "GNU Standard Options"
242 Print a usage message on standard output and exit successfully.
244 .B "\-V, \-\-version"
245 Print version information on standard output, then exit successfully.
248 Terminate option list.
250 Not all resources are measured by all versions of Unix,
251 so some of the values might be reported as zero.
252 The present selection was mostly inspired by the data
253 provided by 4.2 or 4.3BSD.
255 GNU time version 1.7 is not yet localized.
256 Thus, it does not implement the POSIX requirements.
258 The environment variable
261 It is not unusual for systems like
265 to use environment variables with the name of a utility to override
266 the utility to be used.
267 Uses like MORE or TIME for options to programs
268 (instead of program pathnames) tend to lead to difficulties.
270 It seems unfortunate that
272 overwrites instead of appends.
275 option should be the default.)
277 Mail suggestions and bug reports for GNU
281 .I bug\-utils@prep.ai.mit.edu
283 Please include the version of
285 which you can get by running
289 and the operating system
290 and C compiler you used.
293 .\" .IP "David Keppel"
295 .\" .IP "David MacKenzie"
296 .\" POSIXization, autoconfiscation, GNU getoptization,
297 .\" documentation, other bug fixes and improvements.
298 .\" .IP "Arne Henrik Juul"
299 .\" Helped with portability
300 .\" .IP "Francois Pinard"
301 .\" Helped with portability