PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_crayx2.c File Reference
Include dependency graph for pfmlib_crayx2.c:

Go to the source code of this file.

Macros

#define CRAYX2_NO_REDUNDANT   0 /* if>0 an error if chip:ctr:ev repeated */
 

Enumerations

enum  counter_use_t { CTR_REDUNDANT = -2 , CTR_CONFLICT = -1 , CTR_OK = 0 }
 

Functions

static int pfm_crayx2_get_event_code (unsigned int i, unsigned int cnt, int *code)
 
static char * pfm_crayx2_get_event_name (unsigned int i)
 
static void pfm_crayx2_get_event_counters (unsigned int j, pfmlib_regmask_t *counters)
 
static int pfm_crayx2_chip_use (uint32_t used[], unsigned int n)
 
static counter_use_t pfm_crayx2_counter_use (unsigned int ctr, unsigned int event, uint32_t *used, uint64_t *evmsk)
 
static int pfm_crayx2_dispatch_events (pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
 
static int pfm_crayx2_pmu_detect (void)
 
static void pfm_crayx2_get_impl_pmcs (pfmlib_regmask_t *impl_pmcs)
 
static void pfm_crayx2_get_impl_pmds (pfmlib_regmask_t *impl_pmds)
 
static void pfm_crayx2_get_impl_counters (pfmlib_regmask_t *impl_counters)
 
static void pfm_crayx2_get_hw_counter_width (unsigned int *width)
 
static int pfm_crayx2_get_event_desc (unsigned int ev, char **str)
 
static unsigned int pfm_crayx2_get_num_event_masks (unsigned int ev)
 
static char * pfm_crayx2_get_event_mask_name (unsigned int ev, unsigned int midx)
 
static int pfm_crayx2_get_event_mask_code (unsigned int ev, unsigned int midx, unsigned int *code)
 
static int pfm_crayx2_get_event_mask_desc (unsigned int ev, unsigned int midx, char **str)
 
static int pfm_crayx2_get_cycle_event (pfmlib_event_t *e)
 
static int pfm_crayx2_get_inst_retired (pfmlib_event_t *e)
 

Variables

pfm_pmu_support_t crayx2_support
 

Macro Definition Documentation

◆ CRAYX2_NO_REDUNDANT

#define CRAYX2_NO_REDUNDANT   0 /* if>0 an error if chip:ctr:ev repeated */

Definition at line 34 of file pfmlib_crayx2.c.

Enumeration Type Documentation

◆ counter_use_t

Enumerator
CTR_REDUNDANT 
CTR_CONFLICT 
CTR_OK 

Definition at line 36 of file pfmlib_crayx2.c.

36 {
37 CTR_REDUNDANT = -2, /* event on counter repeated */
38 CTR_CONFLICT = -1, /* event on counter not the same as previous */
39 CTR_OK = 0 /* event on counter open */
counter_use_t
Definition: pfmlib_crayx2.c:36
@ CTR_CONFLICT
Definition: pfmlib_crayx2.c:38
@ CTR_REDUNDANT
Definition: pfmlib_crayx2.c:37
@ CTR_OK
Definition: pfmlib_crayx2.c:39

Function Documentation

◆ pfm_crayx2_chip_use()

static int pfm_crayx2_chip_use ( uint32_t  used[],
unsigned int  n 
)
static

Definition at line 85 of file pfmlib_crayx2.c.

86{
87 int i, u = 0;
88
89 for (i=0; i<n; i++) {
90 u += pfmlib_popcnt (used[i]);
91 }
92 DPRINT ("number of counters used on chip %d\n", u);
93
94 return u;
95}
int i
#define pfmlib_popcnt
#define DPRINT(fmt, a...)
Definition: pfmlib_priv.h:90
Here is the caller graph for this function:

◆ pfm_crayx2_counter_use()

static counter_use_t pfm_crayx2_counter_use ( unsigned int  ctr,
unsigned int  event,
uint32_t *  used,
uint64_t *  evmsk 
)
static

Definition at line 98 of file pfmlib_crayx2.c.

99{
100 counter_use_t ret = CTR_OK;
101
102 if (*used & (1 << ctr)) {
103 if (event == PFM_EVENT_GET (*evmsk, ctr)) {
104 ret = CTR_REDUNDANT;
105 } else {
106 ret = CTR_CONFLICT;
107 }
108 } else {
109 *evmsk |= PFM_EVENT_SET (ctr, event);
110 *used |= (1 << ctr);
111 }
112 return ret;
113}
Here is the caller graph for this function:

◆ pfm_crayx2_dispatch_events()

static int pfm_crayx2_dispatch_events ( pfmlib_input_param_t inp,
void *  model_in,
pfmlib_output_param_t outp,
void *  model_out 
)
static

Definition at line 116 of file pfmlib_crayx2.c.

117{
118 unsigned int i, npmcs = 0, npmds = 0, base_pmc = 0;
119 uint32_t Pused[PME_CRAYX2_CPU_CHIPS];
120 uint32_t Cused[PME_CRAYX2_CACHE_CHIPS];
121 uint32_t Mused[PME_CRAYX2_MEMORY_CHIPS];
122 uint64_t Pevents = 0, Cevents = 0, Mevents = 0;
123
124 DPRINT ("dispatching event info to the PMCs and PMDs\n");
125
126 /* NOTES:
127 * Multiplexing is not supported on X2.
128 * The priviledge level is ignored for the C and M chips.
129 * The priviledge level is ignored per event.
130 */
131
132 if (PFMLIB_DEBUG ( )) {
133 int j;
134 DPRINT ("input: pfp_event_count %d pfp_dfl_plm %#x pfp_flags %#x\n", inp->pfp_event_count, inp->pfp_dfl_plm, inp->pfp_flags);
135 for (i=0; i<inp->pfp_event_count; i++) {
136 DPRINT (" %3d: event %3d plm %#3x flags %#8lx num_masks %d\n", i, inp->pfp_events[i].event, inp->pfp_events[i].plm, inp->pfp_events[i].flags, inp->pfp_events[i].num_masks);
137 for (j=0; j<inp->pfp_events[i].num_masks; j++) {
138 DPRINT (" unit-mask-%2d: %d\n", j, inp->pfp_events[i].unit_masks[j]);
139 }
140 }
141 }
142
143 /* Better have at least one event specified and not exceed limit.
144 */
145 if (inp->pfp_event_count == 0) {
146 DPRINT ("return: event count is 0\n");
147 return PFMLIB_ERR_INVAL;
148 } else if (inp->pfp_event_count > PMU_CRAYX2_NUM_COUNTERS) {
149 DPRINT ("return: event count exceeds max %d\n", PMU_CRAYX2_NUM_COUNTERS);
150 return PFMLIB_ERR_TOOMANY;
151 }
152
153 memset (Pused, 0, sizeof(Pused));
154 memset (Cused, 0, sizeof(Cused));
155 memset (Mused, 0, sizeof(Mused));
156
157 /* Loop through the input parameters describing the events.
158 */
159 for (i=0; i<inp->pfp_event_count; i++) {
160 unsigned int code, chip, ctr, ev, chipno;
161 counter_use_t ret;
162
163 /* Acquire details describing this event code:
164 * o which substrate/chip it is on
165 * o which counter on the chip
166 * o which event on the counter
167 */
168 code = inp->pfp_events[i].event;
169 chip = crayx2_pe[code].pme_chip;
170 ctr = crayx2_pe[code].pme_ctr;
171 ev = crayx2_pe[code].pme_event;
172 chipno = crayx2_pe[code].pme_chipno;
173
174 DPRINT ("%3d: code %3d chip %1d ctr %2d ev %1d chipno %2d\n", code, i, chip, ctr, ev, chipno);
175
176 /* These priviledge levels are not recognized.
177 */
178 if (inp->pfp_events[i].plm != 0) {
179 DPRINT ("%3d: priviledge level %#x per event not allowed\n", i, inp->pfp_events[i].plm);
180 return PFMLIB_ERR_INVAL;
181 }
182
183 /* No masks exist.
184 */
185 if (inp->pfp_events[i].num_masks > 0) {
186 DPRINT ("too many masks for event\n");
187 return PFMLIB_ERR_TOOMANY;
188 }
189
190 /* The event code. Set-up the event selection mask for
191 * the PMC of the respective chip. Check if more than
192 * one event on the same counter is selected.
193 */
194 if (chip == PME_CRAYX2_CHIP_CPU) {
195 ret = pfm_crayx2_counter_use (ctr, ev, &Pused[chipno], &Pevents);
196 } else if (chip == PME_CRAYX2_CHIP_CACHE) {
197 ret = pfm_crayx2_counter_use (ctr, ev, &Cused[chipno], &Cevents);
198 } else if (chip == PME_CRAYX2_CHIP_MEMORY) {
199 ret = pfm_crayx2_counter_use (ctr, ev, &Mused[chipno], &Mevents);
200 } else {
201 DPRINT ("return: invalid chip\n");
202 return PFMLIB_ERR_INVAL;
203 }
204
205 /* Each chip's counter can only count one event.
206 */
207 if (ret == CTR_CONFLICT) {
208 DPRINT ("return: ctr conflict\n");
210 } else if (ret == CTR_REDUNDANT) {
211#if (CRAYX2_NO_REDUNDANT != 0)
212 DPRINT ("return: ctr redundant\n");
213 return PFMLIB_ERR_EVTMANY;
214#else
215 DPRINT ("warning: ctr redundant\n");
216#endif /* CRAYX2_NO_REDUNDANT */
217 }
218
219 /* Set up the output PMDs.
220 */
221 outp->pfp_pmds[npmds].reg_num = crayx2_pe[code].pme_base + ctr + chipno*crayx2_pe[code].pme_nctrs;
222 outp->pfp_pmds[npmds].reg_addr = 0;
223 outp->pfp_pmds[npmds].reg_alt_addr = 0;
224 outp->pfp_pmds[npmds].reg_value = 0;
225 npmds++;
226 }
227 outp->pfp_pmd_count = npmds;
228
229 if (PFMLIB_DEBUG ( )) {
230 DPRINT ("P event mask %#16lx\n", Pevents);
231 DPRINT ("C event mask %#16lx\n", Cevents);
232 DPRINT ("M event mask %#16lx\n", Mevents);
233 DPRINT ("PMDs: pmd_count %d\n", outp->pfp_pmd_count);
234 for (i=0; i<outp->pfp_pmd_count; i++) {
235 DPRINT (" %3d: reg_value %3lld reg_num %3d reg_addr %#16llx\n", i, outp->pfp_pmds[i].reg_value, outp->pfp_pmds[i].reg_num, outp->pfp_pmds[i].reg_addr);
236 }
237 }
238
239 /* Set up the PMC basics for the chips that will be doing
240 * some counting.
241 */
242 if (pfm_crayx2_chip_use (Pused, PME_CRAYX2_CPU_CHIPS) > 0) {
243 uint64_t Pctrl = PFM_CPU_START;
244 uint64_t Pen = PFM_ENABLE_RW;
245
246 if (inp->pfp_dfl_plm & (PFM_PLM0 | PFM_PLM1)) {
247 Pen |= PFM_ENABLE_KERNEL;
248 }
249 if (inp->pfp_dfl_plm & PFM_PLM2) {
250 Pen |= PFM_ENABLE_EXL;
251 }
252 if (inp->pfp_dfl_plm & PFM_PLM3) {
253 Pen |= PFM_ENABLE_USER;
254 }
255
256 /* First of three CPU PMC registers.
257 */
258 base_pmc = PMU_CRAYX2_CPU_PMC_BASE;
259
260 outp->pfp_pmcs[npmcs].reg_value = Pctrl;
261 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_CONTROL;
262 outp->pfp_pmcs[npmcs].reg_addr = 0;
263 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
264 npmcs++;
265
266 outp->pfp_pmcs[npmcs].reg_value = Pevents;
267 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_EVENTS;
268 outp->pfp_pmcs[npmcs].reg_addr = 0;
269 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
270 npmcs++;
271
272 outp->pfp_pmcs[npmcs].reg_value = Pen;
273 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_ENABLE;
274 outp->pfp_pmcs[npmcs].reg_addr = 0;
275 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
276 npmcs++;
277 }
279 uint64_t Cctrl = PFM_CACHE_START;
280 uint64_t Cen = PFM_ENABLE_RW; /* domains N/A */
281
282 /* Second of three Cache PMC registers.
283 */
284 base_pmc = PMU_CRAYX2_CACHE_PMC_BASE;
285
286 outp->pfp_pmcs[npmcs].reg_value = Cctrl;
287 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_CONTROL;
288 outp->pfp_pmcs[npmcs].reg_addr = 0;
289 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
290 npmcs++;
291
292 outp->pfp_pmcs[npmcs].reg_value = Cevents;
293 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_EVENTS;
294 outp->pfp_pmcs[npmcs].reg_addr = 0;
295 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
296 npmcs++;
297
298 outp->pfp_pmcs[npmcs].reg_value = Cen;
299 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_ENABLE;
300 outp->pfp_pmcs[npmcs].reg_addr = 0;
301 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
302 npmcs++;
303 }
305 uint64_t Mctrl = PFM_MEM_START;
306 uint64_t Men = PFM_ENABLE_RW; /* domains N/A */
307
308 /* Third of three Memory PMC registers.
309 */
311
312 outp->pfp_pmcs[npmcs].reg_value = Mctrl;
313 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_CONTROL;
314 outp->pfp_pmcs[npmcs].reg_addr = 0;
315 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
316 npmcs++;
317
318 outp->pfp_pmcs[npmcs].reg_value = Mevents;
319 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_EVENTS;
320 outp->pfp_pmcs[npmcs].reg_addr = 0;
321 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
322 npmcs++;
323
324 outp->pfp_pmcs[npmcs].reg_value = Men;
325 outp->pfp_pmcs[npmcs].reg_num = base_pmc + PMC_ENABLE;
326 outp->pfp_pmcs[npmcs].reg_addr = 0;
327 outp->pfp_pmcs[npmcs].reg_alt_addr = 0;
328 npmcs++;
329 }
330 outp->pfp_pmc_count = npmcs;
331
332 if (PFMLIB_DEBUG ( )) {
333 DPRINT ("PMCs: pmc_count %d\n", outp->pfp_pmc_count);
334 for (i=0; i<outp->pfp_pmc_count; i++) {
335 DPRINT (" %3d: reg_value %#16llx reg_num %3d reg_addr %#16llx\n", i, outp->pfp_pmcs[i].reg_value, outp->pfp_pmcs[i].reg_num, outp->pfp_pmcs[i].reg_addr);
336 }
337 }
338 return PFMLIB_SUCCESS;
339}
static pme_crayx2_entry_t crayx2_pe[]
Definition: crayx2_events.h:40
#define PFM_PLM2
Definition: pfmlib.h:52
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
#define PFM_PLM3
Definition: pfmlib.h:53
#define PFMLIB_ERR_EVTINCOMP
Definition: pfmlib.h:294
#define PFMLIB_ERR_INVAL
Definition: pfmlib.h:285
#define PFMLIB_ERR_TOOMANY
Definition: pfmlib.h:295
#define PFM_PLM0
Definition: pfmlib.h:50
#define PFM_PLM1
Definition: pfmlib.h:51
#define PFMLIB_ERR_EVTMANY
Definition: pfmlib.h:290
static counter_use_t pfm_crayx2_counter_use(unsigned int ctr, unsigned int event, uint32_t *used, uint64_t *evmsk)
Definition: pfmlib_crayx2.c:98
static int pfm_crayx2_chip_use(uint32_t used[], unsigned int n)
Definition: pfmlib_crayx2.c:85
#define PMU_CRAYX2_NUM_COUNTERS
#define PMU_CRAYX2_CPU_PMC_BASE
Definition: pfmlib_crayx2.h:82
#define PMU_CRAYX2_CACHE_PMC_BASE
Definition: pfmlib_crayx2.h:83
#define PMU_CRAYX2_MEMORY_PMC_BASE
Definition: pfmlib_crayx2.h:84
#define PME_CRAYX2_CHIP_MEMORY
#define PME_CRAYX2_CACHE_CHIPS
#define PME_CRAYX2_CPU_CHIPS
#define PME_CRAYX2_MEMORY_CHIPS
#define PME_CRAYX2_CHIP_CPU
#define PME_CRAYX2_CHIP_CACHE
#define PFMLIB_DEBUG()
Definition: pfmlib_priv.h:76
unsigned int num_masks
Definition: pfmlib.h:90
unsigned long flags
Definition: pfmlib.h:88
unsigned int plm
Definition: pfmlib.h:87
unsigned int unit_masks[PFMLIB_MAX_MASKS_PER_EVENT]
Definition: pfmlib.h:89
unsigned int event
Definition: pfmlib.h:86
unsigned int pfp_dfl_plm
Definition: pfmlib.h:110
unsigned int pfp_flags
Definition: pfmlib.h:111
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:113
unsigned int pfp_event_count
Definition: pfmlib.h:109
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:130
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:129
unsigned int pfp_pmc_count
Definition: pfmlib.h:127
unsigned int pfp_pmd_count
Definition: pfmlib.h:128
unsigned long long reg_value
Definition: pfmlib.h:98
unsigned int reg_num
Definition: pfmlib.h:100
unsigned long reg_alt_addr
Definition: pfmlib.h:102
unsigned long long reg_addr
Definition: pfmlib.h:99
unsigned int pme_ctr
unsigned int pme_chip
unsigned int pme_event
unsigned int pme_base
unsigned int pme_chipno
unsigned int pme_nctrs
Here is the call graph for this function:

