time (Unix)
time
is a command on Unix operating systems. It is used to measure the execution time of a certain other command. To use it, the word is time
simply placed in front of the command to be measured. An example is:
time ls
If the command was executed, shows time
how long the execution took in terms of CPU time, system CPU time and real time. The output format differs with different versions of the program. Some generate additional statistics as in the following example.
$ time host wikipedia.org wikipedia.org has address 207.142.131.235 0.000u 0.000s 0:00.17 0.0% 0+0k 0+0io 0pf+0w
time (1) can be implemented as a program (e.g. GNU time) or in a shell (e.g. in tcsh or zsh ).
Working method
According to the source code of the GNU implementation of time
, the data is collected using the system call wait3
. The system call is times
used on systems on which this is not available .
Web links
-
time
: time a simple command - Open Group Base Specification -
times()
: get process and waited-for child process times - Open Group Base Specification -
time(1)
: run programs and summarize system resource usage - Debian GNU / Linux Executable programs or shell commands manual page -
time(2)
: Get time in seconds (the Unix time ) - Debian GNU / Linux system calls manual page -
time(1)
: time command execution - OpenBSD General Commands Manual -
times(3)
: process times - OpenBSD Library Functions Manual
- replaced by
getrusage(2)
andgettimeofday(2)