opd_ibs_macro.h

Go to the documentation of this file.
00001 
00014 #ifndef OPD_IBS_MACRO_H
00015 #define OPD_IBS_MACRO_H
00016 
00022 #define FETCH_MASK_LATENCY  0x0000ffff
00023 #define FETCH_MASK_COMPLETE 0x00040000
00024 #define FETCH_MASK_IC_MISS  0x00080000
00025 #define FETCH_MASK_PHY_ADDR 0x00100000
00026 #define FETCH_MASK_PG_SIZE  0x00600000
00027 #define FETCH_MASK_L1_MISS  0x00800000
00028 #define FETCH_MASK_L2_MISS  0x01000000
00029 #define FETCH_MASK_KILLED   \
00030         (FETCH_MASK_L1_MISS|FETCH_MASK_L2_MISS|FETCH_MASK_PHY_ADDR|\
00031         FETCH_MASK_COMPLETE|FETCH_MASK_IC_MISS)
00032 
00033 
00039 /* MSRC001_1035 IBS Op Data Register (IbsOpData) */
00040 #define BR_MASK_RETIRE           0x0000ffff
00041 #define MASK_RIP_INVALID         0x00000040
00042 #define BR_MASK_BRN_RET          0x00000020
00043 #define BR_MASK_BRN_MISP         0x00000010
00044 #define BR_MASK_BRN_TAKEN        0x00000008
00045 #define BR_MASK_RETURN           0x00000004
00046 #define BR_MASK_MISP_RETURN      0x00000002
00047 #define BR_MASK_BRN_RESYNC       0x00000001
00048 
00049 /* MSRC001_1036 IBS Op Data Register (IbsOpData2) */
00050 #define NB_MASK_L3_STATE         0x00000020
00051 #define NB_MASK_REQ_DST_PROC     0x00000010
00052 #define NB_MASK_REQ_DATA_SRC     0x00000007
00053 
00054 /* MSRC001_1037 IBS Op Data Register (IbsOpData3) */
00055 #define DC_MASK_L2_HIT_1G        0x00080000
00056 #define DC_MASK_PHY_ADDR_VALID   0x00040000
00057 #define DC_MASK_LIN_ADDR_VALID   0x00020000
00058 #define DC_MASK_MAB_HIT          0x00010000
00059 #define DC_MASK_LOCKED_OP        0x00008000
00060 #define DC_MASK_UC_MEM_ACCESS    0x00004000
00061 #define DC_MASK_WC_MEM_ACCESS    0x00002000
00062 #define DC_MASK_ST_TO_LD_CANCEL  0x00001000
00063 #define DC_MASK_ST_TO_LD_FOR     0x00000800
00064 #define DC_MASK_ST_BANK_CONFLICT 0x00000400
00065 #define DC_MASK_LD_BANK_CONFLICT 0x00000200
00066 #define DC_MASK_MISALIGN_ACCESS  0x00000100
00067 #define DC_MASK_DC_MISS          0x00000080
00068 #define DC_MASK_L2_HIT_2M        0x00000040
00069 #define DC_MASK_L1_HIT_1G        0x00000020
00070 #define DC_MASK_L1_HIT_2M        0x00000010
00071 #define DC_MASK_L2_TLB_MISS      0x00000008
00072 #define DC_MASK_L1_TLB_MISS      0x00000004
00073 #define DC_MASK_STORE_OP         0x00000002
00074 #define DC_MASK_LOAD_OP          0x00000001
00075 
00076 
00095 #define DE_IBS_FETCH_ALL         0xf000
00096 #define DE_IBS_FETCH_KILLED      0xf001
00097 #define DE_IBS_FETCH_ATTEMPTED   0xf002
00098 #define DE_IBS_FETCH_COMPLETED   0xf003
00099 #define DE_IBS_FETCH_ABORTED     0xf004
00100 #define DE_IBS_L1_ITLB_HIT       0xf005
00101 #define DE_IBS_ITLB_L1M_L2H      0xf006
00102 #define DE_IBS_ITLB_L1M_L2M      0xf007
00103 #define DE_IBS_IC_MISS           0xf008
00104 #define DE_IBS_IC_HIT            0xf009
00105 #define DE_IBS_FETCH_4K_PAGE     0xf00a
00106 #define DE_IBS_FETCH_2M_PAGE     0xf00b
00107 #define DE_IBS_FETCH_1G_PAGE     0xf00c
00108 #define DE_IBS_FETCH_XX_PAGE     0xf00d
00109 #define DE_IBS_FETCH_LATENCY     0xf00e
00110 
00111 #define IBS_FETCH_BASE           0xf000
00112 #define IBS_FETCH_END            0xf00e
00113 #define IBS_FETCH_MAX            (IBS_FETCH_END - IBS_FETCH_BASE + 1)
00114 #define IS_IBS_FETCH(x)          (IBS_FETCH_BASE <= x && x <= IBS_FETCH_END)
00115 #define IBS_FETCH_OFFSET(x)      (x - IBS_FETCH_BASE)
00116 #define CHECK_FETCH_SELECTED_FLAG(x)    if ( selected_flag & (1 << IBS_FETCH_OFFSET(x)))
00117 
00118 
00123 #define DE_IBS_OP_ALL             0xf100
00124 #define DE_IBS_OP_TAG_TO_RETIRE   0xf101
00125 #define DE_IBS_OP_COMP_TO_RETIRE  0xf102
00126 #define DE_IBS_BRANCH_RETIRED     0xf103
00127 #define DE_IBS_BRANCH_MISP        0xf104
00128 #define DE_IBS_BRANCH_TAKEN       0xf105
00129 #define DE_IBS_BRANCH_MISP_TAKEN  0xf106
00130 #define DE_IBS_RETURN             0xf107
00131 #define DE_IBS_RETURN_MISP        0xf108
00132 #define DE_IBS_RESYNC             0xf109
00133 
00134 #define IBS_OP_BASE               0xf100
00135 #define IBS_OP_END                0xf109
00136 #define IBS_OP_MAX                (IBS_OP_END - IBS_OP_BASE + 1)
00137 #define IS_IBS_OP(x)              (IBS_OP_BASE <= x && x <= IBS_OP_END)
00138 #define IBS_OP_OFFSET(x)          (x - IBS_OP_BASE)
00139 #define CHECK_OP_SELECTED_FLAG(x)   if ( selected_flag & (1 << IBS_OP_OFFSET(x)))
00140 
00141 
00146 #define DE_IBS_LS_ALL_OP         0xf200
00147 #define DE_IBS_LS_LOAD_OP        0xf201
00148 #define DE_IBS_LS_STORE_OP       0xf202
00149 #define DE_IBS_LS_DTLB_L1H       0xf203
00150 #define DE_IBS_LS_DTLB_L1M_L2H   0xf204
00151 #define DE_IBS_LS_DTLB_L1M_L2M   0xf205
00152 #define DE_IBS_LS_DC_MISS        0xf206
00153 #define DE_IBS_LS_DC_HIT         0xf207
00154 #define DE_IBS_LS_MISALIGNED     0xf208
00155 #define DE_IBS_LS_BNK_CONF_LOAD  0xf209
00156 #define DE_IBS_LS_BNK_CONF_STORE 0xf20a
00157 #define DE_IBS_LS_STL_FORWARDED  0xf20b
00158 #define DE_IBS_LS_STL_CANCELLED  0xf20c
00159 #define DE_IBS_LS_UC_MEM_ACCESS  0xf20d
00160 #define DE_IBS_LS_WC_MEM_ACCESS  0xf20e
00161 #define DE_IBS_LS_LOCKED_OP      0xf20f
00162 #define DE_IBS_LS_MAB_HIT        0xf210
00163 #define DE_IBS_LS_L1_DTLB_4K     0xf211
00164 #define DE_IBS_LS_L1_DTLB_2M     0xf212
00165 #define DE_IBS_LS_L1_DTLB_1G     0xf213
00166 #define DE_IBS_LS_L1_DTLB_RES    0xf214
00167 #define DE_IBS_LS_L2_DTLB_4K     0xf215
00168 #define DE_IBS_LS_L2_DTLB_2M     0xf216
00169 #define DE_IBS_LS_L2_DTLB_1G     0xf217
00170 #define DE_IBS_LS_L2_DTLB_RES2   0xf218
00171 #define DE_IBS_LS_DC_LOAD_LAT    0xf219
00172 
00173 #define IBS_OP_LS_BASE           0xf200
00174 #define IBS_OP_LS_END            0xf219
00175 #define IBS_OP_LS_MAX            (IBS_OP_LS_END - IBS_OP_LS_BASE + 1)
00176 #define IS_IBS_OP_LS(x)          (IBS_OP_LS_BASE <= x && x <= IBS_OP_LS_END)
00177 #define IBS_OP_LS_OFFSET(x)      (x - IBS_OP_LS_BASE)
00178 #define CHECK_OP_LS_SELECTED_FLAG(x)    if ( selected_flag & (1 << IBS_OP_LS_OFFSET(x)))
00179 
00180 
00185 #define DE_IBS_NB_LOCAL          0xf240
00186 #define DE_IBS_NB_REMOTE         0xf241
00187 #define DE_IBS_NB_LOCAL_L3       0xf242
00188 #define DE_IBS_NB_LOCAL_CACHE    0xf243
00189 #define DE_IBS_NB_REMOTE_CACHE   0xf244
00190 #define DE_IBS_NB_LOCAL_DRAM     0xf245
00191 #define DE_IBS_NB_REMOTE_DRAM    0xf246
00192 #define DE_IBS_NB_LOCAL_OTHER    0xf247
00193 #define DE_IBS_NB_REMOTE_OTHER   0xf248
00194 #define DE_IBS_NB_CACHE_STATE_M  0xf249
00195 #define DE_IBS_NB_CACHE_STATE_O  0xf24a
00196 #define DE_IBS_NB_LOCAL_LATENCY  0xf24b
00197 #define DE_IBS_NB_REMOTE_LATENCY 0xf24c
00198 
00199 #define IBS_OP_NB_BASE           0xf240
00200 #define IBS_OP_NB_END            0xf24c
00201 #define IBS_OP_NB_MAX            (IBS_OP_NB_END - IBS_OP_NB_BASE + 1)
00202 #define IS_IBS_OP_NB(x)          (IBS_OP_NB_BASE <= x && x <= IBS_OP_NB_END)
00203 #define IBS_OP_NB_OFFSET(x)      (x - IBS_OP_NB_BASE)
00204 #define CHECK_OP_NB_SELECTED_FLAG(x)    if ( selected_flag & (1 << IBS_OP_NB_OFFSET(x)))
00205 
00206 
00207 #define OP_MAX_IBS_COUNTERS      (IBS_FETCH_MAX + IBS_OP_MAX + IBS_OP_LS_MAX + IBS_OP_NB_MAX)
00208 
00209 
00218 #define IBS_FETCH_FETCH_LATENCY(x)              ((unsigned short)(x->ibs_fetch_ctl_high & FETCH_MASK_LATENCY))
00219 
00221 #define IBS_FETCH_FETCH_COMPLETION(x)           ((x->ibs_fetch_ctl_high & FETCH_MASK_COMPLETE) != 0)
00222 
00224 #define IBS_FETCH_INST_CACHE_MISS(x)            ((x->ibs_fetch_ctl_high & FETCH_MASK_IC_MISS) != 0)
00225 
00227 #define IBS_FETCH_PHYS_ADDR_VALID(x)            ((x->ibs_fetch_ctl_high & FETCH_MASK_PHY_ADDR) != 0)
00228 
00229 enum IBSL1PAGESIZE {
00230     L1TLB4K = 0,
00231     L1TLB2M,
00232     L1TLB1G,
00233     L1TLB_INVALID
00234 };
00235 
00237 #define IBS_FETCH_TLB_PAGE_SIZE(x)              ((unsigned short)((x->ibs_fetch_ctl_high >> 21) & 0x3))
00238 #define IBS_FETCH_TLB_PAGE_SIZE_4K(x)           (IBS_FETCH_TLB_PAGE_SIZE(x) == L1TLB4K)
00239 #define IBS_FETCH_TLB_PAGE_SIZE_2M(x)           (IBS_FETCH_TLB_PAGE_SIZE(x) == L1TLB2M)
00240 #define IBS_FETCH_TLB_PAGE_SIZE_1G(x)           (IBS_FETCH_TLB_PAGE_SIZE(x) == L1TLB1G)
00241 
00243 #define IBS_FETCH_M_L1_TLB_MISS(x)              ((x->ibs_fetch_ctl_high & FETCH_MASK_L1_MISS) != 0)
00244 
00246 #define IBS_FETCH_L2_TLB_MISS(x)                ((x->ibs_fetch_ctl_high & FETCH_MASK_L2_MISS) != 0)
00247 
00249 #define IBS_FETCH_KILLED(x)                     ((x->ibs_fetch_ctl_high & FETCH_MASK_KILLED) == 0)
00250 
00251 #define IBS_FETCH_INST_CACHE_HIT(x)             (IBS_FETCH_FETCH_COMPLETION(x) && !IBS_FETCH_INST_CACHE_MISS(x))
00252 
00253 #define IBS_FETCH_L1_TLB_HIT(x)                 (!IBS_FETCH_M_L1_TLB_MISS(x) && IBS_FETCH_PHYS_ADDR_VALID(x))
00254 
00255 #define IBS_FETCH_ITLB_L1M_L2H(x)               (IBS_FETCH_M_L1_TLB_MISS(x) && !IBS_FETCH_L2_TLB_MISS(x))
00256 
00257 #define IBS_FETCH_ITLB_L1M_L2M(x)               (IBS_FETCH_M_L1_TLB_MISS(x) && IBS_FETCH_L2_TLB_MISS(x))
00258 
00259 
00270 #define IBS_OP_COM_TO_RETIRE_CYCLES(x)          ((unsigned short)(x->ibs_op_data1_low & BR_MASK_RETIRE))
00271 
00273 #define IBS_OP_TAG_TO_RETIRE_CYCLES(x)          ((unsigned short)((x->ibs_op_data1_low >> 16) & BR_MASK_RETIRE))
00274 
00276 #define IBS_OP_BRANCH_RESYNC(x)                 ((x->ibs_op_data1_high & BR_MASK_BRN_RESYNC) != 0)
00277 
00279 #define IBS_OP_MISPREDICT_RETURN(x)             ((x->ibs_op_data1_high & BR_MASK_MISP_RETURN) != 0)
00280 
00282 #define IBS_OP_RETURN(x)                        ((x->ibs_op_data1_high & BR_MASK_RETURN) != 0)
00283 
00285 #define IBS_OP_BRANCH_TAKEN(x)                  ((x->ibs_op_data1_high & BR_MASK_BRN_TAKEN) != 0)
00286 
00288 #define IBS_OP_BRANCH_MISPREDICT(x)             ((x->ibs_op_data1_high & BR_MASK_BRN_MISP) != 0)
00289 
00291 #define IBS_OP_BRANCH_RETIRED(x)                ((x->ibs_op_data1_high & BR_MASK_BRN_RET) != 0)
00292 
00294 #define IBS_OP_RIP_INVALID(x)                   ((x->ibs_op_data1_high & MASK_RIP_INVALID) != 0)
00295 
00301 #define IBS_OP_NB_IBS_CACHE_HIT_ST(x)           ((x->ibs_op_data2_low & NB_MASK_L3_STATE) != 0)
00302 
00304 #define IBS_OP_NB_IBS_REQ_DST_PROC(x)           ((x->ibs_op_data2_low & NB_MASK_REQ_DST_PROC) != 0)
00305 
00307 #define IBS_OP_NB_IBS_REQ_SRC(x)                ((unsigned char)(x->ibs_op_data2_low & NB_MASK_REQ_DATA_SRC))
00308 
00309 #define IBS_OP_NB_IBS_REQ_SRC_01(x)             (IBS_OP_NB_IBS_REQ_SRC(x) == 0x01)
00310 
00311 #define IBS_OP_NB_IBS_REQ_SRC_02(x)             (IBS_OP_NB_IBS_REQ_SRC(x) == 0x02)
00312 
00313 #define IBS_OP_NB_IBS_REQ_SRC_03(x)             (IBS_OP_NB_IBS_REQ_SRC(x) == 0x03)
00314 
00315 #define IBS_OP_NB_IBS_REQ_SRC_07(x)             (IBS_OP_NB_IBS_REQ_SRC(x) == 0x07)
00316 
00322 #define IBS_OP_DC_MISS_LATENCY(x)               ((unsigned short)(x->ibs_op_data3_high & 0xffff))
00323 
00325 #define IBS_OP_IBS_LD_OP(x)                     ((x->ibs_op_data3_low & DC_MASK_LOAD_OP) != 0)
00326 
00328 #define IBS_OP_IBS_ST_OP(x)                     ((x->ibs_op_data3_low & DC_MASK_STORE_OP) != 0)
00329 
00331 #define IBS_OP_IBS_DC_L1_TLB_MISS(x)            ((x->ibs_op_data3_low & DC_MASK_L1_TLB_MISS) != 0)
00332 
00334 #define IBS_OP_IBS_DC_L2_TLB_MISS(x)            ((x->ibs_op_data3_low & DC_MASK_L2_TLB_MISS) != 0)
00335 
00337 #define IBS_OP_IBS_DC_L1_TLB_HIT_2MB(x)         ((x->ibs_op_data3_low & DC_MASK_L1_HIT_2M) != 0)
00338 
00340 #define IBS_OP_IBS_DC_L1_TLB_HIT_1GB(x)         ((x->ibs_op_data3_low & DC_MASK_L1_HIT_1G) != 0)
00341 
00343 #define IBS_OP_IBS_DC_L2_TLB_HIT_2MB(x)         ((x->ibs_op_data3_low & DC_MASK_L2_HIT_2M) != 0)
00344 
00346 #define IBS_OP_IBS_DC_MISS(x)                   ((x->ibs_op_data3_low & DC_MASK_DC_MISS) != 0)
00347 
00349 #define IBS_OP_IBS_DC_MISS_ACC(x)               ((x->ibs_op_data3_low & DC_MASK_MISALIGN_ACCESS) != 0)
00350 
00352 #define IBS_OP_IBS_DC_LD_BNK_CON(x)             ((x->ibs_op_data3_low & DC_MASK_LD_BANK_CONFLICT) != 0)
00353 
00355 #define IBS_OP_IBS_DC_ST_BNK_CON(x)             ((x->ibs_op_data3_low & DC_MASK_ST_BANK_CONFLICT) != 0)
00356 
00358 #define IBS_OP_IBS_DC_ST_TO_LD_FWD(x)           ((x->ibs_op_data3_low & DC_MASK_ST_TO_LD_FOR) != 0)
00359 
00361 #define IBS_OP_IBS_DC_ST_TO_LD_CAN(x)           ((x->ibs_op_data3_low & DC_MASK_ST_TO_LD_CANCEL) != 0)
00362 
00364 #define IBS_OP_IBS_DC_WC_MEM_ACC(x)             ((x->ibs_op_data3_low & DC_MASK_WC_MEM_ACCESS) != 0)
00365 
00367 #define IBS_OP_IBS_DC_UC_MEM_ACC(x)             ((x->ibs_op_data3_low & DC_MASK_UC_MEM_ACCESS) != 0)
00368 
00370 #define IBS_OP_IBS_LOCKED_OP(x)                 ((x->ibs_op_data3_low & DC_MASK_LOCKED_OP) != 0)
00371 
00373 #define IBS_OP_IBS_DC_MAB_HIT(x)                ((x->ibs_op_data3_low & DC_MASK_MAB_HIT) != 0)
00374 
00376 #define IBS_OP_IBS_DC_LIN_ADDR_VALID(x)         ((x->ibs_op_data3_low & DC_MASK_LIN_ADDR_VALID) != 0)
00377 
00379 #define IBS_OP_IBS_DC_PHY_ADDR_VALID(x)         ((x->ibs_op_data3_low & DC_MASK_PHY_ADDR_VALID) != 0)
00380 
00382 #define IBS_OP_IBS_DC_L2_TLB_HIT_1GB(x)         ((x->ibs_op_data3_low & DC_MASK_L2_HIT_1G) != 0)
00383 
00384 
00389 #define AGG_IBS_EVENT(EV)               opd_log_ibs_event(EV, trans)
00390 
00395 #define AGG_IBS_COUNT(EV, COUNT)        opd_log_ibs_count(EV, trans, COUNT)
00396 
00397 #endif /*OPD_IBS_MACRO_H*/

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1