- Time (Unix)
timeis a command in the
Unixoperating systems. It is used to determine the duration of execution of a particular command.
To use the command, simply precede any command by the word
time, such as:
When the command completes,
timewill report how long it took to execute the
ls CPU time, system CPU time, and real time. The output format varies between different versions of the command, and some give additional statistics, as in this example:
$ time host wikipedia.org wikipedia.org has address 18.104.22.168 0.000u 0.000s 0:00.17 0.0% 0+0k 0+0io 0pf+0w $
time(1) can exist as a standalone program (such as
GNUtime) or as a shell builtin (e.g. in tcshor in zsh).
User Time vs System Time
The term 'user CPU time' can be a bit misleading at first. To be clear the total time ("real CPU time"), is the combination of the amount of time the CPU spends performing some action for a program and the amount of time the CPU spends performing
system calls for the kernel on the program's behalf. When a program loops through an array, it is accumulating user CPU time. Conversely, when a program executes a system callsuch as
fork, it is accumulating system CPU time.
Method of operation
According to the source code of the GNU implementation of
time, most information shown by
timeis derived from the
wait3system call. On systems that do not have a
wait3call that returns status information, the
timessystem call is used instead.
List of Unix programs
Cronprocess for scheduling jobs to run at a particular time.
*man|cu|time|SUS|time a simple command
*man|1|time|Linux|time a simple command or give resource usage
Wikimedia Foundation. 2010.