TIME(1) — User’s Manual — Commands
NAME
time − time a command
SYNOPSIS
time [ command ]
DESCRIPTION
There are two distinct versions of time: it is built in to the C-shell, and is an executable program available in /bin/time when using the Bourne shell. In both cases, times are displayed on the diagnostic output stream.
In the case of the C-shell, a time command with no command argument simply displays a summary of time used by this shell and its children. When arguments are given the specified simple command is timed and the C-shell displays a time summary as described below under the time variable. If necessary, an extra shell is created to print the time statistic when the command completes.
The default resource-usage summary is a line of the form:
uuu.uu sss.ss ee:ee pp% xxx+dddk iii+oooio mmmpf+www
where uuu.u is the user time (U), sss.s is the system time (S), ee:ee is the elapsed time (E), pp is the percentage of CPU time versus elapsed time (P), xxx is the average shared memory in Kilobytes (X), ddd is the average unshared data space in Kilobytes (D), iii and ooo are the number of block input and output operations respectively (I and O), mmm is the number of page faults (M), and ww is the number of swaps (W).
The time variable controls the display that the C-shell prints when it times a command. The time variable can be supplied with one or two values. The first value is a number — n for instance. The C-shell displays a resource-usage summary for any command running for more than n CPU seconds. The second value is optional and is a character string which determines which resources the user wishes displayed. The character string can be any string of text with embedded control key-letters in it. A control key-letter is a percent sign (%) followed by a single upper-case letter. To print a percent sign, use two percent signs in a row. Unrecognized key-letters are simply printed. The control key-letters are:
DAverage amount of unshared data space used in Kilobytes.
EElapsed (wallclock) time for the command.
FPage faults.
INumber of block input operations.
KAverage amount of unshared stack space used in Kilobytes.
MMaximum real memory used during execution of the process.
ONumber of block output operations.
PTotal CPU time — U (user) plus S (system) — as a percentage of E (elapsed) time.
SNumber of seconds of CPU time consumed by the kernel on behalf of the user’s process.
UNumber of seconds of CPU time devoted to the user’s process.
WNumber of swaps.
XAverage amount of shared memory used in Kilobytes.
The time command in ‘/bin/time’ times the given command, which must be specified, that is, command is not optional as it is in the C-shell’s timing facility. When the command is complete, time displays the elapsed time during the command, the time spent in the system, and the time spent in execution of the command. Times are reported in seconds.
EXAMPLES
The two examples here show the differences between the csh version of time and the version in /bin/time. The example assumes that csh is the shell in use.
angel% time wc /usr/man/man1/csh.1
1876 11223 65895 /usr/man/man1/csh.1
2.7u 0.9s 0:03 91% 3+5k 19+2io 1pf+0w
angel% /bin/time wc /usr/man/man1/csh.1
1876 11223 65895 /usr/man/man1/csh.1
4.3 real 2.7 user 1.0 sys
angel%
BUGS
Elapsed time is accurate to the second, while the CPU times are measured to the 50th second. Thus the sum of the CPU times can be up to a second larger than the elapsed time.
Sun System Release 1.0 — 2 November 1983