time (Unix)

from Wikipedia, the free encyclopedia

timeis 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 timesimply placed in front of the command to be measured. An example is:

time ls

If the command was executed, shows timehow 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 timesused on systems on which this is not available .

Web links

replaced by getrusage(2)andgettimeofday(2)