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 "11 December 2000" "" ""
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 output 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
45 When in the POSIX locale, use the precise traditional format
48 "real %f\enuser %f\ensys %f\en"
51 (with numbers in seconds)
52 where the number of decimals in the output for %f is unspecified
53 but is sufficient to express the clock tick accuracy, and at least one.
55 The variables LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_NUMERIC,
56 NLSPATH and PATH are used. The last one to search for
58 The remaining ones for the text and formatting of the output.
62 was invoked, the exit status is that of
64 Otherwise it is 127 if
66 could not be found, 126 if it could be found but could not be invoked,
67 and some other nonzero value (1-125) if something else went wrong.
72 Below a description of the GNU 1.7 version of
74 Disregarding the name of the utility, GNU makes it output lots of
75 useful information, not only about time used, but also on other
76 resources like memory, I/O and IPC calls (where available).
77 The output is formatted using a format string that can be specified
78 using the \-f option or the TIME environment variable.
80 The default format string is
83 %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
85 %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
89 When the \-p option is given the (portable) output format
100 .SS "The format string"
101 The format is interpreted in the usual printf-like way.
102 Ordinary characters are directly copied, tab, newline
103 and backslash are escaped using \et, \en and \e\e,
104 a percent sign is represented by %%, and otherwise %
105 indicates a conversion. The program
107 will always add a trailing newline itself.
108 The conversions follow. All of those used by
115 Elapsed real time (in [hours:]minutes:seconds).
118 (Not in tcsh.) Elapsed real time (in seconds).
121 Total number of CPU-seconds that the process spent in kernel mode.
124 Total number of CPU-seconds that the process spent in user mode.
127 Percentage of the CPU that this job got, computed as (%U + %S) / %E.
132 Maximum resident set size of the process during its lifetime, in Kbytes.
135 (Not in tcsh.) Average resident set size of the process, in Kbytes.
138 Average total (data+stack+text) memory use of the process,
142 Average size of the process's unshared data area, in Kbytes.
145 (Not in tcsh.) Average size of the process's unshared stack space, in Kbytes.
148 Average size of the process's shared text space, in Kbytes.
151 (Not in tcsh.) System's page size, in bytes.
152 This is a per-system constant, but varies between systems.
155 Number of major page faults that occurred while the process was running.
156 These are faults where the page has to be read in from disk.
159 Number of minor, or recoverable, page faults.
160 These are faults for pages that are not valid but which have
161 not yet been claimed by other virtual pages. Thus the data
162 in the page is still valid but the system tables must be updated.
165 Number of times the process was swapped out of main memory.
168 Number of times the process was context-switched involuntarily
169 (because the time slice expired).
172 Number of waits: times that the program was context-switched voluntarily,
173 for instance while waiting for an I/O operation to complete.
178 Number of file system inputs by the process.
181 Number of file system outputs by the process.
184 Number of socket messages received by the process.
187 Number of socket messages sent by the process.
190 Number of signals delivered to the process.
193 (Not in tcsh.) Name and command line arguments of the command being timed.
196 (Not in tcsh.) Exit status of the command.
199 .BI "\-f " FORMAT ", \-\-format=" FORMAT
200 Specify output format, possibly overriding the format specified
201 in the environment variable TIME.
203 .B "\-p, \-\-portability"
204 Use the portable output format.
206 .BI "\-o " FILE ", \-\-output=" FILE
207 Do not send the results to stderr, but overwrite the specified file.
210 (Used together with \-o.) Do not overwrite but append.
212 .B "\-v, \-\-verbose"
213 Give very verbose output about all the program knows about.
214 .SH "GNU STANDARD OPTIONS"
217 Print a usage message on standard output and exit successfully.
219 .B "\-V, \-\-version"
220 Print version information on standard output, then exit successfully.
223 Terminate option list.
225 Not all resources are measured by all versions of Unix,
226 so some of the values might be reported as zero.
227 The present selection was mostly inspired by the data
228 provided by 4.2 or 4.3BSD.
230 GNU time version 1.7 is not yet localized.
231 Thus, it does not implement the POSIX requirements.
233 The environment variable TIME was badly chosen.
234 It is not unusual for systems like autoconf or make
235 to use environment variables with the name of a utility to override
236 the utility to be used. Uses like MORE or TIME for options to programs
237 (instead of program path names) tend to lead to difficulties.
239 It seems unfortunate that \-o overwrites instead of appends.
240 (That is, the \-a option should be the default.)
242 Mail suggestions and bug reports for GNU
246 .I bug-utils@prep.ai.mit.edu
248 Please include the version of
250 which you can get by running
254 and the operating system
255 and C compiler you used.
264 .IP "David MacKenzie"
265 POSIXization, autoconfiscation, GNU getoptization,
266 documentation, other bug fixes and improvements.
267 .IP "Arne Henrik Juul"
268 Helped with portability
269 .IP "Francois Pinard"
270 Helped with portability