◆ pfm_crayx2_get_cycle_event()

static int pfm_crayx2_get_cycle_event ( pfmlib_event_t e)
static

Definition at line 462 of file pfmlib_crayx2.c.

463{
465 DPRINT ("return: event code for cycles %#x\n", e->event);
466
467 return PFMLIB_SUCCESS;
468}
#define PME_CRAYX2_CYCLES

◆ pfm_crayx2_get_event_code()

static int pfm_crayx2_get_event_code ( unsigned int  i,
unsigned int  cnt,
int code 
)
static

Definition at line 43 of file pfmlib_crayx2.c.

44{
45 if (cnt != PFMLIB_CNT_FIRST && cnt > crayx2_support.num_cnt) {
46 DPRINT ("return: count %d exceeded #counters\n", cnt);
47 return PFMLIB_ERR_INVAL;
48 } else if (i >= crayx2_support.pme_count) {
49 DPRINT ("return: event index %d exceeded #events\n", i);
50 return PFMLIB_ERR_INVAL;
51 }
52 *code = crayx2_pe[i].pme_code;
53 DPRINT ("return: event code is %#x\n", *code);
54
55 return PFMLIB_SUCCESS;
56}
pfm_pmu_support_t crayx2_support
#define PFMLIB_CNT_FIRST
Definition: pfmlib_priv.h:62
unsigned int num_cnt
Definition: pfmlib_priv.h:38
unsigned int pme_count
Definition: pfmlib_priv.h:35
unsigned int pme_code

