time

Name

time -- run programs and summarize system resource usage

Description

time is as specified in the SUS but with differences as listed below.

LSB Deprecated Differences

The behaviors specified in this section are expected to disappear from a future version of the LSB; applications should only use the non-LSB-deprecated behaviors.

-o FILE, --output=FILE

writes the resource use statistics to FILE instead of to the standard error stream. By default, this overwrites the file, destroying the file's previous contents.

-a, --append

appends the resource use information to the output file instead of overwriting it.

-f FORMAT, --format=FORMAT

uses FORMAT as the format string that controls the output of time. See "Formatting the Output" below more information.

--portability

is equivalent to -p.

-v, --verbose

displays each available piece of information on the program's resource use on its own line, with an English description of its meaning.

-V, --version

prints the version number of time and exits.

Formatting the Output (LSB Deprecated)

The format string FORMAT controls the contents of the time output. The format string can be set using the -f or --format, -v or --verbose, or -p or --portability options. If they are not given, but the TIME environment variable is set, its value is used as the format string. Otherwise, a built-in default format is used.

The default format is:

%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps

The format string usually consists of resource specifiers interspersed with plain text. A percent sign (%) in the format string causes the following character to be interpreted as a resource specifier, which is similar to the formatting characters in the printf(3) function.

A backslash (\) introduces a backslash escape, which is translated into a single printing character upon output. \t outputs a tab character, \n outputs a newline, and \\ outputs a backslash. A backslash followed by any other character outputs a question mark (?) followed by a backslash, to indicate that an invalid backslash escape was given.

Other text in the format string is copied verbatim to the output. time always prints a newline after printing the resource use information, so normally format strings do not end with a newline character (or 0).

There are many resource specifications. Not all resources are measured by all versions of UNIX, so some of the values might be reported as zero. Any character following a percent sign that is not listed in the table below causes a question mark (`?') to be output, followed by that character, to indicate that an invalid resource listed in the table below causes a question mark (`?') to be output, followed by that character, to indicate that an invalid resource specifier was given.

The resource specifiers, which are a superset of those recognized by the tcsh(1) builtin `time' command, are:

%

literal `%'.

C

name and command line arguments of the command being timed.

D

average size of the processs unshared data area, in units of 1024 bytes.

E

elapsed real (wall clock) time used by the process, in [hours:]minutes:seconds.

F

number of major, or I/O-requiring, page faults that occurred while the process was running. These are faults where the page has actually migrated out of primary memory.

I

number of file system inputs by the process.

K

average total (data+stack+text) memory use of the process, in units of 1024 bytes.

M

maximum resident set size of the process during its lifetime, in units of 1024 bytes.

O

number of file system outputs by the process.

P

percentage of the CPU that this job got. This is just user + system times divided by the total running time.

R

number of minor, or recoverable, page faults. These are pages that are not valid (so they fault) but which have not yet been claimed by other virtual pages. Thus the data in the page is still valid but the system tables must be updated.

S

total number of CPU-seconds used by the system on behalf of the process (in kernel mode), in seconds.

U

total number of CPU-seconds that the process used directly (in user mode), in seconds.

W

number of times the process was swapped out of main memory.

X

average amount of shared text in the process, in units of 1024 bytes.

Z

system's page size, in bytes. This is a per-system constant, but varies between systems.

c

number of times the process was context-switched involuntarily (because the time slice expired).

e

elapsed real (wall clock) time used by the process, in seconds.

k

number of signals delivered to the process.

p

average unshared stack size of the process, in units of 1024 bytes.

r

number of socket messages received by the process.

s

number of socket messages sent by the process.

t

average resident set size of the process, in units of 1024 bytes.

w

number of times that the program was context-switched voluntarily, for instance while waiting for an I/O operation to complete.

x

exit status of the command.