Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/time/time.1
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
was found but could not be run, the exit status is 126. | was found but could not be run, the exit status is 126. | ||||
If no | If no | ||||
.Ar utility | .Ar utility | ||||
could be found at all, the exit status is 127. | could be found at all, the exit status is 127. | ||||
If | If | ||||
.Nm | .Nm | ||||
encounters any other error, the exit status is between 1 and 125 | encounters any other error, the exit status is between 1 and 125 | ||||
included. | included. | ||||
.Sh EXAMPLES | |||||
Time the execution of | |||||
.Xr ls 1 | |||||
on an empty directory: | |||||
.Bd -literal -offset indent | |||||
$ /usr/bin/time ls | |||||
bcr: You're using the shell built-in time here versus the one in /usr/bin/time below. Is that… | |||||
Done Inline ActionsArrrg. That was a mistake. Sorry. fernape: Arrrg. That was a mistake. Sorry. | |||||
0.00 real 0.00 user 0.00 sys | |||||
.Ed | |||||
.Pp | |||||
Time the execution of the | |||||
.Xr cp 1 | |||||
command and store the result in the | |||||
.Pa times.txt | |||||
file. | |||||
Then execute the command again to make a new copy and add the result to the same | |||||
file: | |||||
.Bd -literal -offset indent | |||||
$ /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 | |||||
.Ed | |||||
Done Inline ActionsMaybe we can find a different example that does not give 0 as result in both cases. bcr: Maybe we can find a different example that does not give 0 as result in both cases.
How about a… | |||||
Done Inline ActionsI don't get a big difference, maybe because the bootonly iso is not so big, but I think it is clearer now. Thanks! fernape: I don't get a big difference, maybe because the bootonly iso is not so big, but I think it is… | |||||
.Pp | |||||
The | |||||
.Pa times.txt | |||||
file will contain the times of both commands: | |||||
.Bd -literal -offset indent | |||||
$ cat times.txt | |||||
0.68 real 0.00 user 0.22 sys | |||||
0.67 real 0.00 user 0.21 sys | |||||
.Ed | |||||
.Pp | |||||
Time the | |||||
.Xr sleep 1 | |||||
command and show the results in a human friendly format. | |||||
Show the contents of the | |||||
.Em rusage | |||||
structure too: | |||||
.Bd -literal -offset indent | |||||
$ /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 | |||||
.Ed | |||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr builtin 1 , | .Xr builtin 1 , | ||||
.Xr csh 1 , | .Xr csh 1 , | ||||
.Xr getrusage 2 , | .Xr getrusage 2 , | ||||
.Xr wait 2 | .Xr wait 2 | ||||
.Sh STANDARDS | .Sh STANDARDS | ||||
The | The | ||||
.Nm | .Nm | ||||
utility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX''). | utility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX''). | ||||
.Sh HISTORY | .Sh HISTORY | ||||
A | A | ||||
.Nm | .Nm | ||||
utility appeared in | utility appeared in | ||||
.At v3 . | .At v3 . |
You're using the shell built-in time here versus the one in /usr/bin/time below. Is that intended?