1 .\" $NetBSD: i386_pmc_info.2,v 1.10 2005/12/26 19:40:14 perry Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
31 .Dt I386_PMC_INFO 2 i386
35 .Nm i386_pmc_startstop ,
37 .Nd interface to CPU performance counters
43 .In machine/specialreg.h
45 .Fn i386_pmc_info "struct i386_pmc_info_args *ia"
47 .Fn i386_pmc_startstop "struct i386_pmc_startstop_args *ssa"
49 .Fn i386_pmc_read "struct i386_pmc_read_args *ra"
51 These functions provide an interface to the CPU performance counters
52 on the 586-class and 686-class processors.
55 will return information about the available CPU counters.
56 The information is returned in
58 having the following structure:
60 struct i386_pmc_info_args {
68 member describes the class of performance counters available.
71 .Bl -tag -offset indent -width PMC_INFO_HASTSC -compact
84 member describes additional capabilities of the processor.
87 .Bl -tag -offset indent -width PMC_INFO_HASTSC -compact
89 CPU has time-stamp counter
92 .Fn i386_pmc_startstop
93 is used to start and stop the measurement of the CPU performance counters.
96 has the following structure:
98 struct i386_pmc_startstop_args {
108 The counter specified by the member
110 is started if the member
112 has PMC_SETUP_KERNEL or PMC_SETUP_USER set, otherwise the counter is
114 The initial value of the counter is set to
116 Additional values for the
118 member are PMC_SETUP_EDGE and PMC_SETUP_INV.
121 member specifies some event written to the control register.
124 member specifies the measurement units.
127 member is a mask for the counter.
130 will return information about a specific CPU counter measured during
131 the last measurement period determined by the calling of
132 .Fn i386_pmc_startstop .
133 The information is returned in
135 having the following structure:
137 struct i386_pmc_read_args {
144 The counter to read should be specified by the
147 Counters are numbered from 0 to
149 The value of the counter is returned in the
152 The time since epoch, measured in CPU clock cycles, is returned in the
156 Upon successful completion zero is returned, otherwise \-1 is returned