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