48#define sel_event_select perfevtsel.sel_event_select
49#define sel_unit_mask perfevtsel.sel_unit_mask
50#define sel_usr perfevtsel.sel_usr
51#define sel_os perfevtsel.sel_os
52#define sel_edge perfevtsel.sel_edge
53#define sel_pc perfevtsel.sel_pc
54#define sel_int perfevtsel.sel_int
55#define sel_en perfevtsel.sel_en
56#define sel_inv perfevtsel.sel_inv
57#define sel_cnt_mask perfevtsel.sel_cnt_mask
75#define COREDUO_SEL_BASE 0x186
76#define COREDUO_CTR_BASE 0xc1
78#define PFMLIB_COREDUO_ALL_FLAGS \
79 (PFM_COREDUO_SEL_INV|PFM_COREDUO_SEL_EDGE)
95 if (strcmp(buffer,
"GenuineIntel"))
108 model = atoi(buffer);
134#define HAS_OPTIONS(x) (cntrs && (cntrs[x].flags || cntrs[x].cnt_mask))
143 unsigned int npc, npmc0, npmc1, nf2;
144 unsigned int i, n, k, ucode;
146 unsigned int next_gen, last_gen;
148 npc = npmc0 = npmc1 = nf2 = 0;
170 for(
i=0;
i < n;
i++) {
189 DPRINT(
"two events compete for a PMC0\n");
198 DPRINT(
"two events compete for a PMC1\n");
210 for(
i=0;
i < n;
i++) {
231 for(
i=0;
i < n;
i++) {
232 if (assign_pc[
i] == -1) {
233 for(; next_gen <= last_gen; next_gen++) {
238 if (next_gen <= last_gen)
239 assign_pc[
i] = next_gen++;
241 DPRINT(
"cannot assign generic counters\n");
247 for (
i=0;
i < n ;
i++ ) {
257 ucode = (val >> 8) & 0xff;
269 && ((ucode & (0x3 << 6)) == 0)) {
278 && ((ucode & 0xf) == 0)) {
300 if (cntrs[
i].cnt_mask > 255)
316 __pfm_vbprintf(
"[PERFEVTSEL%u(pmc%u)=0x%"PRIx64
" event_sel=0x%x umask=0x%x os=%d usr=%d en=%d int=%d inv=%d edge=%d cnt_mask=%d] %s\n",
340 for (
i=0;
i < n ;
i++) {
379 memset(counters, 0,
sizeof(*counters));
#define PME_COREDUO_UNHALTED_CORE_CYCLES
#define PME_COREDUO_INSTRUCTIONS_RETIRED
static pme_coreduo_entry_t coreduo_pe[]
#define PME_COREDUO_EVENT_COUNT
static int pfm_regmask_set(pfmlib_regmask_t *h, unsigned int b)
static int pfm_regmask_clr(pfmlib_regmask_t *h, unsigned int b)
#define PFMLIB_ERR_TOOMANY
static int pfm_regmask_isset(pfmlib_regmask_t *h, unsigned int b)
#define PFMLIB_ERR_NOASSIGN
#define PFMLIB_ERR_NOTSUPP
#define PFMLIB_COREDUO_PMU
static int pfm_coreduo_dispatch_events(pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
static pfmlib_regmask_t coreduo_impl_pmds
static int pfm_coreduo_get_event_mask_desc(unsigned int ev, unsigned int midx, char **str)
static void pfm_coreduo_get_impl_counters(pfmlib_regmask_t *impl_counters)
static int pfm_coreduo_detect(void)
static char * pfm_coreduo_get_event_name(unsigned int i)
static int pfm_coreduo_get_cycle_event(pfmlib_event_t *e)
static int pfm_coreduo_get_event_description(unsigned int ev, char **str)
#define PFMLIB_COREDUO_ALL_FLAGS
static void pfm_coreduo_get_hw_counter_width(unsigned int *width)
static char * pfm_coreduo_get_event_mask_name(unsigned int ev, unsigned int midx)
static int highest_counter
static int pfm_coreduo_get_event_mask_code(unsigned int ev, unsigned int midx, unsigned int *code)
static void pfm_coreduo_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs)
static int pfm_coreduo_get_event_code(unsigned int i, unsigned int cnt, int *code)
static int pfm_coreduo_dispatch_counters(pfmlib_input_param_t *inp, pfmlib_coreduo_input_param_t *param, pfmlib_output_param_t *outp)
static void pfm_coreduo_get_impl_pmds(pfmlib_regmask_t *impl_pmds)
static void pfm_coreduo_get_event_counters(unsigned int j, pfmlib_regmask_t *counters)
static pfmlib_regmask_t coreduo_impl_pmcs
static unsigned int pfm_coreduo_get_num_event_masks(unsigned int ev)
static int pfm_coreduo_get_inst_retired(pfmlib_event_t *e)
static int pfm_coreduo_init(void)
pfm_pmu_support_t coreduo_support
#define PFM_COREDUO_SEL_EDGE
#define PFM_COREDUO_SEL_INV
#define PMU_COREDUO_NUM_COUNTERS
#define PFMLIB_COREDUO_CSPEC
#define PFMLIB_COREDUO_PMC1
#define PFMLIB_COREDUO_PMC0
#define PFMLIB_COREDUO_MESI
int __pfm_getcpuinfo_attr(const char *attr, char *ret_buf, size_t maxlen)
void __pfm_vbprintf(const char *fmt,...)
#define DPRINT(fmt, a...)
unsigned int unit_masks[PFMLIB_MAX_MASKS_PER_EVENT]
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
unsigned int pfp_pmc_count
unsigned int pfp_pmd_count
unsigned long long reg_value
unsigned long reg_alt_addr
unsigned long long reg_addr
pme_coreduo_umask_t pme_umasks[PFMLIB_COREDUO_MAX_UMASK]
unsigned long sel_cnt_mask
unsigned long sel_event_select
unsigned long sel_unit_mask