◆ pfm_crayx2_get_event_counters()

static void pfm_crayx2_get_event_counters ( unsigned int  j,
pfmlib_regmask_t counters 
)
static

Definition at line 71 of file pfmlib_crayx2.c.

72{
73 unsigned int i;
74
75 memset (counters, 0, sizeof (*counters));
76
77 DPRINT ("event counters for %d counters\n", PMU_CRAYX2_NUM_COUNTERS);
78 for (i=0; i<PMU_CRAYX2_NUM_COUNTERS; i++) {
79 pfm_regmask_set (counters, i);
80 }
81 return;
82}
static int pfm_regmask_set(pfmlib_regmask_t *h, unsigned int b)
Definition: pfmlib.h:321
Here is the call graph for this function:

◆ pfm_crayx2_get_event_desc()

static int pfm_crayx2_get_event_desc ( unsigned int  ev,
char **  str 
)
static

Definition at line 417 of file pfmlib_crayx2.c.

418{
419 const char *s = crayx2_pe[ev].pme_desc;
420
421 *str = (s == NULL ? NULL : strdup (s));
422 DPRINT ("return: event description is '%s'\n", (s == NULL ? "" : s));
423
424 return PFMLIB_SUCCESS;
425}
double s
Definition: byte_profile.c:36
const char * pme_desc

