xref: /freebsd/share/man/man9/microuptime.9 (revision 4f8f43b06ed07e96a250855488cc531799d5b78f)
1.\" Copyright (c) 2000 Kelly Yancey
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd February 21, 2015
26.Dt MICROUPTIME 9
27.Os
28.Sh NAME
29.Nm binuptime ,
30.Nm getbinuptime ,
31.Nm microuptime ,
32.Nm getmicrouptime ,
33.Nm nanouptime ,
34.Nm getnanouptime ,
35.Nm sbinuptime ,
36.Nm getsbinuptime
37.Nd get the time elapsed since boot
38.Sh SYNOPSIS
39.In sys/time.h
40.Ft void
41.Fn binuptime "struct bintime *bt"
42.Ft void
43.Fn getbinuptime "struct bintime *bt"
44.Ft void
45.Fn microuptime "struct timeval *tv"
46.Ft void
47.Fn getmicrouptime "struct timeval *tv"
48.Ft void
49.Fn nanouptime "struct timespec *ts"
50.Ft void
51.Fn getnanouptime "struct timespec *tsp"
52.Ft sbintime_t
53.Fn sbinuptime "void"
54.Ft sbintime_t
55.Fn getsbinuptime "void"
56.Sh DESCRIPTION
57The
58.Fn binuptime
59and
60.Fn getbinuptime
61functions store the time elapsed since boot as a
62.Vt "struct bintime"
63at the address specified by
64.Fa bt .
65The
66.Fn microuptime
67and
68.Fn getmicrouptime
69functions perform the same utility, but record the elapsed time as a
70.Vt "struct timeval"
71instead.
72Similarly the
73.Fn nanouptime
74and
75.Fn getnanouptime
76functions store the elapsed time as a
77.Vt "struct timespec" .
78The
79.Fn sbinuptime
80and
81.Fn getsbinuptime
82functions return the time elapsed since boot as a
83.Vt "sbintime_t" .
84.Pp
85The
86.Fn binuptime ,
87.Fn microuptime ,
88.Fn nanouptime ,
89and
90.Fn sbinuptime
91functions
92always query the timecounter to return the current time as precisely as
93possible.
94Whereas
95.Fn getbinuptime ,
96.Fn getmicrouptime ,
97.Fn getnanouptime ,
98and
99.Fn getsbinuptime
100functions are abstractions which return a less precise, but
101faster to obtain, time.
102.Pp
103The intent of the
104.Fn getbinuptime ,
105.Fn getmicrouptime ,
106.Fn getnanouptime ,
107and
108.Fn getsbinuptime
109functions is to enforce the user's preference for timer accuracy versus
110execution time.
111.Sh SEE ALSO
112.Xr bintime 9 ,
113.Xr get_cyclecount 9 ,
114.Xr getbintime 9 ,
115.Xr getmicrotime 9 ,
116.Xr getnanotime 9 ,
117.Xr microtime 9 ,
118.Xr nanotime 9 ,
119.Xr tvtohz 9
120.Sh AUTHORS
121This manual page was written by
122.An Kelly Yancey Aq Mt kbyanc@posi.net .
123