xref: /freebsd/share/man/man9/microuptime.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1ae5ccfadSAlexey Zelkin.\" Copyright (c) 2000 Kelly Yancey
2ae5ccfadSAlexey Zelkin.\" All rights reserved.
3ae5ccfadSAlexey Zelkin.\"
4ae5ccfadSAlexey Zelkin.\" Redistribution and use in source and binary forms, with or without
5ae5ccfadSAlexey Zelkin.\" modification, are permitted provided that the following conditions
6ae5ccfadSAlexey Zelkin.\" are met:
7ae5ccfadSAlexey Zelkin.\" 1. Redistributions of source code must retain the above copyright
8ae5ccfadSAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer.
9ae5ccfadSAlexey Zelkin.\" 2. Redistributions in binary form must reproduce the above copyright
10ae5ccfadSAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer in the
11ae5ccfadSAlexey Zelkin.\"    documentation and/or other materials provided with the distribution.
12ae5ccfadSAlexey Zelkin.\"
13ae5ccfadSAlexey Zelkin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14ae5ccfadSAlexey Zelkin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15ae5ccfadSAlexey Zelkin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16ae5ccfadSAlexey Zelkin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17ae5ccfadSAlexey Zelkin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18ae5ccfadSAlexey Zelkin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19ae5ccfadSAlexey Zelkin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20ae5ccfadSAlexey Zelkin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21ae5ccfadSAlexey Zelkin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22ae5ccfadSAlexey Zelkin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23ae5ccfadSAlexey Zelkin.\" SUCH DAMAGE.
24ae5ccfadSAlexey Zelkin.\"
25*c06167fbSJohn-Mark Gurney.Dd February 21, 2015
26ae5ccfadSAlexey Zelkin.Dt MICROUPTIME 9
273d45e180SRuslan Ermilov.Os
28ae5ccfadSAlexey Zelkin.Sh NAME
2935779bdbSBrooks Davis.Nm binuptime ,
3035779bdbSBrooks Davis.Nm getbinuptime ,
31ae5ccfadSAlexey Zelkin.Nm microuptime ,
32ae5ccfadSAlexey Zelkin.Nm getmicrouptime ,
33ae5ccfadSAlexey Zelkin.Nm nanouptime ,
34f1bd6606SBrooks Davis.Nm getnanouptime ,
35f1bd6606SBrooks Davis.Nm sbinuptime ,
36f1bd6606SBrooks Davis.Nm getsbinuptime
37ae5ccfadSAlexey Zelkin.Nd get the time elapsed since boot
38ae5ccfadSAlexey Zelkin.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/time.h
40ae5ccfadSAlexey Zelkin.Ft void
4135779bdbSBrooks Davis.Fn binuptime "struct bintime *bt"
4235779bdbSBrooks Davis.Ft void
4335779bdbSBrooks Davis.Fn getbinuptime "struct bintime *bt"
4435779bdbSBrooks Davis.Ft void
45ae5ccfadSAlexey Zelkin.Fn microuptime "struct timeval *tv"
46ae5ccfadSAlexey Zelkin.Ft void
47ae5ccfadSAlexey Zelkin.Fn getmicrouptime "struct timeval *tv"
48ae5ccfadSAlexey Zelkin.Ft void
49ae5ccfadSAlexey Zelkin.Fn nanouptime "struct timespec *ts"
50ae5ccfadSAlexey Zelkin.Ft void
51ae5ccfadSAlexey Zelkin.Fn getnanouptime "struct timespec *tsp"
52f1bd6606SBrooks Davis.Ft sbintime_t
53f1bd6606SBrooks Davis.Fn sbinuptime "void"
54f1bd6606SBrooks Davis.Ft sbintime_t
55f1bd6606SBrooks Davis.Fn getsbinuptime "void"
56ae5ccfadSAlexey Zelkin.Sh DESCRIPTION
57ae5ccfadSAlexey ZelkinThe
5835779bdbSBrooks Davis.Fn binuptime
5935779bdbSBrooks Davisand
6035779bdbSBrooks Davis.Fn getbinuptime
6135779bdbSBrooks Davisfunctions store the time elapsed since boot as a
62c0854fb7SRuslan Ermilov.Vt "struct bintime"
6335779bdbSBrooks Davisat the address specified by
6435779bdbSBrooks Davis.Fa bt .
6535779bdbSBrooks DavisThe
66ae5ccfadSAlexey Zelkin.Fn microuptime
67ae5ccfadSAlexey Zelkinand
68ae5ccfadSAlexey Zelkin.Fn getmicrouptime
6935779bdbSBrooks Davisfunctions perform the same utility, but record the elapsed time as a
70c0854fb7SRuslan Ermilov.Vt "struct timeval"
7135779bdbSBrooks Davisinstead.
7235779bdbSBrooks DavisSimilarly the
73ae5ccfadSAlexey Zelkin.Fn nanouptime
74ae5ccfadSAlexey Zelkinand
75ae5ccfadSAlexey Zelkin.Fn getnanouptime
7635779bdbSBrooks Davisfunctions store the elapsed time as a
77c0854fb7SRuslan Ermilov.Vt "struct timespec" .
78f1bd6606SBrooks DavisThe
79f1bd6606SBrooks Davis.Fn sbinuptime
80f1bd6606SBrooks Davisand
81f1bd6606SBrooks Davis.Fn getsbinuptime
82f1bd6606SBrooks Davisfunctions return the time elapsed since boot as a
83f1bd6606SBrooks Davis.Vt "sbintime_t" .
84ae5ccfadSAlexey Zelkin.Pp
85c0854fb7SRuslan ErmilovThe
86c0854fb7SRuslan Ermilov.Fn binuptime ,
8735779bdbSBrooks Davis.Fn microuptime ,
88f1bd6606SBrooks Davis.Fn nanouptime ,
89ae5ccfadSAlexey Zelkinand
90f1bd6606SBrooks Davis.Fn sbinuptime
91c0854fb7SRuslan Ermilovfunctions
92ae5ccfadSAlexey Zelkinalways query the timecounter to return the current time as precisely as
931111b49cSSheldon Hearnpossible.
941111b49cSSheldon HearnWhereas
9535779bdbSBrooks Davis.Fn getbinuptime ,
9635779bdbSBrooks Davis.Fn getmicrouptime ,
97f1bd6606SBrooks Davis.Fn getnanouptime ,
98ae5ccfadSAlexey Zelkinand
99f1bd6606SBrooks Davis.Fn getsbinuptime
10016aa79c2SMark Murrayfunctions are abstractions which return a less precise, but
1011111b49cSSheldon Hearnfaster to obtain, time.
102ae5ccfadSAlexey Zelkin.Pp
103ae5ccfadSAlexey ZelkinThe intent of the
10435779bdbSBrooks Davis.Fn getbinuptime ,
10535779bdbSBrooks Davis.Fn getmicrouptime ,
106f1bd6606SBrooks Davis.Fn getnanouptime ,
107ae5ccfadSAlexey Zelkinand
108f1bd6606SBrooks Davis.Fn getsbinuptime
109ae5ccfadSAlexey Zelkinfunctions is to enforce the user's preference for timer accuracy versus
110ae5ccfadSAlexey Zelkinexecution time.
111ae5ccfadSAlexey Zelkin.Sh SEE ALSO
11235779bdbSBrooks Davis.Xr bintime 9 ,
113*c06167fbSJohn-Mark Gurney.Xr get_cyclecount 9 ,
11435779bdbSBrooks Davis.Xr getbintime 9 ,
115ae5ccfadSAlexey Zelkin.Xr getmicrotime 9 ,
116ae5ccfadSAlexey Zelkin.Xr getnanotime 9 ,
117ae5ccfadSAlexey Zelkin.Xr microtime 9 ,
118ae5ccfadSAlexey Zelkin.Xr nanotime 9 ,
119ae5ccfadSAlexey Zelkin.Xr tvtohz 9
120ae5ccfadSAlexey Zelkin.Sh AUTHORS
121ae5ccfadSAlexey ZelkinThis manual page was written by
1228a7314fcSBaptiste Daroussin.An Kelly Yancey Aq Mt kbyanc@posi.net .
123