34 #define PFMLIB_VERSION ( 3 << 16 | 9 ) 35 #define PFMLIB_MAJ_VERSION( v ) ( ( v ) >> 16 ) 36 #define PFMLIB_MIN_VERSION( v ) ( (v)&0xffff ) 41 #define PFMLIB_MAX_PMCS 512 42 #define PFMLIB_MAX_PMDS 512 63 #if PFMLIB_MAX_PMCS > PFMLIB_MAX_PMDS 64 #define PFMLIB_REG_MAX PFMLIB_MAX_PMCS 66 #define PFMLIB_REG_MAX PFMLIB_MAX_PMDS 70 #define __PFMLIB_REG_BV_BITS ( sizeof( pfmlib_regmask_bits_t ) << 3 ) 71 #define PFMLIB_BVSIZE( x ) ( ( ( x ) + (__PFMLIB_REG_BV_BITS)-1 ) / __PFMLIB_REG_BV_BITS ) 72 #define PFMLIB_REG_BV PFMLIB_BVSIZE( PFMLIB_REG_MAX ) 79 #define PFMLIB_MAX_MASKS_PER_EVENT 48 90 unsigned long reserved[2];
114 unsigned long reserved[6];
120 #define PFMLIB_PFP_SYSTEMWIDE 0x1 130 unsigned long reserved[7];
137 unsigned int pfm_debug : 1;
138 unsigned int pfm_verbose : 1;
139 unsigned int pfm_reserved : 30;
165 extern pfm_err_t
pfm_find_event(
const char* str,
unsigned int* idx );
169 extern pfm_err_t
pfm_find_event_mask(
unsigned int event_idx,
const char* str,
unsigned int* mask_idx );
205 #define PFMLIB_NO_PMU -1 206 #define PFMLIB_UNKNOWN_PMU 0 207 #define PFMLIB_GEN_IA64_PMU 1 208 #define PFMLIB_ITANIUM_PMU 2 209 #define PFMLIB_ITANIUM2_PMU 3 210 #define PFMLIB_MONTECITO_PMU 4 211 #define PFMLIB_AMD64_PMU 16 212 #define PFMLIB_GEN_IA32_PMU 63 213 #define PFMLIB_I386_P6_PMU 32 214 #define PFMLIB_PENTIUM4_PMU 33 215 #define PFMLIB_COREDUO_PMU 34 216 #define PFMLIB_I386_PM_PMU 35 217 #define PFMLIB_CORE_PMU 36 218 #define PFMLIB_INTEL_CORE_PMU 36 219 #define PFMLIB_INTEL_PPRO_PMU 37 220 #define PFMLIB_INTEL_PII_PMU 38 221 #define PFMLIB_INTEL_ATOM_PMU 39 222 #define PFMLIB_INTEL_NHM_PMU 40 223 #define PFMLIB_INTEL_WSM_PMU 41 225 #define PFMLIB_MIPS_20KC_PMU 64 226 #define PFMLIB_MIPS_24K_PMU 65 227 #define PFMLIB_MIPS_25KF_PMU 66 228 #define PFMLIB_MIPS_34K_PMU 67 229 #define PFMLIB_MIPS_5KC_PMU 68 230 #define PFMLIB_MIPS_74K_PMU 69 231 #define PFMLIB_MIPS_R10000_PMU 70 232 #define PFMLIB_MIPS_R12000_PMU 71 233 #define PFMLIB_MIPS_RM7000_PMU 72 234 #define PFMLIB_MIPS_RM9000_PMU 73 235 #define PFMLIB_MIPS_SB1_PMU 74 236 #define PFMLIB_MIPS_VR5432_PMU 75 237 #define PFMLIB_MIPS_VR5500_PMU 76 238 #define PFMLIB_MIPS_ICE9A_PMU 77 239 #define PFMLIB_MIPS_ICE9B_PMU 78 241 #define PFMLIB_POWERPC_PMU 90 243 #define PFMLIB_CRAYX2_PMU 96 245 #define PFMLIB_CELL_PMU 100 247 #define PFMLIB_PPC970_PMU 110 248 #define PFMLIB_PPC970MP_PMU 111 249 #define PFMLIB_POWER3_PMU 112 250 #define PFMLIB_POWER4_PMU 113 251 #define PFMLIB_POWER5_PMU 114 252 #define PFMLIB_POWER5p_PMU 115 253 #define PFMLIB_POWER6_PMU 116 254 #define PFMLIB_POWER7_PMU 117 256 #define PFMLIB_SPARC_ULTRA12_PMU 130 257 #define PFMLIB_SPARC_ULTRA3_PMU 131 258 #define PFMLIB_SPARC_ULTRA3I_PMU 132 259 #define PFMLIB_SPARC_ULTRA3PLUS_PMU 133 260 #define PFMLIB_SPARC_ULTRA4PLUS_PMU 134 261 #define PFMLIB_SPARC_NIAGARA1_PMU 135 262 #define PFMLIB_SPARC_NIAGARA2_PMU 136 267 #define PFMLIB_SUCCESS 0 268 #define PFMLIB_ERR_NOTSUPP -1 269 #define PFMLIB_ERR_INVAL -2 270 #define PFMLIB_ERR_NOINIT -3 271 #define PFMLIB_ERR_NOTFOUND -4 272 #define PFMLIB_ERR_NOASSIGN -5 273 #define PFMLIB_ERR_FULL -6 274 #define PFMLIB_ERR_EVTMANY -7 275 #define PFMLIB_ERR_MAGIC -8 276 #define PFMLIB_ERR_FEATCOMB -9 277 #define PFMLIB_ERR_EVTSET -10 278 #define PFMLIB_ERR_EVTINCOMP -11 279 #define PFMLIB_ERR_TOOMANY -12 281 #define PFMLIB_ERR_IRRTOOBIG -13 282 #define PFMLIB_ERR_IRREMPTY -14 283 #define PFMLIB_ERR_IRRINVAL -15 284 #define PFMLIB_ERR_IRRTOOMANY -16 285 #define PFMLIB_ERR_DRRINVAL -17 286 #define PFMLIB_ERR_DRRTOOMANY -18 287 #define PFMLIB_ERR_BADHOST -19 288 #define PFMLIB_ERR_IRRALIGN -20 289 #define PFMLIB_ERR_IRRFLAGS -21 290 #define PFMLIB_ERR_UMASK -22 291 #define PFMLIB_ERR_NOMEM -23 293 #define __PFMLIB_REGMASK_EL( g ) ( ( g ) / __PFMLIB_REG_BV_BITS ) 294 #define __PFMLIB_REGMASK_MASK( g ) ( ( (pfmlib_regmask_bits_t)1 ) << ( ( g ) % __PFMLIB_REG_BV_BITS ) ) 320 static inline int pfm_regmask_weight(
pfmlib_regmask_t* h,
unsigned int* w )
323 unsigned int weight = 0;
328 weight += (
unsigned int)pfmlib_popcnt( h->
bits[pos] );
338 if ( h1 == NULL || h2 == NULL )
return 0;
341 if ( h1->
bits[pos] != h2->
bits[pos] )
return 0;
pfm_err_t pfm_get_cycle_event(pfmlib_event_t *e)
pfm_err_t pfm_get_pmu_type(int *type)
char * pfm_strerror(int code)
pfm_err_t pfm_get_event_mask_code(unsigned int idx, unsigned int mask_idx, unsigned int *code)
unsigned long reg_alt_addr
pfm_err_t pfm_get_hw_counter_width(unsigned int *width)
pfm_err_t pfm_get_event_mask_description(unsigned int event_idx, unsigned int mask_idx, char **desc)
#define PFMLIB_MAX_MASKS_PER_EVENT
#define __PFMLIB_REGMASK_EL(g)
pfm_err_t pfm_get_num_counters(unsigned int *num)
pfmlib_regmask_bits_t bits[PFMLIB_REG_BV]
pfm_err_t pfm_get_num_event_masks(unsigned int event_idx, unsigned int *count)
pfm_err_t pfm_dispatch_events(pfmlib_input_param_t *p, void *model_in, pfmlib_output_param_t *q, void *model_out)
unsigned long pfmlib_regmask_bits_t
unsigned int pfp_pmc_count
unsigned long long reg_value
pfm_err_t pfm_get_max_event_name_len(size_t *len)
unsigned int pfp_pmd_count
unsigned long long reg_addr
pfm_err_t pfm_find_event_mask(unsigned int event_idx, const char *str, unsigned int *mask_idx)
pfm_err_t pfm_find_full_event(const char *str, pfmlib_event_t *e)
pfm_err_t pfm_get_num_pmds(unsigned int *num)
pfm_err_t pfm_list_supported_pmus(int(*pf)(const char *fmt,...))
pfm_err_t pfm_find_event_byname(const char *name, unsigned int *idx)
pfm_err_t pfm_get_event_description(unsigned int idx, char **str)
pfm_err_t pfm_get_event_code_counter(unsigned int idx, unsigned int cnt, int *code)
pfm_err_t pfm_get_event_name(unsigned int idx, char *name, size_t maxlen)
unsigned int reg_reserved1
pfm_err_t pfm_is_pmu_supported(int type)
pfm_err_t pfm_initialize(void)
pfm_err_t pfm_find_event(const char *str, unsigned int *idx)
pfm_err_t pfm_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs)
#define __PFMLIB_REGMASK_MASK(g)
pfm_err_t pfm_get_event_counters(unsigned int idx, pfmlib_regmask_t *counters)
pfm_err_t pfm_get_event_mask_name(unsigned int event_idx, unsigned int mask_idx, char *name, size_t maxlen)
pfm_err_t pfm_get_inst_retired_event(pfmlib_event_t *e)
pfm_err_t pfm_find_event_bycode_next(int code, unsigned int start, unsigned int *next)
pfm_err_t pfm_get_num_pmcs(unsigned int *num)
pfm_err_t pfm_get_event_code(unsigned int idx, int *code)
pfm_err_t pfm_get_pmu_name(char *name, int maxlen)
pfm_err_t pfm_get_pmu_name_bytype(int type, char *name, size_t maxlen)
pfm_err_t pfm_get_full_event_name(pfmlib_event_t *e, char *name, size_t maxlen)
pfm_err_t pfm_get_version(unsigned int *version)
pfm_err_t pfm_force_pmu(int type)
pfm_err_t pfm_get_impl_counters(pfmlib_regmask_t *impl_counters)
pfm_err_t pfm_get_impl_pmds(pfmlib_regmask_t *impl_pmds)
pfm_err_t pfm_get_num_events(unsigned int *count)
pfm_err_t pfm_set_options(pfmlib_options_t *opt)
pfm_err_t pfm_find_event_bycode(int code, unsigned int *idx)