◆ pfm_crayx2_get_event_mask_code()

static int pfm_crayx2_get_event_mask_code ( unsigned int  ev,
unsigned int  midx,
unsigned int code 
)
static

Definition at line 442 of file pfmlib_crayx2.c.

443{
444 *code = crayx2_pe[ev].pme_umasks[midx].pme_ucode;
445 DPRINT ("return: event mask code is %#x\n", *code);
446
447 return PFMLIB_SUCCESS;
448}
pme_crayx2_umask_t pme_umasks[PFMLIB_CRAYX2_MAX_UMASK]

◆ pfm_crayx2_get_event_mask_desc()

static int pfm_crayx2_get_event_mask_desc ( unsigned int  ev,
unsigned int  midx,
char **  str 
)
static

Definition at line 451 of file pfmlib_crayx2.c.

452{
453 const char *s = crayx2_pe[ev].pme_umasks[midx].pme_udesc;
454
455 *str = (s == NULL ? NULL : strdup (s));
456 DPRINT ("return: event mask description is '%s'\n", (s == NULL ? "" : s));
457
458 return PFMLIB_SUCCESS;
459}

◆ pfm_crayx2_get_event_mask_name()

static char * pfm_crayx2_get_event_mask_name ( unsigned int  ev,
unsigned int  midx 
)
static

