1.\" $NetBSD: time.1,v 1.18 2003/08/07 11:16:15 agc Exp $ 2.\" 3.\" Copyright (c) 1980, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)time.1 8.1 (Berkeley) 6/6/93 31.\" 32.Dd June 6, 1993 33.Dt TIME 1 34.Os 35.Sh NAME 36.Nm time 37.Nd time command execution 38.Sh SYNOPSIS 39.Nm 40.Op Fl lp 41.Ar utility 42.Op Ar argument ... 43.Sh DESCRIPTION 44The 45.Nm 46utility 47executes and 48times 49.Ar utility . 50After the 51.Ar utility 52finishes, 53.Nm 54writes the total time elapsed, 55the time consumed by system overhead, 56and the time used to execute 57.Ar utility 58to the standard error stream. 59Times are reported in seconds. 60.Pp 61Available options: 62.Bl -tag -width Ds 63.It Fl l 64Lists resource utilization information. 65The contents of the 66.Ar utility 67process' 68.Em rusage 69structure are printed, see below. 70.It Fl p 71The output is formatted as specified by 72.St -p1003.2-92 . 73.El 74.Pp 75Some shells, such as 76.Xr csh 1 77and 78.Xr ksh 1 , 79have their own and syntactically different builtin version of 80.Nm . 81The utility described here 82is available as 83.Pa /usr/bin/time 84to users of these shells. 85.Ss Resource Utilization 86If the 87.Fl l 88option is given, the following resource usage 89informations are displayed 90in addition to the timing information: 91.Bl -item -offset indent -compact 92.It 93maximum resident set size 94.It 95average shared memory size 96.It 97average unshared data size 98.It 99average unshared stack size 100.It 101page reclaims 102.It 103page faults 104.It 105swaps 106.It 107block input operations 108.It 109block output operations 110.It 111messages sent 112.It 113messages received 114.It 115signals received 116.It 117voluntary context switches 118.It 119involuntary context switches 120.El 121.Sh EXIT STATUS 122The 123.Nm 124utility exits with one of the following values: 125.Bl -tag -width indent 126.It 1-125 127An error occurred in the 128.Nm 129utility. 130.It 126 131The 132.Ar utility 133was found but could not be invoked. 134.It 127 135The 136.Ar utility 137could not be found. 138.El 139.Pp 140Otherwise, the exit status of 141.Nm 142will be that of 143.Ar utility . 144.Sh FILES 145.Bl -tag -width \*[Lt]sys/resource.h\*[Gt] -compact 146.It \*[Lt]sys/resource.h\*[Gt] 147.El 148.Sh SEE ALSO 149.Xr csh 1 , 150.Xr ksh 1 , 151.Xr getrusage 2 152.Sh STANDARDS 153The 154.Nm 155utility conforms to 156.St -p1003.2-92 . 157.Sh BUGS 158The granularity of seconds on microprocessors is crude and 159can result in times being reported for CPU usage which are too large by 160a second. 161