blob: 2781ec851c3aa0a33e08ae5f4d3440dbfe475002 [file] [log] [blame]
Wolfgang Denkba94a1b2006-05-30 15:56:48 +02001/**
2 * @file IxPerfProfAcc.h
3 *
4 * @brief Header file for the IXP400 Perf Prof component (IxPerfProfAcc)
5 *
6 *
7 * @par
8 * IXP400 SW Release version 2.0
9 *
10 * -- Copyright Notice --
11 *
12 * @par
13 * Copyright 2001-2005, Intel Corporation.
14 * All rights reserved.
15 *
16 * @par
Wolfgang Denkcb3761e2013-07-28 22:12:47 +020017 * SPDX-License-Identifier: BSD-3-Clause
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020018 * @par
19 * -- End of Copyright Notice --
20 */
21
22/**
23 * @defgroup IxPerfProfAcc IXP400 Performance Profiling (IxPerfProfAcc) API
24 *
25 * @brief IXP400 Performance Profiling Utility component Public API.
26 * @li NOTE: Xcycle measurement is not supported in Linux.
27 *
28 *
29 * @{
30 */
31#ifndef IXPERFPROFACC_H
32#define IXPERFPROFACC_H
33
34#include "IxOsal.h"
35
36#ifdef __linux
37#include <linux/proc_fs.h>
38#endif
39
40/*
41 * Section for #define
42 */
43/**
44 * @ingroup IxPerfProfAcc
45 *
46 * @def IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES
47 *
48 * @brief This is the maximum number of profiling samples allowed, which can be
49 * modified according to the user's discretion
50 */
51#define IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES 0xFFFF
52
53/**
54 * @ingroup IxPerfProfAcc
55 *
56 * @def IX_PERFPROF_ACC_BUS_PMU_MAX_PECS
57 *
58 * @brief This is the maximum number of Programmable Event Counters available.
59 * This is a hardware specific and fixed value. Do not change.
60 *
61 */
62#define IX_PERFPROF_ACC_BUS_PMU_MAX_PECS 7
63
64/**
65 * @ingroup IxPerfProfAcc
66 *
67 * @def IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
68 *
69 * @brief Max number of measurement allowed. This constant is used when
70 * creating storage array for Xcycle. When run in continuous mode,
71 * Xcycle will wrap around and re-use buffer.
72 */
73#define IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS 600
74
75#ifdef __linux
76/**
77 * @ingroup IxPerfProfAcc
78 *
79 * @def IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY
80 *
81 * @brief Level of accuracy required for matching the PC Address to
82 * symbol address. This is used when the XScale PMU time/event
83 * sampling functions get the PC address and search for the
84 * corresponding symbol address.
85 */
86#define IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY 0xffff
87
88#endif /*__linux*/
89
90/**
91 * @ingroup IxPerfProfAcc
92 *
93 * @def IX_PERFPROF_ACC_LOG
94 *
95 * @brief Mechanism for logging a formatted message for the PerfProfAcc component
96 *
97 * @param level UINT32 [in] - trace level
98 * @param device UINT32 [in] - output device
99 * @param str char* [in] - format string, similar to printf().
100 * @param a UINT32 [in] - first argument to display
101 * @param b UINT32 [in] - second argument to display
102 * @param c UINT32 [in] - third argument to display
103 * @param d UINT32 [in] - fourth argument to display
104 * @param e UINT32 [in] - fifth argument to display
105 * @param f UINT32 [in] - sixth argument to display
106 *
107 * @return none
108 */
109#ifndef NDEBUG
110#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)\
111 (ixOsalLog (level, device, str, a, b, c, d, e, f))
112#else /*do nothing*/
113#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)
114#endif /*ifdef NDEBUG */
115
116/*
117 * Section for struct
118 */
119
120/**
121 * @brief contains summary of samples taken
122 *
123 * Structure contains all details of each program counter value - frequency
124 * that PC occurs
125 */
126typedef struct
127{
128 UINT32 programCounter; /**<the program counter value of the sample*/
129 UINT32 freq; /**<the frequency of the occurence of the sample*/
130} IxPerfProfAccXscalePmuSamplePcProfile;
131
132/**
133 * @brief contains results of a counter
134 *
135 * Structure contains the results of a counter, which are split into the lower
136 * and upper 32 bits of the final count
137 */
138typedef struct
139{
140 UINT32 lower32BitsEventCount; /**<lower 32bits value of the event counter*/
141 UINT32 upper32BitsEventCount; /**<upper 32bits value of the event counter*/
142} IxPerfProfAccXscalePmuEvtCnt;
143
144/**
145 * @brief contains results of counters and their overflow
146 *
147 * Structure contains all values of counters and associated overflows. The
148 * specific event and clock counters are determined by the user
149 */
150typedef struct
151{
152 UINT32 clk_value; /**<current value of clock counter*/
153 UINT32 clk_samples; /**<number of clock counter overflows*/
154 UINT32 event1_value; /**<current value of event 1 counter*/
155 UINT32 event1_samples; /**<number of event 1 counter overflows*/
156 UINT32 event2_value; /**<current value of event 2 counter*/
157 UINT32 event2_samples; /**<number of event 2 counter overflows*/
158 UINT32 event3_value; /**<current value of event 3 counter*/
159 UINT32 event3_samples; /**<number of event 3 counter overflows*/
160 UINT32 event4_value; /**<current value of event 4 counter*/
161 UINT32 event4_samples; /**<number of event 4 counter overflows*/
162} IxPerfProfAccXscalePmuResults;
163
164/**
165 *
166 * @brief Results obtained from Xcycle run
167 */
168typedef struct
169{
170 float maxIdlePercentage; /**<maximum percentage of Idle cycles*/
171 float minIdlePercentage; /**<minimum percentage of Idle cycles*/
172 float aveIdlePercentage; /**<average percentage of Idle cycles*/
173 UINT32 totalMeasurements; /**<total number of measurement made */
174} IxPerfProfAccXcycleResults;
175
176/**
177 *
178 * @brief Results obtained from running the Bus Pmu component. The results
179 * are obtained when the get functions is called.
180 *
181 */
182typedef struct
183{
184 UINT32 statsToGetLower27Bit[IX_PERFPROF_ACC_BUS_PMU_MAX_PECS]; /**<Lower 27 Bit of counter value */
185 UINT32 statsToGetUpper32Bit[IX_PERFPROF_ACC_BUS_PMU_MAX_PECS]; /**<Upper 32 Bit of counter value */
186} IxPerfProfAccBusPmuResults;
187
188/*
189 * Section for enum
190 */
191
192/**
193 * @ingroup IxPerfProfAcc
194 *
195 * @enum IxPerfProfAccBusPmuEventCounters1
196 *
197 * @brief Type of bus pmu events supported on PEC 1.
198 *
199 * Lists all bus pmu events.
200 */
201typedef enum
202{
203 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEA_GRANT_SELECT = 1, /**< Select North NPEA grant on PEC1*/
204 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEB_GRANT_SELECT, /**< Select North NPEB grant on PEC1*/
205 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEC_GRANT_SELECT, /**< Select North NPEC grant on PEC1*/
206 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_BUS_IDLE_SELECT, /**< Select North bus idle on PEC1*/
207 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEA_REQ_SELECT, /**< Select North NPEA req on PEC1*/
208 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEB_REQ_SELECT, /**< Select North NPEB req on PEC1*/
209 IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEC_REQ_SELECT, /**< Select North NPEC req on PEC1*/
210
211 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_GSKT_GRANT_SELECT, /**< Select south gasket grant on PEC1*/
212 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_ABB_GRANT_SELECT, /**< Select south abb grant on PEC1*/
213 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_PCI_GRANT_SELECT, /**< Select south pci grant on PEC1*/
214 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_APB_GRANT_SELECT, /**< Select south apb grant on PEC1*/
215 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_GSKT_REQ_SELECT, /**< Select south gasket request on PEC1*/
216 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_ABB_REQ_SELECT, /**< Select south abb request on PEC1*/
217 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_PCI_REQ_SELECT, /**< Select south pci request on PEC1*/
218 IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_APB_REQ_SELECT, /**< Select south apb request on PEC1*/
219
220 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_0_HIT_SELECT, /**< Select sdram0 hit on PEC1*/
221 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_1_HIT_SELECT, /**< Select sdram1 hit on PEC1*/
222 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC1*/
223 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC1*/
224 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_4_MISS_SELECT, /**< Select sdram4 miss on PEC1*/
225 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_5_MISS_SELECT, /**< Select sdram5 miss on PEC1*/
226 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC1*/
227 IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_7_MISS_SELECT /**< Select sdram7 miss on PEC1*/
228} IxPerfProfAccBusPmuEventCounters1;
229
230/**
231 * @ingroup IxPerfProfAcc
232 *
233 * @enum IxPerfProfAccBusPmuEventCounters2
234 *
235 * @brief Type of bus pmu events supported on PEC 2.
236 *
237 * Lists all bus pmu events.
238 */
239typedef enum
240{
241 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEA_XFER_SELECT = 24, /**< Select North NPEA transfer on PEC2*/
242 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEB_XFER_SELECT, /**< Select North NPEB transfer on PEC2*/
243 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEC_XFER_SELECT, /**< Select North NPEC transfer on PEC2*/
244 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_BUS_WRITE_SELECT, /**< Select North bus write on PEC2*/
245 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEA_OWN_SELECT, /**< Select North NPEA own on PEC2*/
246 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEB_OWN_SELECT, /**< Select North NPEB own on PEC2*/
247 IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEC_OWN_SELECT, /**< Select North NPEC own on PEC2*/
248
249 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_GSKT_XFER_SELECT, /**< Select South gasket transfer on PEC2*/
250 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_ABB_XFER_SELECT, /**< Select South abb transfer on PEC2*/
251 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_PCI_XFER_SELECT, /**< Select South pci transfer on PEC2*/
252 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_APB_XFER_SELECT, /**< Select South apb transfer on PEC2*/
253 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_GSKT_OWN_SELECT, /**< Select South gasket own on PEC2*/
254 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_ABB_OWN_SELECT, /**< Select South abb own on PEC2*/
255 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_PCI_OWN_SELECT, /**< Select South pci own on PEC2*/
256 IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_APB_OWN_SELECT, /**< Select South apb own transfer on PEC2*/
257
258 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_1_HIT_SELECT, /**< Select sdram1 hit on PEC2*/
259 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC2*/
260 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC2*/
261 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC2*/
262 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_5_MISS_SELECT, /**< Select sdram5 miss on PEC2*/
263 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC2*/
264 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC2*/
265 IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_0_MISS_SELECT /**< Select sdram0 miss on PEC2*/
266} IxPerfProfAccBusPmuEventCounters2;
267
268/**
269 * @ingroup IxPerfProfAcc
270 *
271 * @enum IxPerfProfAccBusPmuEventCounters3
272 *
273 * @brief Type of bus pmu events supported on PEC 3.
274 *
275 * Lists all bus pmu events.
276 */
277typedef enum
278{
279 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEA_RETRY_SELECT = 47, /**< Select north NPEA retry on PEC3*/
280 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEB_RETRY_SELECT, /**< Select north NPEB retry on PEC3*/
281 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEC_RETRY_SELECT, /**< Select north NPEC retry on PEC3*/
282 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_BUS_READ_SELECT, /**< Select north bus read on PEC3*/
283 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEA_WRITE_SELECT, /**< Select north NPEA write on PEC3*/
284 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC3*/
285 IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEC_WRITE_SELECT, /**< Select north NPEC wirte on PEC3*/
286
287 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_GSKT_RETRY_SELECT, /**< Select south gasket retry on PEC3*/
288 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_ABB_RETRY_SELECT, /**< Select south abb retry on PEC3*/
289 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_PCI_RETRY_SELECT, /**< Select south pci retry on PEC3*/
290 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_APB_RETRY_SELECT, /**< Select south apb retry on PEC3*/
291 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_GSKT_WRITE_SELECT, /**< Select south gasket write on PEC3*/
292 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_ABB_WRITE_SELECT, /**< Select south abb write on PEC3*/
293 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_PCI_WRITE_SELECT, /**< Select south pci write on PEC3*/
294 IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_APB_WRITE_SELECT, /**< Select south apb write on PEC3*/
295
296 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC3*/
297 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC3*/
298 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC3*/
299 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC3*/
300 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC3*/
301 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC3*/
302 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_0_MISS_SELECT, /**< Select sdram0 miss on PEC3*/
303 IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_1_MISS_SELECT /**< Select sdram1 miss on PEC3*/
304} IxPerfProfAccBusPmuEventCounters3;
305
306/**
307 * @ingroup IxPerfProfAcc
308 *
309 * @enum IxPerfProfAccBusPmuEventCounters4
310 *
311 * @brief Type of bus pmu events supported on PEC 4.
312 *
313 * Lists all bus pmu events.
314 */
315typedef enum
316{
317 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_PCI_SPLIT_SELECT = 70, /**< Select south pci split on PEC4*/
318 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_EXP_SPLIT_SELECT, /**< Select south expansion split on PEC4*/
319 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_GRANT_SELECT, /**< Select south apb grant on PEC4*/
320 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_XFER_SELECT, /**< Select south apb transfer on PEC4*/
321 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_GSKT_READ_SELECT, /**< Select south gasket read on PEC4*/
322 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_ABB_READ_SELECT, /**< Select south abb read on PEC4*/
323 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_PCI_READ_SELECT, /**< Select south pci read on PEC4*/
324 IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_READ_SELECT, /**< Select south apb read on PEC4*/
325
326 IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_ABB_SPLIT_SELECT, /**< Select north abb split on PEC4*/
327 IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEA_REQ_SELECT, /**< Select north NPEA req on PEC4*/
328 IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEA_READ_SELECT, /**< Select north NPEA read on PEC4*/
329 IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEB_READ_SELECT, /**< Select north NPEB read on PEC4*/
330 IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEC_READ_SELECT, /**< Select north NPEC read on PEC4*/
331
332 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC4*/
333 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC4*/
334 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC4*/
335 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_6_HIT_SELECT, /**< Select sdram6 hit on PEC4*/
336 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC4*/
337 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_0_MISS_SELECT, /**< Select sdram0 miss on PEC4*/
338 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_1_MISS_SELECT, /**< Select sdram1 miss on PEC4*/
339 IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_2_MISS_SELECT /**< Select sdram2 miss on PEC4*/
340} IxPerfProfAccBusPmuEventCounters4;
341
342/**
343 * @ingroup IxPerfProfAcc
344 *
345 * @enum IxPerfProfAccBusPmuEventCounters5
346 *
347 * @brief Type of bus pmu events supported on PEC 5.
348 *
349 * Lists all bus pmu events.
350 */
351typedef enum
352{
353 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_GRANT_SELECT = 91, /**< Select south abb grant on PEC5*/
354 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_XFER_SELECT, /**< Select south abb transfer on PEC5*/
355 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_RETRY_SELECT, /**< Select south abb retry on PEC5*/
356 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_EXP_SPLIT_SELECT, /**< Select south expansion split on PEC5*/
357 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_REQ_SELECT, /**< Select south abb request on PEC5*/
358 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_OWN_SELECT, /**< Select south abb own on PEC5*/
359 IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_BUS_IDLE_SELECT, /**< Select south bus idle on PEC5*/
360
361 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_GRANT_SELECT, /**< Select north NPEB grant on PEC5*/
362 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_XFER_SELECT, /**< Select north NPEB transfer on PEC5*/
363 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_RETRY_SELECT, /**< Select north NPEB retry on PEC5*/
364 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_REQ_SELECT, /**< Select north NPEB request on PEC5*/
365 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_OWN_SELECT, /**< Select north NPEB own on PEC5*/
366 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC5*/
367 IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_READ_SELECT, /**< Select north NPEB read on PEC5*/
368
369 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_4_HIT_SELECT, /**< Select north sdram4 hit on PEC5*/
370 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_5_HIT_SELECT, /**< Select north sdram5 hit on PEC5*/
371 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_6_HIT_SELECT, /**< Select north sdram6 hit on PEC5*/
372 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_7_HIT_SELECT, /**< Select north sdram7 hit on PEC5*/
373 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_0_MISS_SELECT, /**< Select north sdram0 miss on PEC5*/
374 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_1_MISS_SELECT, /**< Select north sdram1 miss on PEC5*/
375 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_2_MISS_SELECT, /**< Select north sdram2 miss on PEC5*/
376 IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_3_MISS_SELECT /**< Select north sdram3 miss on PEC5*/
377} IxPerfProfAccBusPmuEventCounters5;
378
379/**
380 * @ingroup IxPerfProfAcc
381 *
382 * @enum IxPerfProfAccBusPmuEventCounters6
383 *
384 * @brief Type of bus pmu events supported on PEC 6.
385 *
386 * Lists all bus pmu events.
387 */
388typedef enum
389{
390 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_GRANT_SELECT = 113, /**< Select south pci grant on PEC6*/
391 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_XFER_SELECT, /**< Select south pci transfer on PEC6*/
392 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_RETRY_SELECT, /**< Select south pci retry on PEC6*/
393 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_SPLIT_SELECT, /**< Select south pci split on PEC6*/
394 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_REQ_SELECT, /**< Select south pci request on PEC6*/
395 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_OWN_SELECT, /**< Select south pci own on PEC6*/
396 IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_BUS_WRITE_SELECT, /**< Select south pci write on PEC6*/
397
398 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_GRANT_SELECT, /**< Select north NPEC grant on PEC6*/
399 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_XFER_SELECT, /**< Select north NPEC transfer on PEC6*/
400 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_RETRY_SELECT, /**< Select north NPEC retry on PEC6*/
401 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_REQ_SELECT, /**< Select north NPEC request on PEC6*/
402 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_OWN_SELECT, /**< Select north NPEC own on PEC6*/
403 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC6*/
404 IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_READ_SELECT, /**< Select north NPEC read on PEC6*/
405
406 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC6*/
407 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_6_HIT_SELECT, /**< Select sdram6 hit on PEC6*/
408 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_7_HIT_SELECT, /**< Select sdram7 hit on PEC6*/
409 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_0_HIT_SELECT, /**< Select sdram0 hit on PEC6*/
410 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_1_MISS_SELECT, /**< Select sdram1 miss on PEC6*/
411 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_2_MISS_SELECT, /**< Select sdram2 miss on PEC6*/
412 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_3_MISS_SELECT, /**< Select sdram3 miss on PEC6*/
413 IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_4_MISS_SELECT /**< Select sdram4 miss on PEC6*/
414} IxPerfProfAccBusPmuEventCounters6;
415
416/**
417 * @ingroup IxPerfProfAcc
418 *
419 * @enum IxPerfProfAccBusPmuEventCounters7
420 *
421 * @brief Type of bus pmu events supported on PEC 7.
422 *
423 * Lists all bus pmu events.
424 */
425typedef enum
426{
427 IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_RETRY_SELECT = 135, /**< Select south apb retry on PEC7*/
428 IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_REQ_SELECT, /**< Select south apb request on PEC7*/
429 IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_OWN_SELECT, /**< Select south apb own on PEC7*/
430 IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_BUS_READ_SELECT, /**< Select south bus read on PEC7*/
431 IX_PERFPROF_ACC_BUS_PMU_PEC7_CYCLE_COUNT_SELECT /**< Select cycle count on PEC7*/
432} IxPerfProfAccBusPmuEventCounters7;
433
434/**
435 * @ingroup IxPerfProfAcc
436 *
437 * @enum IxPerfProfAccXscalePmuEvent
438 *
439 * @brief Type of xscale pmu events supported
440 *
441 * Lists all xscale pmu events. The maximum is a default value that the user
442 * should not exceed.
443 */
444typedef enum
445{
446 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_CACHE_MISS=0, /**< cache miss*/
447 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_CACHE_INSTRUCTION,/**< cache instruction*/
448 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_STALL, /**< event stall*/
449 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_INST_TLB_MISS, /**< instruction tlb miss*/
450 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_TLB_MISS, /**< data tlb miss*/
451 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_BRANCH_EXEC, /**< branch executed*/
452 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_BRANCH_MISPREDICT, /**<branch mispredict*/
453 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_INST_EXEC, /**< instruction executed*/
454 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_FULL_EVERYCYCLE, /**<
455 *Stall - data cache
456 *buffers are full.
457 *This event occurs
458 *every cycle where
459 *condition present
460 */
461 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_ONCE, /**<
462 *Stall - data cache buffers are
463 *full.This event occurs once
464 *for each contiguous sequence
465 */
466 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_ACCESS, /**< data cache access*/
467 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_MISS, /**< data cache miss*/
468 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_WRITEBACK, /**<data cache
469 *writeback
470 */
471 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_SW_CHANGE_PC, /**< sw change pc*/
472 IX_PERFPROF_ACC_XSCALE_PMU_EVENT_MAX /**< max value*/
473} IxPerfProfAccXscalePmuEvent;
474
475/**
476 * @ingroup IxPerfProfAcc
477 *
478 * @enum IxPerfProfAccStatus
479 *
480 * @brief Invalid Status Definitions
481 *
482 * These status will be used by the APIs to return to the user.
483 */
484typedef enum
485{
486 IX_PERFPROF_ACC_STATUS_SUCCESS = IX_SUCCESS, /**< success*/
487 IX_PERFPROF_ACC_STATUS_FAIL = IX_FAIL, /**< fail*/
488 IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS,/**<another utility in
489 *progress
490 */
491 IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS, /**<measurement in
492 *progress
493 */
494 IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE, /**<no baseline yet*/
495 IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE, /**<
496 * Measurement chosen
497 * is out of range
498 */
499 IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL, /**<
500 * Cannot set
501 * task priority
502 */
503 IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL, /**<
504 * Fail create thread
505 */
506 IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL, /**<
507 *cannot restore
508 *priority
509 */
510 IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING, /**< xcycle not running*/
511 IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID, /**< invalid number
512 *entered
513 */
514 IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID, /**< invalid pmu event*/
515 IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED, /**<a start process
516 *was not called
517 *before attempting
518 *a stop or results
519 *get
520 */
521 IX_PERFPROF_ACC_STATUS_BUS_PMU_MODE_ERROR, /**< invalid mode*/
522 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC1_ERROR, /**< invalid pec1 entered*/
523 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC2_ERROR, /**< invalid pec2 entered*/
524 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC3_ERROR, /**< invalid pec3 entered*/
525 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC4_ERROR, /**< invalid pec4 entered*/
526 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC5_ERROR, /**< invalid pec5 entered*/
527 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC6_ERROR, /**< invalid pec6 entered*/
528 IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC7_ERROR, /**< invalid pec7 entered*/
529 IX_PERFPROF_ACC_STATUS_BUS_PMU_START_NOT_CALLED, /**<a start process
530 *was not called
531 *before attempting
532 *a stop
533 */
534 IX_PERFPROF_ACC_STATUS_COMPONENT_NOT_SUPPORTED /**<Device or OS does not support component*/
535} IxPerfProfAccStatus;
536
537/**
538 * @ingroup IxPerfProfAcc
539 *
540 * @enum IxPerfProfAccBusPmuMode
541 *
542 * @brief State selection of counters.
543 *
544 * These states will be used to determine the counters whose values are to be
545 * read.
546 */
547typedef enum
548{
549 IX_PERFPROF_ACC_BUS_PMU_MODE_HALT=0, /**< halt state*/
550 IX_PERFPROF_ACC_BUS_PMU_MODE_SOUTH, /**< south state*/
551 IX_PERFPROF_ACC_BUS_PMU_MODE_NORTH, /**< north state*/
552 IX_PERFPROF_ACC_BUS_PMU_MODE_SDRAM /**< SDRAM state*/
553} IxPerfProfAccBusPmuMode;
554
555/*
556 * Section for prototypes interface functions
557 */
558
559/**
560 * @ingroup IxPerfProfAcc
561 *
562 * @fn ixPerfProfAccXscalePmuEventCountStart(
563 BOOL clkCntDiv,
564 UINT32 numEvents,
565 IxPerfProfAccXscalePmuEvent pmuEvent1,
566 IxPerfProfAccXscalePmuEvent pmuEvent2,
567 IxPerfProfAccXscalePmuEvent pmuEvent3,
568 IxPerfProfAccXscalePmuEvent pmuEvent4 )
569 *
570 * @brief This API will start the clock and event counting
571 *
572 * @param clkCntDiv BOOL [in] - enables/disables the clock divider. When
573 * true, the divider is enabled and the clock count will be incremented
574 * by one at each 64th processor clock cycle. When false, the divider
575 * is disabled and the clock count will be incremented at every
576 * processor clock cycle.
577 * @param numEvents UINT32 [in] - the number of PMU events that are to be
578 * monitored as specified by the user. For clock counting only, this
579 * is set to zero.
580 * @param pmuEvent1 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
581 * event to be monitored by counter 1
582 * @param pmuEvent2 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
583 * event to be monitored by counter 2
584 * @param pmuEvent3 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
585 * event to be monitored by counter 3
586 * @param pmuEvent4 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
587 * event to be monitored by counter 4
588 *
589 * This API will start the clock and xscale PMU event counting. Up to
590 * 4 events can be monitored simultaneously. This API has to be called before
591 * ixPerfProfAccXscalePmuEventCountStop can be called.
592 *
593 * @return
594 * - IX_PERFPROF_ACC_STATUS_SUCCESS if clock and events counting are
595 * started successfully
596 * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the counting
597 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID if the number of events
598 * specified is out of the valid range
599 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID if the value of the PMU
600 * event specified does not exist
601 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
602 * running
603 *
604 * @li Reentrant : no
605 * @li ISR Callable : no
606 *
607 */
608PUBLIC IxPerfProfAccStatus
609ixPerfProfAccXscalePmuEventCountStart(
610 BOOL clkCntDiv,
611 UINT32 numEvents,
612 IxPerfProfAccXscalePmuEvent pmuEvent1,
613 IxPerfProfAccXscalePmuEvent pmuEvent2,
614 IxPerfProfAccXscalePmuEvent pmuEvent3,
615 IxPerfProfAccXscalePmuEvent pmuEvent4 );
616
617/**
618 * @ingroup IxPerfProfAcc
619 *
620 * @fn ixPerfProfAccXscalePmuEventCountStop (
621 IxPerfProfAccXscalePmuResults *eventCountStopResults)
622 *
623 * @brief This API will stop the clock and event counting
624 *
625 * @param *eventCountStopResults @ref IxPerfProfAccXscalePmuResults [out] - pointer
626 * to struct containing results of counters and their overflow. It is the
627 * users's responsibility to allocate the memory for this pointer.
628 *
629 * This API will stop the clock and xscale PMU events that are being counted.
630 * The results of the clock and events count will be stored in the pointer
631 * allocated by the user. It can only be called once
632 * IxPerfProfAccEventCountStart has been called.
633 *
634 * @return
635 * - IX_PERFPROF_ACC_STATUS_SUCCESS if clock and events counting are
636 * stopped successfully
637 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
638 * ixPerfProfAccXscalePmuEventCountStart is not called first.
639 *
640 * @li Reentrant : no
641 * @li ISR Callable : no
642 *
643 */
644
645PUBLIC IxPerfProfAccStatus
646ixPerfProfAccXscalePmuEventCountStop(
647 IxPerfProfAccXscalePmuResults *eventCountStopResults);
648
649/**
650 * @ingroup IxPerfProfAcc
651 *
652 * @fn ixPerfProfAccXscalePmuTimeSampStart(
653 UINT32 samplingRate,
654 BOOL clkCntDiv)
655 *
656 * @brief Starts the time based sampling
657 *
658 * @param samplingRate UINT32 [in] - sampling rate is the number of
659 * clock counts before a counter overflow interrupt is generated,
660 * at which, a sample is taken; the rate specified cannot be greater
661 * than the counter size of 32bits or set to zero.
662 * @param clkCntDiv BOOL [in] - enables/disables the clock divider. When
663 * true, the divider is enabled and the clock count will be incremented
664 * by one at each 64th processor clock cycle. When false, the divider
665 * is disabled and the clock count will be incremented at every
666 * processor clock cycle.
667 *
668 * This API starts the time based sampling to determine the frequency with
669 * which lines of code are being executed. Sampling is done at the rate
670 * specified by the user. At each sample,the value of the program counter
671 * is determined. Each of these occurrences are recorded to determine the
672 * frequency with which the Xscale code is being executed. This API has to be
673 * called before ixPerfProfAccXscalePmuTimeSampStop can be called.
674 *
675 * @return
676 * - IX_PERFPROF_ACC_STATUS_SUCCESS if time based sampling is started
677 * successfully
678 * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the sampling
679 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
680 * running
681 *
682 * @li Reentrant : no
683 * @li ISR Callable : no
684 *
685 */
686PUBLIC IxPerfProfAccStatus
687ixPerfProfAccXscalePmuTimeSampStart(
688 UINT32 samplingRate,
689 BOOL clkCntDiv);
690
691/**
692 * @ingroup IxPerfProfAcc
693 *
694 * @fn ixPerfProfAccXscalePmuTimeSampStop(
695 IxPerfProfAccXscalePmuEvtCnt *clkCount,
696 IxPerfProfAccXscalePmuSamplePcProfile *timeProfile)
697 *
698 * @brief Stops the time based sampling
699 *
700 * @param *clkCount @ref IxPerfProfAccXscalePmuEvtCnt [out] - pointer to the
701 * struct containing the final clock count and its overflow. It is the
702 * user's responsibility to allocate the memory for this pointer.
703 * @param *timeProfile @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
704 * pointer to the array of profiles for each program counter value;
705 * the user should set the size of the array to
706 * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the user's
707 * responsibility to allocate the memory for this pointer.
708 *
709 * This API stops the time based sampling. The results are stored in the
710 * pointers allocated by the user. It can only be called once
711 * ixPerfProfAccXscalePmuTimeSampStart has been called.
712 *
713 * @return
714 * - IX_PERFPROF_ACC_STATUS_SUCCESS if time based sampling is stopped
715 * successfully
716 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
717 * ixPerfProfAccXscalePmuTimeSampStart not called first
718 *
719 * @li Reentrant : no
720 * @li ISR Callable : no
721 *
722 */
723PUBLIC IxPerfProfAccStatus
724ixPerfProfAccXscalePmuTimeSampStop(
725 IxPerfProfAccXscalePmuEvtCnt *clkCount,
726 IxPerfProfAccXscalePmuSamplePcProfile *timeProfile);
727
728/**
729 * @ingroup IxPerfProfAcc
730 *
731 * @fn ixPerfProfAccXscalePmuEventSampStart(
732 UINT32 numEvents,
733 IxPerfProfAccXscalePmuEvent pmuEvent1,
734 UINT32 eventRate1,
735 IxPerfProfAccXscalePmuEvent pmuEvent2,
736 UINT32 eventRate2,
737 IxPerfProfAccXscalePmuEvent pmuEvent3,
738 UINT32 eventRate3,
739 IxPerfProfAccXscalePmuEvent pmuEvent4,
740 UINT32 eventRate4)
741 *
742 * @brief Starts the event based sampling
743 *
744 * @param numEvents UINT32 [in] - the number of PMU events that are
745 * to be monitored as specified by the user. The value should be
746 * between 1-4 events at a time.
747 * @param pmuEvent1 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
748 * event to be monitored by counter 1
749 * @param eventRate1 UINT32 [in] - sampling rate of counter 1. The rate is
750 * the number of events before a sample taken. If 0 is specified, the
751 * the full counter value (0xFFFFFFFF) is used. The rate must not be
752 * greater than the full counter value.
753 * @param pmuEvent2 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
754 * event to be monitored by counter 2
755 * @param eventRate2 UINT32 [in] - sampling rate of counter 2. The rate is
756 * the number of events before a sample taken. If 0 is specified, the
757 * full counter value (0xFFFFFFFF) is used. The rate must not be
758 * greater than the full counter value.
759 * @param pmuEvent3 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
760 * event to be monitored by counter 3
761 * @param eventRate3 UINT32 [in] - sampling rate of counter 3. The rate is
762 * the number of events before a sample taken. If 0 is specified, the
763 * full counter value (0xFFFFFFFF) is used. The rate must not be
764 * greater than the full counter value.
765 * @param pmuEvent4 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
766 * event to be monitored by counter 4
767 * @param eventRate4 UINT32 [in] - sampling rate of counter 4. The rate is
768 * the number of events before a sample taken. If 0 is specified, the
769 * full counter value (0xFFFFFFFF) is used. The rate must not be
770 * greater than the full counter value.
771 *
772 * Starts the event based sampling to determine the frequency with
773 * which events are being executed. The sampling rate is the number of events,
774 * as specified by the user, before a counter overflow interrupt is
775 * generated. A sample is taken at each counter overflow interrupt. At each
776 * sample,the value of the program counter determines the corresponding
777 * location in the code. Each of these occurrences are recorded to determine
778 * the frequency with which the Xscale code in each event is executed. This API
779 * has to be called before ixPerfProfAccXscalePmuEventSampStop can be called.
780 *
781 * @return
782 * - IX_PERFPROF_ACC_STATUS_SUCCESS if event based sampling is started
783 * successfully
784 * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the sampling
785 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID if the number of events
786 * specified is out of the valid range
787 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID if the value of the
788 * PMU event specified does not exist
789 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
790 * running
791 *
792 * @li Reentrant : no
793 * @li ISR Callable : no
794 *
795 */
796PUBLIC IxPerfProfAccStatus
797ixPerfProfAccXscalePmuEventSampStart(
798 UINT32 numEvents,
799 IxPerfProfAccXscalePmuEvent pmuEvent1,
800 UINT32 eventRate1,
801 IxPerfProfAccXscalePmuEvent pmuEvent2,
802 UINT32 eventRate2,
803 IxPerfProfAccXscalePmuEvent pmuEvent3,
804 UINT32 eventRate3,
805 IxPerfProfAccXscalePmuEvent pmuEvent4,
806 UINT32 eventRate4);
807
808/**
809 * @ingroup IxPerfProfAcc
810 *
811 * @fn ixPerfProfAccXscalePmuEventSampStop(
812 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile1,
813 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile2,
814 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile3,
815 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile4)
816 *
817 * @brief Stops the event based sampling
818 *
819 * @param *eventProfile1 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
820 * pointer to the array of profiles for each program counter value;
821 * the user should set the size of the array to
822 * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
823 * users's responsibility to allocate memory for this pointer.
824 * @param *eventProfile2 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
825 * pointer to the array of profiles for each program counter value;
826 * the user should set the size of the array to
827 * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
828 * users's responsibility to allocate memory for this pointer.
829 * @param *eventProfile3 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
830 * pointer to the array of profiles for each program counter value;
831 * the user should set the size of the array to
832 * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
833 * users's responsibility to allocate memory for this pointer.
834 * @param *eventProfile4 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
835 * pointer to the array of profiles for each program counter value;
836 * the user should set the size of the array to
837 * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
838 * users's responsibility to allocate memory for this pointer.
839 *
840 * This API stops the event based sampling. The results are stored in the
841 * pointers allocated by the user. It can only be called once
842 * ixPerfProfAccEventSampStart has been called.
843 *
844 * @return
845 * - IX_PERFPROF_ACC_STATUS_SUCCESS if event based sampling is stopped
846 * successfully
847 * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
848 * ixPerfProfAccEventSampStart not called first.
849 *
850 * @li Reentrant : no
851 * @li ISR Callable : no
852 *
853 */
854PUBLIC IxPerfProfAccStatus
855ixPerfProfAccXscalePmuEventSampStop(
856 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile1,
857 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile2,
858 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile3,
859 IxPerfProfAccXscalePmuSamplePcProfile *eventProfile4);
860
861/**
862 * @ingroup IxPerfProfAcc
863 *
864 * @fn ixPerfProfAccXscalePmuResultsGet(IxPerfProfAccXscalePmuResults *results)
865 *
866 * @brief Reads the current value of the counters and their overflow
867 *
868 * @param *results @ref IxPerfProfAccXscalePmuResults [out] - pointer to the
869 results struct. It is the user's responsibility to allocate memory
870 for this pointer
871 *
872 * This API reads the value of all four event counters and the clock counter,
873 * and the associated overflows. It does not give results associated with
874 * sampling, i.e. PC and their frequencies. This API can be called at any time
875 * once a process has been started. If it is called before a process has started
876 * the user should be aware that the values it contains are default values and
877 * might be meaningless. The values of the counters are stored in the pointer
878 * allocated by the client.
879 *
880 * @return - none
881 *
882 * @li Reentrant : no
883 * @li ISR Callable : no
884 *
885 */
886PUBLIC void
887ixPerfProfAccXscalePmuResultsGet(IxPerfProfAccXscalePmuResults *results);
888
889/**
890 * @ingroup IxPerfProfAcc
891 *
892 * @fn ixPerfProfAccBusPmuStart(
893 IxPerfProfAccBusPmuMode mode,
894 IxPerfProfAccBusPmuEventCounters1 pecEvent1,
895 IxPerfProfAccBusPmuEventCounters2 pecEvent2,
896 IxPerfProfAccBusPmuEventCounters3 pecEvent3,
897 IxPerfProfAccBusPmuEventCounters4 pecEvent4,
898 IxPerfProfAccBusPmuEventCounters5 pecEvent5,
899 IxPerfProfAccBusPmuEventCounters6 pecEvent6,
900 IxPerfProfAccBusPmuEventCounters7 pecEvent7)
901 * @brief Initializes all the counters and selects events to be monitored.
902 *
903 * Function initializes all the counters and assigns the events associated
904 * with the counters. Users send in the mode and events they want to count.
905 * This API verifies if the combination chosen is appropriate
906 * and sets all the registers accordingly. Selecting HALT mode will result
907 * in an error. User should use ixPerfProfAccBusPmuStop() to HALT.
908 *
909 *
910 * @param mode @ref IxPerfProfAccStateBusPmuMode [in] - Mode selection.
911 * @param pecEvent1 @ref IxPerfProfAccBusPmuEventCounters1 [in] - Event for PEC1.
912 * @param pecEvent2 @ref IxPerfProfAccBusPmuEventCounters2 [in] - Event for PEC2.
913 * @param pecEvent3 @ref IxPerfProfAccBusPmuEventCounters3 [in] - Event for PEC3.
914 * @param pecEvent4 @ref IxPerfProfAccBusPmuEventCounters4 [in] - Event for PEC4.
915 * @param pecEvent5 @ref IxPerfProfAccBusPmuEventCounters5 [in] - Event for PEC5.
916 * @param pecEvent6 @ref IxPerfProfAccBusPmuEventCounters6 [in] - Event for PEC6.
917 * @param pecEvent7 @ref IxPerfProfAccBusPmuEventCounters7 [in] - Event for PEC7.
918 *
919 * @return
920 * - IX_PERFPROF_ACC_STATUS_SUCCESS - Initialization executed
921 * successfully.
922 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_MODE_ERROR - Error in selection of
923 * mode. Only NORTH, SOUTH and SDRAM modes are allowed.
924 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC1_ERROR - Error in selection of
925 * event for PEC1
926 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC2_ERROR - Error in selection of
927 * event for PEC2
928 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC3_ERROR - Error in selection of
929 * event for PEC3
930 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC4_ERROR - Error in selection of
931 * event for PEC4
932 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC5_ERROR - Error in selection of
933 * event for PEC5
934 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC6_ERROR - Error in selection of
935 * event for PEC6
936 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC7_ERROR - Error in selection of
937 * event for PEC7
938 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility
939 * is running
940 * - IX_PERFPROF_ACC_STATUS_FAIL - Failed to start because interrupt
941 * service routine fails to bind.
942 *
943 * @li Reentrant : no
944 * @li ISR Callable : no
945 *
946 **/
947PUBLIC
948IxPerfProfAccStatus ixPerfProfAccBusPmuStart (
949 IxPerfProfAccBusPmuMode mode,
950 IxPerfProfAccBusPmuEventCounters1 pecEvent1,
951 IxPerfProfAccBusPmuEventCounters2 pecEvent2,
952 IxPerfProfAccBusPmuEventCounters3 pecEvent3,
953 IxPerfProfAccBusPmuEventCounters4 pecEvent4,
954 IxPerfProfAccBusPmuEventCounters5 pecEvent5,
955 IxPerfProfAccBusPmuEventCounters6 pecEvent6,
956 IxPerfProfAccBusPmuEventCounters7 pecEvent7);
957
958/**
959 * @ingroup IxPerfProfAcc
960 *
961 * @fn ixPerfProfAccBusPmuStop(void)
962 * @brief Stops all counters.
963 *
964 * This function stops all the PECs by setting the halt bit in the ESR.
965 *
966 *
967 * @return
968 * - IX_PERFPROF_ACC_STATUS_SUCCESS - Counters successfully halted.
969 * - IX_PERFPROF_ACC_STATUS_FAIL - Counters could'nt be halted.
970 * - IX_PERFPROF_ACC_STATUS_BUS_PMU_START_NOT_CALLED - the
971 * ixPerfProfAccBusPmuStart() function is not called.
972 *
973 * @li Reentrant : no
974 * @li ISR Callable : no
975 *
976 **/
977PUBLIC IxPerfProfAccStatus
978ixPerfProfAccBusPmuStop (void);
979
980/**
981 * @ingroup IxPerfProfAcc
982 *
983 * @fn ixPerfProfAccBusPmuResultsGet (
984 IxPerfProfAccBusPmuResults *busPmuResults)
985 * @brief Gets values of all counters
986 *
987 * This function is responsible for getting all the counter values from the
988 * lower API and putting it into an array for the user.
989 *
990 * @param *busPmuResults @ref IxPerfProfAccBusPmuResults [out]
991 * - Pointer to a structure of arrays to store all counter values.
992 *
993 * @return none
994 *
995 * @li Reentrant : no
996 * @li ISR Callable : no
997 *
998 **/
999PUBLIC void
1000ixPerfProfAccBusPmuResultsGet (IxPerfProfAccBusPmuResults *BusPmuResults);
1001
1002/**
1003 * @ingroup IxPerfProfAcc
1004 *
1005 * @fn ixPerfProfAccBusPmuPMSRGet (
1006 UINT32 *pmsrValue)
1007 * @brief Get values of PMSR
1008 *
1009 * This API gets the Previous Master Slave Register
1010 * value and returns it to the calling function. This value indicates
1011 * which master or slave accessed the north, south bus or sdram last.
1012 * The value returned by this function is a 32 bit value and is read
1013 * from location of an offset 0x0024 of the base value.
1014 *
1015 * The PMSR value returned indicate the following:
1016 * <pre>
1017 *
1018 * *************************************************************************************
1019 * * Bit * Name * Description *
1020 * * *
1021 * *************************************************************************************
1022 * * [31:18] *Reserved* *
1023 * *************************************************************************************
1024 * * [17:12] * PSS * Indicates which of the slaves on *
1025 * * * * ARBS was previously *
1026 * * * * accessed by the AHBS. *
1027 * * * * [000001] Expansion Bus *
1028 * * * * [000010] SDRAM Controller *
1029 * * * * [000100] PCI *
1030 * * * * [001000] Queue Manager *
1031 * * * * [010000] AHB-APB Bridge *
1032 * * * * [100000] Reserved *
1033 * *************************************************************************************
1034 * * [11:8] * PSN * Indicates which of the Slaves on *
1035 * * * * ARBN was previously *
1036 * * * * accessed the AHBN. *
1037 * * * * [0001] SDRAM Controller *
1038 * * * * [0010] AHB-AHB Bridge *
1039 * * * * [0100] Reserved *
1040 * * * * [1000] Reserved *
1041 * *************************************************************************************
1042 * * [7:4] * PMS * Indicates which of the Masters on *
1043 * * * * ARBS was previously *
1044 * * * * accessing the AHBS. *
1045 * * * * [0001] Gasket *
1046 * * * * [0010] AHB-AHB Bridge *
1047 * * * * [0100] PCI *
1048 * * * * [1000] APB *
1049 * *************************************************************************************
1050 * * [3:0] * PMN * Indicates which of the Masters on *
1051 * * * * ARBN was previously *
1052 * * * * accessing the AHBN. *
1053 * * * * [0001] NPEA *
1054 * * * * [0010] NPEB *
1055 * * * * [0100] NPEC *
1056 * * * * [1000] Reserved *
1057 * *************************************************************************************
1058 * </pre>
1059 *
1060 * @param *pmsrValue UINT32 [out] - Pointer to return PMSR value. Users need to
1061 * allocate storage for psmrValue.
1062 *
1063 * @return none
1064 *
1065 * @li Reentrant : no
1066 * @li ISR Callable : no
1067 *
1068 **/
1069PUBLIC void
1070ixPerfProfAccBusPmuPMSRGet (
1071UINT32 *pmsrValue);
1072
1073
1074/**
1075 * The APIs below are specifically used for Xcycle module.
1076 **/
1077
1078/**
1079 * @ingroup IxPerfProfAcc
1080 *
1081 * @fn ixPerfProfAccXcycleBaselineRun (
1082 UINT32 *numBaselineCycle)
1083 *
1084 * @brief Perform baseline for Xcycle
1085 *
1086 * @param *numBaselineCycle UINT32 [out] - pointer to baseline value after
1087 * calibration. Calling function are responsible for
1088 * allocating memory space for this pointer.
1089 *
1090 * Global Data :
1091 * - None.
1092 *
1093 * This function MUST be run before the Xcycle tool can be used. This
1094 * function must be run immediately when the OS boots up with no other
1095 * addition programs running.
1096 * Addition note : This API will measure the time needed to perform
1097 * a fix amount of CPU instructions (~ 1 second worth of loops) as a
1098 * highest priority task and with interrupt disabled. The time measured
1099 * is known as the baseline - interpreted as the shortest time
1100 * needed to complete the amount of CPU instructions. The baseline is
1101 * returned as unit of time in 66Mhz clock tick.
1102 *
1103 * @return
1104 * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful run, result is returned
1105 * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to change
1106 * task priority
1107 * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL - failed to
1108 * restore task priority
1109 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility
1110 * is running
1111 * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle
1112 * tool has already started
1113 *
1114 * @li Reentrant : no
1115 * @li ISR Callable : no
1116 *
1117 */
1118PUBLIC IxPerfProfAccStatus
1119ixPerfProfAccXcycleBaselineRun(
1120 UINT32 *numBaselineCycle);
1121
1122/**
1123 * @ingroup IxPerfProfAcc
1124 *
1125 * @fn ixPerfProfAccXcycleStart(
1126 UINT32 numMeasurementsRequested);
1127 *
1128 * @brief Start the measurement
1129 *
1130 * @param numMeasurementsRequested UINT32 [in] - number of measurements
1131 * to perform. Value can be 0 to
1132 * IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS.
1133 * 0 indicate continuous measurement.
1134 *
1135 * Global Data :
1136 * - None.
1137 *
1138 *
1139 * Start the measurements immediately.
1140 * numMeasurementsRequested specifies number of measurements to run.
1141 * If numMeasurementsRequested is set to 0, the measurement will
1142 * be performed continuously until IxPerfProfAccXcycleStop()
1143 * is called.
1144 * It is estimated that 1 measurement takes approximately 1 second during
1145 * low CPU utilization, therefore 128 measurement takes approximately 128 sec.
1146 * When CPU utilization is high, the measurement will take longer.
1147 * This function spawn a task the perform the measurement and returns.
1148 * The measurement may continue even if this function returns.
1149 *
1150 * IMPORTANT: Under heavy CPU utilization, the task spawn by this
1151 * function may starve and fail to respond to stop command. User
1152 * may need to kill the task manually in this case.
1153 *
1154 * There are only IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
1155 * storage available so storing is wrapped around if measurements are
1156 * more than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS.
1157 *
1158 *
1159 * @return
1160 * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful start, a thread is created
1161 * in the background to perform measurement.
1162 * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to set
1163 * task priority
1164 * - IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL - failed to create
1165 * thread to perform measurement.
1166 * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is not available
1167 * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE -
1168 * value is larger than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
1169 * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle tool
1170 * has already started
1171 * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
1172 * running
1173 *
1174 * @li Reentrant : no
1175 * @li ISR Callable : no
1176 *
1177 */
1178PUBLIC IxPerfProfAccStatus
1179ixPerfProfAccXcycleStart (
1180 UINT32 numMeasurementsRequested);
1181
1182/**
1183 * @ingroup IxPerfProfAcc
1184 *
1185 * @fn ixPerfProfAccXcycleStop(void);
1186 *
1187 * @brief Stop the Xcycle measurement
1188 *
1189 * @param None
1190 *
1191 * Global Data :
1192 * - None.
1193 *
1194 * Stop Xcycle measurements immediately. If the measurements have stopped
1195 * or not started, return IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING.
1196 * Note: This function does not stop measurement cold. The measurement thread
1197 * may need a few seconds to complete the last measurement. User needs to use
1198 * ixPerfProfAccXcycleInProgress() to determine if measurement is indeed
1199 * completed.
1200 *
1201 * @return
1202 * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful measurement is stopped
1203 * - IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING - no measurement running
1204 *
1205 * @li Reentrant : no
1206 * @li ISR Callable : no
1207 *
1208 */
1209PUBLIC IxPerfProfAccStatus
1210ixPerfProfAccXcycleStop(void);
1211
1212/**
1213 * @ingroup IxPerfProfAcc
1214 *
1215 * @fn ixPerfProfAccXcycleResultsGet(
1216 IxPerfProfAccXcycleResults *xcycleResult )
1217 *
1218 * @brief Get the results of Xcycle measurement
1219 *
1220 * @param *xcycleResult @ref IxPerfProfAccXcycleResults [out] - Pointer to
1221 * results of last measurements. Calling function are
1222 * responsible for allocating memory space for this pointer.
1223 *
1224 * Global Data :
1225 * - None.
1226 *
1227 * Retrieve the results of last measurement. User should use
1228 * ixPerfProfAccXcycleInProgress() to check if measurement is completed
1229 * before getting the results.
1230 *
1231 * @return
1232 * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful
1233 * - IX_PERFPROF_ACC_STATUS_FAIL - result is not complete.
1234 * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is performed
1235 * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle
1236 * tool is still running
1237 *
1238 * @li Reentrant : no
1239 * @li ISR Callable : no
1240 *
1241 */
1242PUBLIC IxPerfProfAccStatus
1243ixPerfProfAccXcycleResultsGet (
1244 IxPerfProfAccXcycleResults *xcycleResult);
1245
1246/**
1247 * @ingroup IxPerfProfAcc
1248 *
1249 * @fn ixPerfProfAccXcycleInProgress (void)
1250 *
1251 * @brief Check if Xcycle is running
1252 *
1253 * @param None
1254 * Global Data :
1255 * - None.
1256 *
1257 * Check if Xcycle measuring task is running.
1258 *
1259 * @return
York Sun472d5462013-04-01 11:29:11 -07001260 * - true - Xcycle is running
1261 * - false - Xcycle is not running
Wolfgang Denkba94a1b2006-05-30 15:56:48 +02001262 *
1263 * @li Reentrant : no
1264 * @li ISR Callable : no
1265 *
1266 */
1267PUBLIC BOOL
1268ixPerfProfAccXcycleInProgress(void);
1269
1270#ifdef __linux
1271/**
1272 * @ingroup IxPerfProfAcc
1273 *
1274 * @fn ixPerfProfAccXscalePmuTimeSampCreateProcFile
1275 *
1276 * @brief Enables proc file to call module function
1277 *
1278 * @param None
1279 *
1280 * Global Data :
1281 * - None.
1282 *
1283 * This function is declared globally to enable /proc directory system to call
1284 * and execute the function when the registered file is called. This function is not meant to
1285 * be called by the user.
1286 *
1287 * @return
1288 * - Length of data written to file.
1289 *
1290 * @li Reentrant : no
1291 * @li ISR Callable : no
1292 *
1293 */
1294int
1295ixPerfProfAccXscalePmuTimeSampCreateProcFile (char *buf, char **start, off_t offset,
1296 int count, int *eof, void *data);
1297
1298/**
1299 * @ingroup IxPerfProfAcc
1300 *
1301 * @fn ixPerfProfAccXscalePmuEventSampCreateProcFile
1302 *
1303 * @brief Enables proc file to call module function
1304 *
1305 * @param None
1306 *
1307 * Global Data :
1308 * - None.
1309 *
1310 * This function is declared globally to enable /proc directory system to call
1311 * and execute the function when the registered file is called. This function is not meant to
1312 * be called by the user.
1313 *
1314 * @return
1315 * - Length of data written to file.
1316 *
1317 * @li Reentrant : no
1318 * @li ISR Callable : no
1319 *
1320 */
1321int
1322ixPerfProfAccXscalePmuEventSampCreateProcFile (char *buf, char **start, off_t offset,
1323 int count, int *eof, void *data);
1324
1325
1326#endif /* ifdef __linux */
1327
1328#endif /* ndef IXPERFPROFACC_H */
1329
1330/**
1331 *@} defgroup IxPerfProfAcc
1332 */
1333
1334