summaryrefslogtreecommitdiff
path: root/usr/src/man/man3cpc/cpc_npic.3cpc
blob: 5d2a3605db5e20067a6ed6b3590cfa65d66525b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CPC_NPIC 3CPC "Oct 8, 2008"
.SH NAME
cpc_npic, cpc_caps, cpc_cciname, cpc_cpuref, cpc_walk_events_all,
cpc_walk_generic_events_all, cpc_walk_events_pic, cpc_walk_generic_events_pic,
cpc_walk_attrs \- determine CPU performance counter configuration
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lcpc\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <libcpc.h>

\fBuint_t\fR \fBcpc_npic\fR(\fBcpc_t *\fR\fIcpc\fR);
.fi

.LP
.nf
\fBuint_t\fR \fBcpc_caps\fR(\fBcpc_t *\fR\fIcpc\fR);
.fi

.LP
.nf
\fBconst char *\fR\fBcpc_cciname\fR(\fBcpc_t *\fR\fIcpc\fR);
.fi

.LP
.nf
\fBconst char *\fR\fBcpc_cpuref\fR(\fBcpc_t *\fR\fIcpc\fR);
.fi

.LP
.nf
\fBvoid\fR \fBcpc_walk_events_all\fR(\fBcpc_t *\fR\fIcpc\fR, \fBvoid *\fR\fIarg\fR,
     \fBvoid\fR (*\fIaction\fR)(\fBvoid *\fR\fIarg\fR, const char *\fIevent\fR));
.fi

.LP
.nf
\fBvoid\fR \fBcpc_walk_generic_events_all\fR(\fBcpc_t *\fR\fIcpc\fR, \fBvoid *\fR\fIarg\fR,
     \fBvoid\fR (*\fIaction\fR)(\fBvoid *\fR\fIarg\fR, \fBconst char *\fR\fIevent\fR));
.fi

.LP
.nf
\fBvoid\fR \fBcpc_walk_events_pic\fR(\fBcpc_t *\fR\fIcpc\fR, \fBuint_t\fR \fIpicno\fR, \fBvoid *\fR\fIarg\fR,
     \fBvoid\fR (*\fIaction\fR)(\fBvoid *\fR\fIarg\fR, uint_t \fIpicno\fR, const char *\fIevent\fR));
.fi

.LP
.nf
\fBvoid\fR \fBcpc_walk_generic_events_pic\fR(\fBcpc_t *\fR\fIcpc\fR, \fBuint_t\fR \fIpicno\fR,
     \fBvoid *\fR\fIarg\fR, \fBvoid\fR (*\fIaction\fR)(\fBvoid *\fR\fIarg\fR, \fBuint_t\fR \fIpicno\fR,
     \fBconst char *\fR\fIevent\fR));
.fi

.LP
.nf
\fBvoid\fR \fBcpc_walk_attrs\fR(\fBcpc_t *\fR\fIcpc\fR, \fBvoid *\fR\fIarg\fR,
     \fBvoid\fR (*\fIaction\fR)(\fBvoid *\fR\fIarg\fR, \fBconst char *\fR\fIattr\fR));
.fi

