1.\" $NetBSD: time.1,v 1.21 2010/05/16 07:40:53 dholland 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 May 16, 2010 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 clp 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 c 64Displays information in the format used by the 65.Nm 66builtin of 67.Xr csh 1 . 68.It Fl l 69Lists resource utilization information. 70The contents of the 71.Ar utility 72process' 73.Em rusage 74structure are printed; see below. 75.It Fl p 76The output is formatted as specified by 77.St -p1003.2-92 . 78.El 79.Pp 80Some shells, such as 81.Xr csh 1 82and 83.Xr ksh 1 , 84have their own and syntactically different builtin version of 85.Nm . 86The utility described here 87is available as 88.Pa /usr/bin/time 89to users of these shells. 90.Ss Resource Utilization 91If the 92.Fl l 93option is given, the following resource usage 94information is displayed 95in addition to the timing information: 96.Bl -item -offset indent -compact 97.It 98maximum resident set size 99.It 100average shared memory size 101.It 102average unshared data size 103.It 104average unshared stack size 105.It 106page reclaims 107.It 108page faults 109.It 110swaps 111.It 112block input operations 113.It 114block output operations 115.It 116messages sent 117.It 118messages received 119.It 120signals received 121.It 122voluntary context switches 123.It 124involuntary context switches 125.El 126Resource usage is the total for the execution of 127.Ar utility 128and any child processes it spawns, as per 129.Xr wait4 2 . 130.Sh EXIT STATUS 131The 132.Nm 133utility exits with one of the following values: 134.Bl -tag -width indent 135.It 1-125 136An error occurred in the 137.Nm 138utility. 139.It 126 140The 141.Ar utility 142was found but could not be invoked. 143.It 127 144The 145.Ar utility 146could not be found. 147.El 148.Pp 149Otherwise, the exit status of 150.Nm 151will be that of 152.Ar utility . 153.Sh FILES 154.Bl -tag -width \*[Lt]sys/resource.h\*[Gt] -compact 155.It \*[Lt]sys/resource.h\*[Gt] 156.El 157.Sh SEE ALSO 158.Xr csh 1 , 159.Xr ksh 1 , 160.Xr getrusage 2 161.Sh STANDARDS 162The 163.Nm 164utility conforms to 165.St -p1003.2-92 . 166.Sh BUGS 167The granularity of seconds on microprocessors is crude and 168can result in times being reported for CPU usage which are too large by 169a second. 170