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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
'\" te
.\" Copyright 1989 AT&T Copyright (c) 1999 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 BUSSTAT 1M "Nov 1, 1999"
.SH NAME
busstat \- report bus-related performance statistics
.SH SYNOPSIS
.LP
.nf
\fBbusstat\fR \fB-e\fR \fIdevice-inst\fR | \fB-h\fR | \fB-l\fR
.fi
.LP
.nf
\fBbusstat\fR [\fB-a\fR] [\fB-n\fR]
[\fB-w \fR \fIdevice-inst\fR [,pic0=\fIevent\fR,pic\fIn\fR=\fIevent\fR ]]...
[\fB-r\fR \fIdevice-inst\fR]... [\fIinterval \fR [\fIcount\fR]]
.fi
.SH DESCRIPTION
.sp
.LP
\fBbusstat\fR provides access to the bus-related performance counters in the
system. These performance counters allow for the measurement of statistics like
hardware clock cycles, bus statistics including \fBDMA\fR and cache coherency
transactions on a multiprocessor system. Each bus device that supports these
counters can be programmed to count a number of events from a specified list.
Each device supports one or more Performance Instrumentation Counters
(\fBPIC\fR) that are capable of counting events independently of each other.
.sp
.LP
Separate events can be selected for each \fBPIC\fR on each instance of these
devices. \fBbusstat\fR summarizes the counts over the last interval seconds,
repeating forever. If a count is given, the statistics are repeated count
times.
.sp
.LP
Only root users can program these counters. Non-root users have the option of
reading the counters that have been programmed by a root user.
.sp
.LP
The default value for the \fIinterval\fR argument is 1 second, and the default
\fIcount\fR is unlimited.
.sp
.LP
The devices that export these counters are highly platform-dependent and the
data may be difficult to interpret without an in-depth understanding of the
operation of the components that are being measured and of the system they
reside in.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.sp .6
.RS 4n
Display absolute counter values. The default is \fBdelta\fR values.
.RE
.sp
.ne 2
.na
\fB\fB-e\fR \fIdevice-inst\fR\fR
.ad
.sp .6
.RS 4n
Display the list of events that the specified device supports for each pic.
.sp
Specify \fIdevice-inst\fR as device (\fBname\fR) followed by an optional
instance number. If an instance number is specified, the events for that
instance are displayed. If no instance number is specified, the events for the
first instance of the specified device are displayed.
.RE
.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.sp .6
.RS 4n
Print a usage message.
.RE
.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.sp .6
.RS 4n
List the devices in the system which support performance counters.
.RE
.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.sp .6
.RS 4n
Do not display a title in the output. The default is to display titles.
.RE
.sp
.ne 2
.na
\fB\fB-r\fR \fIdevice-inst\fR\fR
.ad
.sp .6
.RS 4n
Read and display all \fBpic\fR values for the specified device
.sp
Specify \fIdevice-inst\fR as \fIdevice\fR (\fBname\fR) followed by \fIinstance
number\fR, if specifying an instance number of a device whose counters are to
be read and displayed. If all instances of this device are to be read, use
\fIdevice\fR (\fBname\fR) without an instance number. All \fBpic\fR values will
be sampled when using the \fB-r\fR option.
.RE
.sp
.ne 2
.na
\fB\fB-w\fR \fIdevice-inst\fR [,pic0=\fIevent\fR] [,pic\fIn\fR=\fIevent\fR] \fR
.ad
.sp .6
.RS 4n
Program (write) the specified devices to count the specified events. Write
access to the counters is restricted to root users only. Non-root users can use
\fB-r\fR option.
.sp
Specify \fIdevice-inst\fR as \fIdevice\fR (\fBname\fR) followed by an optional
\fIinstance number\fR. If specifying an instance number of a device to program
these events on. If all instances of this device are to be programmed the same,
then use \fIdevice\fR without an instance number. Specify an event to be
counted for a specified \fBpic\fR by providing a comma separated list of
\fBpic\fIn\fR=\fR\fIevent\fR values.
.sp
The \fB-e\fR option displays all valid event names for each device. Any devices
that are programmed will be sampled every interval seconds and repeated count
times. It is recommended that the interval specified is small enough to ensure
that counter wraparound will be detected. The rate at which counters
wraparound varies from device to device. If a user is programming events using
the \fB-w\fR option and \fBbusstat\fR detects that another user has changed the
events that are being counted, the tool will terminate as the programmed
devices are now being controlled by another user. Only one user can be
programming a device instance at any one time. Extra devices can be sampled
using the \fB-r\fR option. Using multiple instances of the \fB-w\fR option on
the same command line, with the same \fIdevice-inst\fR specifying a different
list of events for the \fBpic\fRs will give the effect of multiplexing for that
device. \fBbusstat\fR will switch between the list of events for that device
every interval seconds. Event can be a string representing the event name, or
even a number representing the bit pattern to be programmed into the
Performance Control Register (\fBPCR\fR). This assumes explicit knowledge of
the meaning of the control register bits for a device. The number can be
specified in hexadecimal, decimal, or octal, using the usual conventions of
\fBstrtol\fR(3C).
.RE
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB0\fR
.ad
.RS 5n
Successful completion.
.RE
.sp
.ne 2
.na
\fB1\fR
.ad
.RS 5n
An error occurred.
.RE
.sp
.ne 2
.na
\fB2\fR
.ad
.RS 5n
Another user is writing to the same devices.
.RE
.SH EXAMPLES
.SS "SPARC Only"
.LP
\fBExample 1 \fRProgramming and monitoring the Address Controller counters
.sp
.LP
In this example, \fBac0\fR refers to the Address Controller instance 0. The
counters are programmed to count Memory Bank stalls on an Ultra Enterprise
system at 10 second intervals with the values displayed in absolute form
instead of deltas.
.sp
.in +2
.nf
# busstat -a -w ac0,pic0=mem_bank0_stall,pic1=mem_bank1_stall 10
time dev event0 pic0 event1 pic1
10 ac0 mem_bank0_stall 1234 mem_bank1_stall 5678
20 ac0 mem_bank0_stall 5678 mem_bank1_stall 12345
30 ac0 mem_bank0_stall 12345 mem_bank1_stall 56789
\&...
.fi
.in -2
.sp
.sp
.LP
For a complete list of the supported events for a device, use the \fB-e\fR
option.
.LP
\fBExample 2 \fRProgramming and monitoring the counters on all instances of the
Address Controller
.sp
.LP
In this example, \fBac\fR refers to all \fBac\fR instances. This example
programs all instances of the Address Controller counters to \fBcount_clock\fR
cycles and \fBmem_bank0_rds\fR at 2 second intervals, 100 times, displaying the
values as deltas.
.sp
.in +2
.nf
# busstat -w ac,pic0=clock_cycles,pic1=mem_bank0_rds 2 100
time dev event0 pic0 event1 pic1
2 ac0 clock_cycles 167242902 mem_bank0_rds 3144
2 ac1 clock_cycles 167254476 mem_bank0_rds 1392
4 ac0 clock_cycles 168025190 mem_bank0_rds 40302
4 ac1 clock_cycles 168024056 mem_bank0_rds 40580
\&...
.fi
.in -2
.sp
.LP
\fBExample 3 \fRMonitoring the events being counted
.sp
.LP
This example monitors the events that are being counted on the sbus1 device,
100 times at 1 second intervals. It suggests that a root user has changed the
events that \fBsbus1\fR was counting to be \fBdvma_tlb_misses\fR and interrupts
instead of \fBpio_cycles\fR.
.sp
.in +2
.nf
% busstat -r sbus0 1 100
time dev event0 pic0 event1 pic1
1 sbus1 pio_cycles 2321 pio_cycles 2321
2 sbus1 pio_cycles 48 pio_cycles 48
3 sbus1 pio_cycles 49 pio_cycles 49
4 sbus1 pio_cycles 2281 pio_cycles 2281
5 sbus1 dvma_tlb_misses 0 interrupts 0
6 sbus1 dvma_tlb_misses 6 interrupts 2
7 sbus1 dvma_tlb_misses 8 interrupts 11
\&...
.fi
.in -2
.sp
.LP
\fBExample 4 \fREvent Multiplexing
.sp
.LP
This example programs \fBac0\fR to alternate between counting (clock cycles,
\fBmem_bank0_rds\fR) and (\fBaddr_pkts\fR, \fBdata_pkts\fR) at 2 second
intervals while also monitoring what \fBac1\fR is counting :
.sp
.LP
It shows the expected output of the above \fBbusstat\fR command. Another root
user on the machine has changed the events that this user had programmed and
\fBbusstat\fR has detected this and terminates the command with a message.
.sp
.in +2
.nf
# busstat -w ac0,pic0=clock_cycles,pic1=mem_bank0_rds \e
-w ac0,pic0=addr_pkts,pic1=data_pkts \e
-r ac1 2
time dev event0 pic0 event1 pic1
2 ac0 addr_pkts 12866 data_pkts 17015
2 ac1 rio_pkts 385 rio_pkts 385
4 ac0 clock_cycles 168018914 mem_bank0_rds 2865
4 ac1 rio_pkts 506 rio_pkts 506
6 ac0 addr_pkts 144236 data_pkts 149223
6 ac1 rio_pkts 522 rio_pkts 522
8 ac0 clock_cycles 168021245 mem_bank0_rds 2564
8 ac1 rio_pkts 387 rio_pkts 387
10 ac0 addr_pkts 144292 data_pkts 159645
10 ac1 rio_pkts 506 rio_pkts 506
12 ac0 clock_cycles 168020364 mem_bank0_rds 2665
12 ac1 rio_pkts 522 rio_pkts 522
busstat: events changed (possibly by another busstat).
#
.fi
.in -2
.sp
.SH SEE ALSO
.sp
.LP
\fBiostat\fR(1M), \fBmpstat\fR(1M), \fBvmstat\fR(1M), \fBstrtol\fR(3C),
\fBattributes\fR(5)
|