.SH DESCRIPTION
.sp
.LP
The \fBcpc_cciname()\fR function returns a printable description of the
processor performance counter interfaces, for example, the string UltraSPARC
III+ & IV. This name should not be assumed to be the same as the name the
manufacturer might otherwise ascribe to the processor. It simply names the
performance counter interfaces as understood by the system, and thus names the
set of performance counter events that can be described by that interface.
.sp
.LP
The \fBcpc_cpuref()\fR function returns a string that describes a reference
work that should be consulted to (allow a human to) understand the semantics of
the performance counter events that are known to the system. The string
returned might be substantially longer than 80 characters. Callers printing to
a terminal might want to insert line breaks as appropriate.
.sp
.LP
The \fBcpc_npic()\fR function returns the number of performance counters
accessible on the processor.
.sp
.LP
The \fBcpc_caps()\fR function returns a bitmap containing the bitwise
inclusive-OR of zero or more flags that describe the capabilities of the
processor. If \fBCPC_CAP_OVERFLOW_INTERRUPT\fR is present, the processor can
generate an interrupt when a hardware performance counter overflows. If
\fBCPC_CAP_OVERFLOW_PRECISE\fR is present, the processor can determine
precisely which counter overflowed, thereby affecting the behavior of the
overflow notification mechanism described in \fBcpc_bind_curlwp\fR(3CPC).
.sp
.LP
The system maintains a list of performance counter events supported by the
underlying processor. Some processors are able to count all events on all
hardware counters, while other processors restrict certain events to be counted
only on specific hardware counters. The system also maintains a list of
processor-specific attributes that can be used for advanced configuration of
the performance counter hardware. These functions allow applications to
determine what events and attributes are supported by the underlying processor.
The reference work pointed to by \fBcpc_cpuref()\fR should be consulted to
understand the reasons for and use of the attributes.
.sp
.LP
The \fBcpc_walk_events_all()\fR function calls the \fIaction\fR function on
each element of a global \fIevent\fR list. The \fIaction\fR function is called
with each event supported by the processor, regardless of which counter is
capable of counting it. The \fIaction\fR function is called only once for each
event, even if that event can be counted on more than one counter.
.sp
.LP
The \fBcpc_walk_events_pic()\fR function calls the action \fIfunction\fR with
each event supported by the counter indicated by the \fIpicno\fR argument,
where \fIpicno\fR ranges from 0 to the value returned by \fBcpc_npic()\fR.
.sp
.LP
The system maintains a list of platform independent performance counter events
known as generic events (see \fBgeneric_events\fR(3CPC)).
.sp
.LP
The \fBcpc_walk_generic_events_all()\fR function calls the action function on
each generic event available on the processor. The action function is called
for each generic event, regardless of which counter is capable of counting it.
The action function is called only once for each event, even if that event can
be counted on more than one counter.
.sp
.LP
The \fBcpc_walk_generic_events_pic()\fR function calls the action function with
each generic event supported by the counter indicated by the \fIpicno\fR
argument, where \fIpicno\fR ranges from 0 to the value returned by
\fBcpc_npic()\fR.
.sp
.LP
The system maintains a list of attributes that can be used to enable advanced
features of the performance counters on the underlying processor. The
\fBcpc_walk_attrs()\fR function calls the \fIaction\fR function for each
supported attribute name. See the reference material as returned by
\fBcpc_cpuref\fR(3CPC) for the semantics use of attributes.
.SH RETURN VALUES
.sp
.LP
The \fBcpc_cciname()\fR function always returns a printable description of the
processor performance counter interfaces.
.sp
.LP
The \fBcpc_cpuref()\fR function always returns a string that describes a
reference work.
.sp
.LP
The \fBcpc_npic()\fR function always returns the number of performance counters
accessible on the processor.
.sp
.LP
The \fBcpc_caps()\fR function always returns a bitmap containing the bitwise
inclusive-OR of zero or more flags that describe the capabilities of the
processor.
.sp
.LP
If the user-defined function specified by \fIaction\fR is not called, the
\fBcpc_walk_events_all()\fR, \fBcpc_walk_events_pic()\fR,
\fBcpc_walk_attrs()\fR, \fBcpc_walk_generic_events_pic()\fR, and
\fBcpc_walk_generic_events_pic()\fR functions set \fBerrno\fR to indicate the
error.
.SH ERRORS
.sp
.LP
The \fBcpc_walk_events_all()\fR, \fBcpc_walk_events_pic()\fR,
\fBcpc_walk_attrs()\fR, \fBcpc_walk_generic_events_pic()\fR, and
\fBcpc_walk_generic_events_pic()\fR functions will fail if:
.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
There is not enough memory available.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR cpc_bind_curlwp (3CPC),
.BR generic_events (3CPC),
.BR libcpc (3LIB),
.BR attributes (7)