Definition at line 435 of file pfmlib_crayx2.c.

436{
437 DPRINT ("return: event mask name is '%s'\n", crayx2_pe[ev].pme_umasks[midx].pme_uname);
438 return (char *) crayx2_pe[ev].pme_umasks[midx].pme_uname;
439}

◆ pfm_crayx2_get_event_name()

static char * pfm_crayx2_get_event_name ( unsigned int  i)
static

Definition at line 59 of file pfmlib_crayx2.c.

60{
61 if (i >= crayx2_support.pme_count) {
62 DPRINT ("return: event index %d exceeded #events\n", i);
63 return NULL;
64 }
65 DPRINT ("return: event name '%s'\n", crayx2_pe[i].pme_name);
66
67 return (char *) crayx2_pe[i].pme_name;
68}
const char * pme_name

◆ pfm_crayx2_get_hw_counter_width()

static void pfm_crayx2_get_hw_counter_width ( unsigned int width)
static

Definition at line 408 of file pfmlib_crayx2.c.

409{
411 DPRINT ("return: width set to %d\n", *width);
412
413 return;
414}
#define PMU_CRAYX2_COUNTER_WIDTH

◆ pfm_crayx2_get_impl_counters()

static void pfm_crayx2_get_impl_counters ( pfmlib_regmask_t impl_counters)
static

Definition at line 395 of file pfmlib_crayx2.c.

396{
397 unsigned int i;
398
399 DPRINT ("entered with NUM_COUNTERS %d\n", PMU_CRAYX2_NUM_COUNTERS);
400 for (i=0; i<PMU_CRAYX2_NUM_COUNTERS; i++) {
401 pfm_regmask_set (impl_counters, i);
402 }
403
404 return;
405}
Here is the call graph for this function:

◆ pfm_crayx2_get_impl_pmcs()

static void pfm_crayx2_get_impl_pmcs ( pfmlib_regmask_t impl_pmcs)
static

Definition at line 369 of file pfmlib_crayx2.c.

370{
371 unsigned int i;
372
373 DPRINT ("entered with PMC_COUNT %d\n", PMU_CRAYX2_PMC_COUNT);
374 for (i=0; i<PMU_CRAYX2_PMC_COUNT; i++) {
375 pfm_regmask_set (impl_pmcs, i);
376 }
377
378 return;
379}
#define PMU_CRAYX2_PMC_COUNT
Here is the call graph for this function:

◆ pfm_crayx2_get_impl_pmds()

static void pfm_crayx2_get_impl_pmds ( pfmlib_regmask_t impl_pmds)
static

Definition at line 382 of file pfmlib_crayx2.c.

383{
384 unsigned int i;
385
386 DPRINT ("entered with PMD_COUNT %d\n", PMU_CRAYX2_PMD_COUNT);
387 for (i=0; i<PMU_CRAYX2_PMD_COUNT; i++) {
388 pfm_regmask_set (impl_pmds, i);
389 }
390
391 return;
392}
#define PMU_CRAYX2_PMD_COUNT
Here is the call graph for this function:

◆ pfm_crayx2_get_inst_retired()

static int pfm_crayx2_get_inst_retired ( pfmlib_event_t e)
static

Definition at line 471 of file pfmlib_crayx2.c.

472{
474 DPRINT ("return: event code for retired instr %#x\n", e->event);
475
476 return PFMLIB_SUCCESS;
477}
#define PME_CRAYX2_INSTR_GRADUATED

◆ pfm_crayx2_get_num_event_masks()

static unsigned int pfm_crayx2_get_num_event_masks ( unsigned int  ev)
static

Definition at line 428 of file pfmlib_crayx2.c.

429{
430 DPRINT ("return: #event masks is %d\n", crayx2_pe[ev].pme_numasks);
431 return crayx2_pe[ev].pme_numasks;
432}
unsigned int pme_numasks

◆ pfm_crayx2_pmu_detect()

static int pfm_crayx2_pmu_detect ( void  )
static

Definition at line 342 of file pfmlib_crayx2.c.

