xref: /freebsd/share/man/man9/get_cyclecount.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
158550067SMark Murray.\" Copyright (c) 2000 Mark R V Murray
258550067SMark Murray.\" All rights reserved.
358550067SMark Murray.\"
458550067SMark Murray.\" Redistribution and use in source and binary forms, with or without
558550067SMark Murray.\" modification, are permitted provided that the following conditions
658550067SMark Murray.\" are met:
758550067SMark Murray.\" 1. Redistributions of source code must retain the above copyright
858550067SMark Murray.\"    notice, this list of conditions and the following disclaimer.
958550067SMark Murray.\" 2. Redistributions in binary form must reproduce the above copyright
1058550067SMark Murray.\"    notice, this list of conditions and the following disclaimer in the
1158550067SMark Murray.\"    documentation and/or other materials provided with the distribution.
1258550067SMark Murray.\"
1358550067SMark Murray.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1458550067SMark Murray.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1558550067SMark Murray.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1658550067SMark Murray.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1758550067SMark Murray.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1858550067SMark Murray.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1958550067SMark Murray.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2058550067SMark Murray.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2158550067SMark Murray.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2258550067SMark Murray.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2358550067SMark Murray.\" SUCH DAMAGE.
2458550067SMark Murray.\"
25d8ea2a49SJung-uk Kim.Dd March 15, 2011
2652f1d68fSRuslan Ermilov.Dt GET_CYCLECOUNT 9
2758550067SMark Murray.Os
2858550067SMark Murray.Sh NAME
2923257a00SChad David.Nm get_cyclecount
3058550067SMark Murray.Nd get the CPU's fast counter register contents
3158550067SMark Murray.Sh SYNOPSIS
3232eef9aeSRuslan Ermilov.In sys/param.h
337d6ad52aSMark Murray.In sys/systm.h
3432eef9aeSRuslan Ermilov.In machine/cpu.h
356b99842aSEd Schouten.Ft uint64_t
3623257a00SChad David.Fn get_cyclecount "void"
3758550067SMark Murray.Sh DESCRIPTION
3858550067SMark MurrayThe
3923257a00SChad David.Fn get_cyclecount
4052f1d68fSRuslan Ermilovfunction uses a register
4158550067SMark Murrayavailable in most modern CPUs
4258550067SMark Murrayto return a value
4358550067SMark Murraythat is monotonically increasing
4458550067SMark Murrayinside each CPU.
4558550067SMark Murray.Pp
4652f1d68fSRuslan ErmilovOn SMP systems,
4758550067SMark Murraythere will be a number of
4858550067SMark Murrayseparate monotonic sequences,
4958550067SMark Murrayone for each CPU running.
5058550067SMark MurrayThe value in the SMP case is
5158550067SMark Murrayselected from one of these sequences,
5258550067SMark Murraydependent on which CPU
5358550067SMark Murraywas scheduled to service the request.
5458550067SMark Murray.Pp
5552f1d68fSRuslan ErmilovThe speed and the maximum value
5658550067SMark Murrayof each counter
57e986850fSJens Schweikhardtis CPU-dependent.
5858550067SMark MurraySome CPUs
5958550067SMark Murray(such as the
6058550067SMark Murray.Tn Intel
611f25113fSJohn Baldwin80486)
6258550067SMark Murraydo not have such a register,
6358550067SMark Murrayso
6423257a00SChad David.Fn get_cyclecount
6558550067SMark Murrayon these platforms
66d8ea2a49SJung-uk Kimreturns a (monotonic) combination of numbers
6758550067SMark Murrayrepresented by the
6858550067SMark Murraystructure returned by
6995894120SRuslan Ermilov.Xr binuptime 9 .
7058550067SMark Murray.Pp
7158550067SMark MurrayThe
72c26c3874SJung-uk Kim.Tn AMD64
73c26c3874SJung-uk Kimand
74c26c3874SJung-uk Kim.Tn Intel 64
75d8ea2a49SJung-uk Kimprocessors use the
7658550067SMark Murray.Li TSC
7758550067SMark Murrayregister.
7858550067SMark Murray.Sh SEE ALSO
7995894120SRuslan Ermilov.Xr binuptime 9
8058550067SMark Murray.Sh HISTORY
8158550067SMark MurrayThe
8223257a00SChad David.Fn get_cyclecount
8358550067SMark Murrayfunction first appeared in
84ae9fd628SRuslan Ermilov.Fx 5.0 .
8558550067SMark Murray.Sh AUTHORS
8658550067SMark MurrayThis manual page was written by
87*8a7314fcSBaptiste Daroussin.An Mark Murray Aq Mt markm@FreeBSD.org .
88