14#ifndef _PAPI_PERFCTR_PPC64
15#define _PAPI_PERFCTR_PPC64
17#if defined(_POWER5) || defined(_POWER5p)
19#define NUM_COUNTER_MASKS 4
21#define PMC1_SEL_MASK 0xFFFFFFFF00FFFFFFULL
22#define PMC2_SEL_MASK 0xFFFFFFFFFF00FFFFULL
23#define PMC3_SEL_MASK 0xFFFFFFFFFFFF00FFULL
24#define PMC4_SEL_MASK 0xFFFFFFFFFFFFFF00ULL
26#define PMC5_PMC6_FREEZE 0x00000010UL
29#define NUM_COUNTER_MASKS MAX_COUNTERS+1
31#define PMC1_SEL_MASK 0xFFFFF0FFUL
32#define PMC2_SEL_MASK 0xFFFFFFE1UL
33#define PMC3_SEL_MASK 0xFFFFFFFF87FFFFFFULL
34#define PMC4_SEL_MASK 0xFFFFFFFFFC3FFFFFULL
35#define PMC5_SEL_MASK 0xFFFFFFFFFFE1FFFFULL
36#define PMC6_SEL_MASK 0xFFFFFFFFFFFF0FFFULL
37#define PMC7_SEL_MASK 0xFFFFFFFFFFFFF87FULL
38#define PMC8_SEL_MASK 0xFFFFFFFFFFFFFFC3ULL
39#define PMC8a_SEL_MASK 0xFFFDFFFFUL
48#include "libperfctr.h"
54#define PERF_INT_ENABLE 0x0000C000
55#define PMC_OVFL 0x80000000
56#define PERF_KERNEL 0x40000000
57#define PERF_USER 0x20000000
58#define PERF_HYPERVISOR 0x00000001
59#define PERF_CONTROL_MASK 0xFFFFE001
62#define AI_ERROR "No support for a-mode counters after adding an i-mode counter"
63#define VOPEN_ERROR "vperfctr_open() returned NULL, please run perfex -i to verify your perfctr installation"
64#define GOPEN_ERROR "gperfctr_open() returned NULL"
65#define VINFO_ERROR "vperfctr_info() returned < 0"
66#define VCNTRL_ERROR "vperfctr_control() returned < 0"
67#define RCNTRL_ERROR "rvperfctr_control() returned < 0"
68#define GCNTRL_ERROR "gperfctr_control() returned < 0"
69#define FOPEN_ERROR "fopen(%s) returned NULL"
70#define STATE_MAL_ERROR "Error allocating perfctr structures"
71#define MODEL_ERROR "This is not a PowerPC"
72#define EVENT_INFO_FILE_ERROR "Event info file error"
77extern volatile unsigned int lock[];
82static inline unsigned long
85 unsigned long tmp, tmp2;
86 __asm__
volatile (
" li %1,%3\n"
92 " isync\n" "2:":
"=&r" (
tmp ),
"=&r"( tmp2 )
98#define _papi_hwd_lock(locknum) \
99 do { } while (_papi_hwd_trylock((unsigned int *)(&(lock[(locknum)]))) != MUTEX_OPEN)
101#define _papi_hwd_unlock(locknum) \
103 __asm__ volatile("lwsync": : :"memory"); \
104 lock[(locknum)] = MUTEX_OPEN; \
111typedef struct hwd_native
116 unsigned int selector;
125typedef struct ppc64_reg_alloc
136typedef struct ppc64_perfctr_control
148 struct vperfctr_control control;
154typedef struct ppc64_perfctr_context
162#define hwd_pmc_control vperfctr_control
164typedef struct ntv_event
172typedef struct ntv_event_info
180typedef struct event_group
190typedef struct ntv_event_group_info
char events[MAX_EVENTS][BUFSIZ]
Return codes and api definitions.
ppc64_perfctr_context_t hwd_context_t
ntv_event_group_info_t * perfctr_get_native_group_info(void)
ppc64_perfctr_control_t hwd_control_state_t
int setup_ppc64_native_table(void)
ntv_event_info_t * perfctr_get_native_evt_info(void)
volatile unsigned int lock[]
ppc64_reg_alloc_t hwd_reg_alloc_t
static unsigned long _papi_hwd_trylock(unsigned int *lock)
struct vperfctr * perfctr
unsigned char master_selector
struct rvperfctr * rvperfctr
hwd_register_t allocated_registers