|
NAMEtime —
time command execution
SYNOPSIS
DESCRIPTIONThetime utility executes and times the specified
utility. After the utility
finishes, time writes to the standard error stream,
(in seconds): the total time elapsed, the time used to execute the
utility process and the time consumed by system
overhead.
The following options are available:
Some shells may provide a builtin If ENVIRONMENTThePATH environment variable is used to locate the
requested utility if the name contains no
‘/ ’ characters.
EXIT STATUSIf utility could be timed successfully, its exit status is returned. If utility terminated abnormally, a warning message is output to stderr. If the utility was found but could not be run, the exit status is 126. If no utility could be found at all, the exit status is 127. Iftime encounters any other error, the exit status is
between 1 and 125 included.
EXAMPLESTime the execution of ls(1) on an empty directory:$ /usr/bin/time ls 0.00 real 0.00 user 0.00 sys Time the execution of the cp(1) command and store the result in the times.txt file. Then execute the command again to make a new copy and add the result to the same file: $ /usr/bin/time -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy1.iso $ /usr/bin/time -a -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy2.iso The times.txt file will contain the times of both commands: $ cat times.txt 0.68 real 0.00 user 0.22 sys 0.67 real 0.00 user 0.21 sys Time the sleep(1) command and show the results in a human friendly format. Show the contents of the rusage structure too: $ /usr/bin/time -l -h -p sleep 5 real 5.01 user 0.00 sys 0.00 0 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 80 page reclaims 0 page faults 0 swaps 1 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 3 voluntary context switches 0 involuntary context switches SEE ALSObuiltin(1), csh(1), getrusage(2), wait(2)STANDARDSThetime utility is expected to conform to ISO/IEC
9945-2:1993 (``POSIX'').
HISTORYAtime utility appeared in
Version 3 AT&T UNIX.
Visit the GSP FreeBSD Man Page Interface. |