343{
344 char buffer[128];
345 int ret;
346
347 DPRINT ("detect the PMU attributes\n");
348
349 ret = __pfm_getcpuinfo_attr ("vendor_id", buffer, sizeof(buffer));
350
351 if (ret != 0 || strcasecmp (buffer, "Cray") != 0) {
352 DPRINT ("return: no 'Cray' vendor_id\n");
353 return PFMLIB_ERR_NOTSUPP;
354 }
355
356 ret = __pfm_getcpuinfo_attr ("type", buffer, sizeof(buffer));
357
358 if (ret != 0 || strcasecmp (buffer, "craynv2") != 0) {
359 DPRINT ("return: no 'craynv2' type\n");
360 return PFMLIB_ERR_NOTSUPP;
361 }
362
363 DPRINT ("Cray X2 nv2 found\n");
364
365 return PFMLIB_SUCCESS;
366}
#define PFMLIB_ERR_NOTSUPP
Definition: pfmlib.h:284
int __pfm_getcpuinfo_attr(const char *attr, char *ret_buf, size_t maxlen)
Here is the call graph for this function:

Variable Documentation

◆ crayx2_support

pfm_pmu_support_t crayx2_support
Initial value:
= {
.pmu_name = PMU_CRAYX2_NAME,
.pmu_type = PFMLIB_CRAYX2_PMU,
.pme_count = PME_CRAYX2_EVENT_COUNT,
.pmc_count = PMU_CRAYX2_PMC_COUNT,
.pmd_count = PMU_CRAYX2_PMD_COUNT,
.get_event_code = pfm_crayx2_get_event_code,
.get_event_name = pfm_crayx2_get_event_name,
.get_event_counters = pfm_crayx2_get_event_counters,
.dispatch_events = pfm_crayx2_dispatch_events,
.pmu_detect = pfm_crayx2_pmu_detect,
.get_impl_pmcs = pfm_crayx2_get_impl_pmcs,
.get_impl_pmds = pfm_crayx2_get_impl_pmds,
.get_impl_counters = pfm_crayx2_get_impl_counters,
.get_hw_counter_width = pfm_crayx2_get_hw_counter_width,
.get_event_desc = pfm_crayx2_get_event_desc,
.get_num_event_masks = pfm_crayx2_get_num_event_masks,
.get_event_mask_name = pfm_crayx2_get_event_mask_name,
.get_event_mask_code = pfm_crayx2_get_event_mask_code,
.get_event_mask_desc = pfm_crayx2_get_event_mask_desc,
.get_cycle_event = pfm_crayx2_get_cycle_event,
.get_inst_retired_event = pfm_crayx2_get_inst_retired
}
#define PME_CRAYX2_EVENT_COUNT
#define PFMLIB_CRAYX2_PMU
Definition: pfmlib.h:259
static void pfm_crayx2_get_event_counters(unsigned int j, pfmlib_regmask_t *counters)
Definition: pfmlib_crayx2.c:71
static void pfm_crayx2_get_hw_counter_width(unsigned int *width)
static int pfm_crayx2_get_event_desc(unsigned int ev, char **str)
static int pfm_crayx2_pmu_detect(void)
static int pfm_crayx2_get_cycle_event(pfmlib_event_t *e)
static char * pfm_crayx2_get_event_name(unsigned int i)
Definition: pfmlib_crayx2.c:59
static int pfm_crayx2_get_event_mask_code(unsigned int ev, unsigned int midx, unsigned int *code)
static int pfm_crayx2_get_event_code(unsigned int i, unsigned int cnt, int *code)
Definition: pfmlib_crayx2.c:43
static int pfm_crayx2_get_event_mask_desc(unsigned int ev, unsigned int midx, char **str)
static unsigned int pfm_crayx2_get_num_event_masks(unsigned int ev)
static int pfm_crayx2_get_inst_retired(pfmlib_event_t *e)
static void pfm_crayx2_get_impl_pmds(pfmlib_regmask_t *impl_pmds)
static void pfm_crayx2_get_impl_counters(pfmlib_regmask_t *impl_counters)
static void pfm_crayx2_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs)
static int pfm_crayx2_dispatch_events(pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
static char * pfm_crayx2_get_event_mask_name(unsigned int ev, unsigned int midx)
#define PMU_CRAYX2_NAME

Definition at line 482 of file pfmlib_crayx2.c.