| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# pfmlib_intel_nhm.h

Go to the documentation of this file.

    00001 /*
    00002  * Intel Nehalem PMU
    00003  *
    00004  * Copyright (c) 2008 Google, Inc
    00005  * Contributed by Stephane Eranian <eranian@gmail.com>
    00006  *
    00007  * Permission is hereby granted, free of charge, to any person obtaining a copy
    00008  * of this software and associated documentation files (the "Software"), to deal
    00009  * in the Software without restriction, including without limitation the rights
    00010  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    00011  * of the Software, and to permit persons to whom the Software is furnished to do so,
    00012  * subject to the following conditions:
    00013  *
    00014  * The above copyright notice and this permission notice shall be included in all
    00015  * copies or substantial portions of the Software.
    00016  *
    00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
    00018  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    00019  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    00020  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
    00021  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
    00022  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00023  */
    00024 #ifndef __PFMLIB_NHM_H__
    00025 #define __PFMLIB_NHM_H__
    00026
    00027 #include <perfmon/pfmlib.h>
    00028 /*
    00029  * privilege level mask usage for Intel Core
    00030  *
    00031  * PFM_PLM0 = OS (kernel, hypervisor, ..)
    00032  * PFM_PLM1 = unused (ignored)
    00033  * PFM_PLM2 = unused (ignored)
    00034  * PFM_PLM3 = USR (user level)
    00035  */
    00036
    00037 #ifdef __cplusplus
    00038 extern "C" {
    00039 #endif
    00040
    00041 /*
    00042  * total number of counters:
    00043  *      - 4 generic core
    00044  *      - 3 fixed core
    00045  *      - 1 uncore fixed
    00046  *      - 8 uncore generic
    00047  */
    00048 #define PMU_NHM_NUM_COUNTERS 16
    00049
    00050 typedef union {
    00051         unsigned long long val;                 /* complete register value */
    00052         struct {
    00053                 unsigned long sel_event:8;      /* event mask */
    00054                 unsigned long sel_umask:8;      /* unit mask */
    00055                 unsigned long sel_usr:1;        /* user level */
    00056                 unsigned long sel_os:1;         /* system level */
    00057                 unsigned long sel_edge:1;       /* edge detec */
    00058                 unsigned long sel_pc:1;         /* pin control */
    00059                 unsigned long sel_int:1;        /* enable APIC intr */
    00060                 unsigned long sel_anythr:1;     /* measure any thread */
    00061                 unsigned long sel_en:1;         /* enable */
    00062                 unsigned long sel_inv:1;        /* invert counter mask */
    00063                 unsigned long sel_cnt_mask:8;   /* counter mask */
    00064                 unsigned long sel_res2:32;
    00065         } perfevtsel;
    00066         struct {
    00067                 unsigned long usel_event:8;     /* event select */
    00068                 unsigned long usel_umask:8;     /* event unit mask */
    00069                 unsigned long usel_res1:1;      /* reserved */
    00070                 unsigned long usel_occ:1;       /* occupancy reset */
    00071                 unsigned long usel_edge:1;      /* edge detection */
    00072                 unsigned long usel_res2:1;      /* reserved */
    00073                 unsigned long usel_int:1;       /* PMI enable */
    00074                 unsigned long usel_res3:1;      /* reserved */
    00075                 unsigned long usel_en:1;                /* enable */
    00076                 unsigned long usel_inv:1;       /* invert */
    00077                 unsigned long usel_cnt_mask:8;  /* counter mask */
    00078                 unsigned long usel_res4:32;     /* reserved */
    00079         } unc_perfevtsel;
    00080         struct {
    00081                 unsigned long cpl_eq0:1;        /* filter out branches at pl0 */
    00082                 unsigned long cpl_neq0:1;       /* filter out branches at pl1-pl3 */
    00083                 unsigned long jcc:1;            /* filter out condition branches */
    00084                 unsigned long near_rel_call:1;  /* filter out near relative calls */
    00085                 unsigned long near_ind_call:1;  /* filter out near indirect calls */
    00086                 unsigned long near_ret:1;       /* filter out near returns */
    00087                 unsigned long near_ind_jmp:1;   /* filter out near unconditional jmp/calls */
    00088                 unsigned long near_rel_jmp:1;   /* filter out near uncoditional relative jmp */
    00089                 unsigned long far_branch:1;     /* filter out far branches */
    00090                 unsigned long reserved1:23;     /* reserved */
    00091                 unsigned long reserved2:32;     /* reserved */
    00092         } lbr_select;
    00093 } pfm_nhm_sel_reg_t;
    00094
    00095 typedef struct {
    00096         unsigned long           cnt_mask;       /* counter mask (occurences) */
    00097         unsigned int            flags;          /* counter specific flag */
    00098 } pfmlib_nhm_counter_t;
    00099
    00100 /*
    00101  * flags for pfmlib_nhm_counter_t
    00102  */
    00103 #define PFM_NHM_SEL_INV         0x1     /* inverse */
    00104 #define PFM_NHM_SEL_EDGE        0x2     /* edge detect */
    00105 #define PFM_NHM_SEL_ANYTHR      0x4     /* any thread (core only) */
    00106 #define PFM_NHM_SEL_OCC_RST     0x8     /* reset occupancy (uncore only) */
    00107
    00108 typedef struct {
    00109         unsigned int lbr_used;  /* set to 1 if LBR is used */
    00110         unsigned int lbr_plm;   /* priv level PLM0 or PLM3 */
    00111         unsigned int lbr_filter;/* filters */
    00112 } pfmlib_nhm_lbr_t;
    00113
    00114 /*
    00115  * lbr_filter: filter out branches
    00116  * refer to IA32 SDM vol3b section 18.6.2
    00117  */
    00118 #define PFM_NHM_LBR_JCC                 0x4  /* do not capture conditional branches */
    00119 #define PFM_NHM_LBR_NEAR_REL_CALL       0x8  /* do not capture near calls */
    00120 #define PFM_NHM_LBR_NEAR_IND_CALL       0x10 /* do not capture indirect calls */
    00121 #define PFM_NHM_LBR_NEAR_RET            0x20 /* do not capture near returns */
    00122 #define PFM_NHM_LBR_NEAR_IND_JMP        0x40 /* do not capture indirect jumps */
    00123 #define PFM_NHM_LBR_NEAR_REL_JMP        0x80 /* do not capture near relative jumps */
    00124 #define PFM_NHM_LBR_FAR_BRANCH          0x100/* do not capture far branches */
    00125 #define PFM_NHM_LBR_ALL                 0x1fc /* filter out all branches */
    00126
    00127 /*
    00128  * PEBS input parameters
    00129  */
    00130 typedef struct {
    00131         unsigned int pebs_used;         /* set to 1 if PEBS is used */
    00132         unsigned int ld_lat_thres;      /* load latency threshold (cycles) */
    00133 } pfmlib_nhm_pebs_t;
    00134
    00135
    00136 /*
    00137  * model-specific input parameter to pfm_dispatch_events()
    00138  */
    00139 typedef struct {
    00140         pfmlib_nhm_counter_t    pfp_nhm_counters[PMU_NHM_NUM_COUNTERS];
    00141         pfmlib_nhm_pebs_t       pfp_nhm_pebs;   /* PEBS settings */
    00142         pfmlib_nhm_lbr_t        pfp_nhm_lbr;    /* LBR settings */
    00143         uint64_t                reserved[4];    /* for future use */
    00144 } pfmlib_nhm_input_param_t;
    00145
    00146 /*
    00147  * no pfmlib_nhm_output_param_t defined
    00148  */
    00149
    00150 /*
    00151  * Model-specific interface
    00152  * can be called directly
    00153  */
    00154 extern int pfm_nhm_is_pebs(pfmlib_event_t *e);
    00155 extern int pfm_nhm_is_uncore(pfmlib_event_t *e);
    00156 extern int pfm_nhm_data_src_desc(unsigned int val, char **desc);
    00157
    00158 #ifdef __cplusplus /* extern C */
    00159 }
    00160 #endif
    00161
    00162 #endif /* __PFMLIB_NHM_H__ */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines