]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - lib/libpmc/pmc.mips.3
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / lib / libpmc / pmc.mips.3
1 .\" Copyright (c) 2010 George Neville-Neil.  All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" This software is provided by ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed.  in no event shall George Neville-Neil be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
22 .\" such damage.
23 .\"
24 .\" $FreeBSD$
25 .\"
26 .Dd February 11, 2010
27 .Dt PMC.MIPS 3
28 .Os
29 .Sh NAME
30 .Nm pmc.mips
31 .Nd measurement events for
32 .Tn MIPS
33 family CPUs
34 .Sh LIBRARY
35 .Lb libpmc
36 .Sh SYNOPSIS
37 .In pmc.h
38 .Sh DESCRIPTION
39 MIPS PMCs are present in MIPS
40 .Tn "24k"
41 and other processors in the MIPS family.
42 .Pp
43 There are two counters supported by the hardware and each is 32 bits
44 wide.
45 .Pp
46 MIPS PMCs are documented in
47 .Rs
48 .%B "MIPS32 24K Processor Core Family Software User's Manual"
49 .%D December 2008
50 .%Q "MIPS Technologies Inc."
51 .Re
52 .Ss Event Specifiers (Programmable PMCs)
53 MIPS programmable PMCs support the following events:
54 .Bl -tag -width indent
55 .It Li CYCLE
56 .Pq Event 0, Counter 0/1
57 Total number of cycles. 
58 The performance counters are clocked by the
59 top-level gated clock. 
60 If the core is built with that clock gater
61 present, none of the counters will increment while the clock is
62 stopped - due to a WAIT instruction.
63 .It Li INSTR_EXECUTED
64 .Pq Event 1, Counter 0/1
65 Total number of instructions completed.
66 .It Li BRANCH_COMPLETED 
67 .Pq Event 2, Counter 0
68 Total number of branch instructions completed.
69 .It Li BRANCH_MISPRED
70 .Pq Event 2, Counter 1
71 Counts all branch instructions which completed, but were mispredicted.
72 .It Li RETURN
73 .Pq Event 3, Counter 0
74 Counts all JR R31 instructions completed.
75 .It Li RETURN_MISPRED
76 .Pq Event 3, Counter 1
77 Counts all JR $31 instructions which completed, used the RPS for a prediction, but were mispredicted.
78 .It Li RETURN_NOT_31
79 .Pq Event 4, Counter 0
80 Counts all JR $xx (not $31) and JALR instructions (indirect jumps).
81 .It Li RETURN_NOTPRED
82 .Pq Event 4, Counter 1
83 If RPS use is disabled, JR $31 will not be predicted.
84 .It Li ITLB_ACCESS
85 .Pq Event 5, Counter 0
86 Counts ITLB accesses that are due to fetches showing up in the
87 instruction fetch stage of the pipeline and which do not use a fixed
88 mapping or are not in unmapped space. 
89 If an address is fetched twice from the pipe (as in the case of a
90 cache miss), that instruction willcount as 2 ITLB accesses. 
91 Since each fetch gets us 2 instructions,there is one access marked per double
92 word.
93 .It Li ITLB_MISS
94 .Pq Event 5, Counter 1
95 Counts all misses in the ITLB except ones that are on the back of another
96 miss.
97 We cannot process back to back misses and thus those are
98 ignored.
99 They are also ignored if there is some form of address error.
100 .It Li DTLB_ACCESS
101 .Pq Event 6, Counter 0
102 Counts DTLB access including those in unmapped address spaces.
103 .It Li DTLB_MISS
104 .Pq Event 6, Counter 1
105 Counts DTLB misses. Back to back misses that result in only one DTLB
106 entry getting refilled are counted as a single miss.
107 .It Li JTLB_IACCESS
108 .Pq Event 7, Counter 0
109 Instruction JTLB accesses are counted exactly the same as ITLB misses.
110 .It Li JTLB_IMISS
111 .Pq Event 7, Counter 1
112 Counts instruction JTLB accesses that result in no match or a match on
113 an invalid translation.
114 .It Li JTLB_DACCESS
115 .Pq Event 8, Counter 0
116 Data JTLB accesses.
117 .It Li JTLB_DMISS
118 .Pq Event 8, Counter 1
119 Counts data JTLB accesses that result in no match or a match on an invalid translation.
120 .It Li IC_FETCH
121 .Pq Event 9, Counter 0
122 Counts every time the instruction cache is accessed. All replays,
123 wasted fetches etc. are counted.
124 For example, following a branch, even though the prediction is taken,
125 the fall through access is counted.
126 .It Li IC_MISS
127 .Pq Event 9, Counter 1
128 Counts all instruction cache misses that result in a bus request.
129 .It Li DC_LOADSTORE
130 .Pq Event 10, Counter 0
131 Counts cached loads and stores.
132 .It Li DC_WRITEBACK
133 .Pq Event 10, Counter 1
134 Counts cache lines written back to memory due to replacement or cacheops.
135 .It Li DC_MISS
136 .Pq Event 11,   Counter 0/1
137 Counts loads and stores that miss in the cache
138 .It Li LOAD_MISS
139 .Pq Event 13, Counter 0
140 Counts number of cacheable loads that miss in the cache.
141 .It Li STORE_MISS
142 .Pq Event 13, Counter 1
143 Counts number of cacheable stores that miss in the cache.
144 .It Li INTEGER_COMPLETED
145 .Pq Event 14, Counter 0
146 Non-floating point, non-Coprocessor 2 instructions.
147 .It Li FP_COMPLETED
148 .Pq Event 14, Counter 1
149 Floating point instructions completed.
150 .It Li LOAD_COMPLETED
151 .Pq Event 15, Counter 0
152 Integer and co-processor loads completed.
153 .It Li STORE_COMPLETED
154 .Pq Event 15, Counter 1
155 Integer and co-processor stores completed.
156 .It Li BARRIER_COMPLETED
157 .Pq Event 16, Counter 0
158 Direct jump (and link) instructions completed.
159 .It Li MIPS16_COMPLETED
160 .Pq Event 16, Counter 1
161 MIPS16c instructions completed.
162 .It Li NOP_COMPLETED
163 .Pq Event 17, Counter 0
164 NOPs completed.
165 This includes all instructions that normally write to a general
166 purpose register, but where the destination register was set to r0.
167 .It Li INTEGER_MULDIV_COMPLETED
168 .Pq Event 17, Counter 1
169 Integer multipy and divide instructions completed.  (MULxx, DIVx, MADDx, MSUBx).
170 .It Li RF_STALL
171 .Pq Event 18, Counter 0
172 Counts the total number of cycles where no instructions are issued
173 from the IFU to ALU (the RF stage does not advance) which includes
174 both of the previous two events.
175 The RT_STALL is different than the sum of them though because cycles
176 when both stalls are active will only be counted once.
177 .It Li INSTR_REFETCH
178 .Pq Event 18, Counter 1
179 replay traps (other than uTLB)
180 .It Li STORE_COND_COMPLETED
181 .Pq Event 19, Counter 0
182 Conditional stores completed.  Counts all events, including failed stores.
183 .It Li STORE_COND_FAILED
184 .Pq Event 19, Counter 1
185 Conditional store instruction that did not update memory.
186 Note: While this event and the SC instruction count event can be configured to
187 count in specific operating modes, the timing of the events is much
188 different and the observed operating mode could change between them,
189 causing some inaccuracy in the measured ratio.
190 .It Li ICACHE_REQUESTS
191 .Pq Event 20, Counter 0
192 Note that this only counts PREFs that are actually attempted. 
193 PREFs to uncached addresses or ones with translation errors are not counted
194 .It Li ICACHE_HIT
195 .Pq Event 20, Counter 1
196 Counts PREF instructions that hit in the cache
197 .It Li L2_WRITEBACK
198 .Pq Event 21, Counter 0
199 Counts cache lines written back to memory due to replacement or cacheops.
200 .It Li L2_ACCESS
201 .Pq Event 21, Counter 1
202 Number of accesses to L2 Cache.
203 .It Li L2_MISS
204 .Pq Event 22, Counter 0
205 Number of accesses that missed in the L2 cache.
206 .It Li L2_ERR_CORRECTED
207 .Pq Event 22, Counter 1
208 Single bit errors in L2 Cache that were detected and corrected.
209 .It Li EXCEPTIONS
210 .Pq Event 23, Counter 0
211 Any type of exception taken.
212 .It Li RF_CYCLES_STALLED
213 .Pq Event 24, Counter 0
214 Counts cycles where the LSU is in fixup and cannot accept a new
215 instruction from the ALU.
216 Fixups are replays within the LSU that occur when an instruction needs
217 to re-access the cache or the DTLB. 
218 .It Li IFU_CYCLES_STALLED
219 .Pq Event 25, Counter 0
220 Counts the number of cycles where the fetch unit is not providing a
221 valid instruction to the ALU.
222 .It Li ALU_CYCLES_STALLED
223 .Pq Event 25, Counter 1
224 Counts the number of cycles where the ALU pipeline cannot advance.
225 .It Li UNCACHED_LOAD
226 .Pq Event 33, Counter 0
227 Counts uncached and uncached accelerated loads.
228 .It Li UNCACHED_STORE
229 .Pq Event 33, Counter 1
230 Counts uncached and uncached accelerated stores.
231 .It Li CP2_REG_TO_REG_COMPLETED
232 .Pq Event 35, Counter 0
233 Co-processor 2 register to register instructions completed.
234 .It Li MFTC_COMPLETED
235 .Pq Event 35, Counter 1
236 Co-processor 2 move to and from instructions as well as loads and stores.
237 .It Li IC_BLOCKED_CYCLES
238 .Pq Event 37, Counter 0
239 Cycles when IFU stalls because an instruction miss caused the IFU not
240 to have any runnable instructions.
241 Ignores the stalls due to ITLB misses as well as the 4 cycles
242 following a redirect.
243 .It Li DC_BLOCKED_CYCLES
244 .Pq Event 37, Counter 1
245 Counts all cycles where integer pipeline waits on Load return data due
246 to a D-cache miss.
247 The LSU can signal a "long stall" on a D-cache misses, in which case
248 the waiting TC might be rescheduled so other TCs can execute
249 instructions till the data returns.
250 .It Li L2_IMISS_STALL_CYCLES
251 .Pq Event 38, Counter 0
252 Cycles where the main pipeline is stalled waiting for a SYNC to complete.
253 .It Li L2_DMISS_STALL_CYCLES
254 .Pq Event 38, Counter 1
255 Cycles where the main pipeline is stalled because of an index conflict
256 in the Fill Store Buffer.
257 .It Li DMISS_CYCLES
258 .Pq Event 39, Counter 0
259 Data miss is outstanding, but not necessarily stalling the pipeline. 
260 The difference between this and D$ miss stall cycles can show the gain
261 from non-blocking cache misses.
262 .It Li L2_MISS_CYCLES
263 .Pq Event 39, Counter 1
264 L2 miss is outstanding, but not necessarily stalling the pipeline.
265 .It Li UNCACHED_BLOCK_CYCLES
266 .Pq Event 40, Counter 0
267 Cycles where the processor is stalled on an uncached fetch, load, or store.
268 .It Li MDU_STALL_CYCLES
269 .Pq Event 41, Counter 0
270 Cycles where the processor is stalled on an uncached fetch, load, or store.
271 .It Li FPU_STALL_CYCLES
272 .Pq Event 41, Counter 1
273 Counts all cycles where integer pipeline waits on FPU return data.
274 .It Li CP2_STALL_CYCLES
275 .Pq Event 42, Counter 0
276 Counts all cycles where integer pipeline waits on CP2 return data.
277 .It Li COREXTEND_STALL_CYCLES
278 .Pq Event 42, Counter 1
279 Counts all cycles where integer pipeline waits on CorExtend return data.
280 .It Li ISPRAM_STALL_CYCLES
281 .Pq Event 43, Counter 0
282 Count all pipeline bubbles that are a result of multicycle ISPRAM
283 access.
284 Pipeline bubbles are defined as all cycles that IFU doesn't present an
285 instruction to ALU. The four cycles after a redirect are not counted.
286 .It Li DSPRAM_STALL_CYCLES
287 .Pq Event 43, Counter 1
288 Counts stall cycles created by an instruction waiting for access to DSPRAM.
289 .It Li CACHE_STALL_CYCLES
290 .Pq Event 44, Counter 0
291 Counts all cycles the where pipeline is stalled due to CACHE
292 instructions.
293 Includes cycles where CACHE instructions themselves are
294 stalled in the ALU, and cycles where CACHE instructions cause
295 subsequent instructions to be stalled.
296 .It Li LOAD_TO_USE_STALLS
297 .Pq Event 45, Counter 0
298 Counts all cycles where integer pipeline waits on Load return data.
299 .It Li BASE_MISPRED_STALLS
300 .Pq Event 45, Counter 1
301 Counts stall cycles due to skewed ALU where the bypass to the address
302 generation takes an extra cycle.
303 .It Li CPO_READ_STALLS
304 .Pq Event 46, Counter 0
305 Counts all cycles where integer pipeline waits on return data from
306 MFC0, RDHWR instructions.
307 .It Li BRANCH_MISPRED_CYCLES
308 .Pq Event 46, Counter 1
309 This counts the number of cycles from a mispredicted branch until the
310 next non-delay slot instruction executes.
311 .It Li IFETCH_BUFFER_FULL
312 .Pq Event 48, Counter 0
313 Counts the number of times an instruction cache miss was detected, but
314 both fill buffers were already allocated.
315 .It Li FETCH_BUFFER_ALLOCATED
316 .Pq Event 48, Counter 1
317 Number of cycles where at least one of the IFU fill buffers is
318 allocated (miss pending).
319 .It Li EJTAG_ITRIGGER
320 .Pq Event 49, Counter 0
321 Number of times an EJTAG Instruction Trigger Point condition matched.
322 .It Li EJTAG_DTRIGGER
323 .Pq Event 49, Counter 1
324 Number of times an EJTAG Data Trigger Point condition matched.
325 .It Li FSB_LT_QUARTER
326 .Pq Event 50, Counter 0
327 Fill store buffer less than one quarter full.
328 .It Li FSB_QUARTER_TO_HALF
329 .Pq Event 50, Counter 1
330 Fill store buffer between one quarter and one half full.
331 .It Li FSB_GT_HALF
332 .Pq Event 51, Counter 0
333 Fill store buffer more than half full.
334 .It Li FSB_FULL_PIPELINE_STALLS
335 .Pq Event 51, Counter 1
336 Cycles where the pipeline is stalled because the Fill-Store Buffer in LSU is full.
337 .It Li LDQ_LT_QUARTER
338 .Pq Event 52, Counter 0
339 Load data queue less than one quarter full.
340 .It Li LDQ_QUARTER_TO_HALF
341 .Pq Event 52, Counter 1
342 Load data queue between one quarter and one half full.
343 .It Li LDQ_GT_HALF
344 .Pq Event 53, Counter 0
345 Load data queue more than one half full.
346 .It Li LDQ_FULL_PIPELINE_STALLS
347 .Pq Event 53, Counter 1
348 Cycles where the pipeline is stalled because the Load Data Queue in the LSU is full.
349 .It Li WBB_LT_QUARTER
350 .Pq Event 54, Counter 0
351 Write back buffer less than one quarter full.
352 .It Li WBB_QUARTER_TO_HALF
353 .Pq Event 54, Counter 1
354 Write back buffer between one quarter and one half full.
355 .It Li WBB_GT_HALF
356 .Pq Event 55, Counter 0
357 Write back buffer more than one half full.
358 .It Li WBB_FULL_PIPELINE_STALLS
359 .Pq Event 55 Counter 1
360 Cycles where the pipeline is stalled because the Load Data Queue in the LSU is full.
361 .It Li REQUEST_LATENCY
362 .Pq Event 61, Counter 0
363 Measures latency from miss detection until critical dword of response
364 is returned, Only counts for cacheable reads.
365 .It Li REQUEST_COUNT
366 .Pq Event 61, Counter 1
367 Counts number of cacheable read requests used for previous latency counter.
368 .El
369 .Ss Event Name Aliases
370 The following table shows the mapping between the PMC-independent
371 aliases supported by
372 .Lb libpmc
373 and the underlying hardware events used.
374 .Bl -column "branch-mispredicts" "cpu_clk_unhalted.core_p"
375 .It Em Alias Ta Em Event Ta 
376 .It Li instructions Ta Li INSTR_EXECUTED Ta
377 .It Li branches Ta Li BRANCH_COMPLETED Ta 
378 .It Li branch-mispredicts Ta Li BRANCH_MISPRED Ta 
379 .El
380 .Sh SEE ALSO
381 .Xr pmc 3 ,
382 .Xr pmc.atom 3 ,
383 .Xr pmc.core 3 ,
384 .Xr pmc.iaf 3 ,
385 .Xr pmc.k7 3 ,
386 .Xr pmc.k8 3 ,
387 .Xr pmc.p4 3 ,
388 .Xr pmc.p5 3 ,
389 .Xr pmc.p6 3 ,
390 .Xr pmc.tsc 3 ,
391 .Xr pmc_cpuinfo 3 ,
392 .Xr pmclog 3 ,
393 .Xr hwpmc 4
394 .Sh HISTORY
395 The
396 .Nm pmc
397 library first appeared in
398 .Fx 6.0 .
399 .Sh AUTHORS
400 The
401 .Lb libpmc
402 library was written by
403 .An "Joseph Koshy"
404 .Aq jkoshy@FreeBSD.org .
405 MIPS support was added by
406 .An "George Neville-Neil"
407 .Aq gnn@FreeBSD.org .
408 .Sh CAVEATS
409 The MIPS code does not yet support sampling.