|
PAPI
5.0.1.0
|
00001 #ifndef _PAPI_PERFMON_IA64_H 00002 #define _PAPI_PERFMON_IA64_H 00003 /* 00004 * File: perfmon-ia64.h 00005 * CVS: $Id$ 00006 * Author: Philip Mucci 00007 * mucci@cs.utk.edu 00008 * 00009 * Kevin London 00010 * london@cs.utk.edu 00011 * 00012 * Mods: Per Ekman 00013 * pek@pdc.kth.se 00014 */ 00015 00016 #include <stdio.h> 00017 #include <stdlib.h> 00018 #include <stdarg.h> 00019 #include <unistd.h> 00020 #include <assert.h> 00021 #include <errno.h> 00022 #include <string.h> 00023 #include <math.h> 00024 #include <limits.h> 00025 #include <time.h> 00026 #include <fcntl.h> 00027 #include <ctype.h> 00028 #include <inttypes.h> 00029 #include <libgen.h> 00030 #include <sys/syscall.h> 00031 #include <sys/types.h> 00032 #include <sys/time.h> 00033 #include <sys/times.h> 00034 #include <sys/ucontext.h> 00035 #include <sys/types.h> 00036 #include <sys/ipc.h> 00037 00038 #if defined(HAVE_MMTIMER) 00039 #include <sys/ioctl.h> 00040 #include <sys/mman.h> 00041 #include <linux/mmtimer.h> 00042 #ifndef MMTIMER_FULLNAME 00043 #define MMTIMER_FULLNAME "/dev/mmtimer" 00044 #endif 00045 #endif 00046 00047 #ifdef __INTEL_COMPILER 00048 #include <ia64intrin.h> 00049 #include <ia64regs.h> 00050 #endif 00051 00052 #include "papi_defines.h" 00053 #include "config.h" 00054 #include "perfmon/pfmlib.h" 00055 #include "perfmon/perfmon.h" 00056 #include "perfmon/perfmon_default_smpl.h" 00057 #include "perfmon/pfmlib_montecito.h" 00058 #include "perfmon/pfmlib_itanium2.h" 00059 #include "perfmon/pfmlib_itanium.h" 00060 00061 typedef int ia64_register_t; 00062 typedef int ia64_register_map_t; 00063 typedef int ia64_reg_alloc_t; 00064 00065 00066 #define NUM_PMCS PFMLIB_MAX_PMCS 00067 #define NUM_PMDS PFMLIB_MAX_PMDS 00068 00069 typedef struct param_t 00070 { 00071 pfarg_reg_t pd[NUM_PMDS]; 00072 pfarg_reg_t pc[NUM_PMCS]; 00073 pfmlib_input_param_t inp; 00074 pfmlib_output_param_t outp; 00075 void *mod_inp; /* model specific input parameters to libpfm */ 00076 void *mod_outp; /* model specific output parameters from libpfm */ 00077 } pfmw_param_t; 00078 // #ifdef ITANIUM3 00079 typedef struct mont_param_t 00080 { 00081 pfmlib_mont_input_param_t mont_input_param; 00082 pfmlib_mont_output_param_t mont_output_param; 00083 } pfmw_mont_param_t; 00084 // typedef pfmw_mont_param_t pfmw_ita_param_t; 00085 // #elif defined(ITANIUM2) 00086 typedef struct ita2_param_t 00087 { 00088 pfmlib_ita2_input_param_t ita2_input_param; 00089 pfmlib_ita2_output_param_t ita2_output_param; 00090 } pfmw_ita2_param_t; 00091 // typedef pfmw_ita2_param_t pfmw_ita_param_t; 00092 // #else 00093 typedef int pfmw_ita1_param_t; 00094 // #endif 00095 00096 #define PMU_FIRST_COUNTER 4 00097 00098 typedef union 00099 { 00100 pfmw_ita1_param_t ita_param; 00101 pfmw_ita2_param_t ita2_param; 00102 pfmw_mont_param_t mont_param; 00103 } pfmw_ita_param_t; 00104 00105 00106 #define MAX_COUNTERS 12 00107 #define MAX_COUNTER_TERMS MAX_COUNTERS 00108 00109 typedef struct ia64_control_state 00110 { 00111 /* Which counters to use? Bits encode counters to use, may be duplicates */ 00112 ia64_register_map_t bits; 00113 00114 pfmw_ita_param_t ita_lib_param; 00115 00116 /* Buffer to pass to kernel to control the counters */ 00117 pfmw_param_t evt; 00118 00119 long long counters[MAX_COUNTERS]; 00120 pfarg_reg_t pd[NUM_PMDS]; 00121 00122 /* sampling buffer address */ 00123 void *smpl_vaddr; 00124 /* Buffer to pass to library to control the counters */ 00125 } ia64_control_state_t; 00126 00127 00128 typedef struct itanium_preset_search 00129 { 00130 /* Preset code */ 00131 int preset; 00132 /* Derived code */ 00133 int derived; 00134 /* Strings to look for */ 00135 char *( findme[MAX_COUNTERS] ); 00136 char operation[MAX_COUNTERS * 5]; 00137 } itanium_preset_search_t; 00138 00139 typedef struct 00140 { 00141 int fd; /* file descriptor */ 00142 pid_t tid; /* thread id */ 00143 #if defined(USE_PROC_PTTIMER) 00144 int stat_fd; 00145 #endif 00146 } ia64_context_t; 00147 00148 #undef hwd_context_t 00149 typedef ia64_context_t hwd_context_t; 00150 00151 #include "linux-context.h" 00152 00153 //#undef hwd_ucontext_t 00154 //typedef struct sigcontext hwd_ucontext_t; 00155 00156 /* Override void* definitions from PAPI framework layer */ 00157 /* with typedefs to conform to PAPI component layer code. */ 00158 #undef hwd_reg_alloc_t 00159 typedef ia64_reg_alloc_t hwd_reg_alloc_t; 00160 #undef hwd_register_t 00161 typedef ia64_register_t hwd_register_t; 00162 #undef hwd_control_state_t 00163 typedef ia64_control_state_t hwd_control_state_t; 00164 00165 #define SMPL_BUF_NENTRIES 64 00166 #define M_PMD(x) (1UL<<(x)) 00167 00168 #define MONT_DEAR_REGS_MASK (M_PMD(32)|M_PMD(33)|M_PMD(36)) 00169 #define MONT_ETB_REGS_MASK (M_PMD(38)| M_PMD(39)| \ 00170 M_PMD(48)|M_PMD(49)|M_PMD(50)|M_PMD(51)|M_PMD(52)|M_PMD(53)|M_PMD(54)|M_PMD(55)|\ 00171 M_PMD(56)|M_PMD(57)|M_PMD(58)|M_PMD(59)|M_PMD(60)|M_PMD(61)|M_PMD(62)|M_PMD(63)) 00172 00173 #define DEAR_REGS_MASK (M_PMD(2)|M_PMD(3)|M_PMD(17)) 00174 #define BTB_REGS_MASK (M_PMD(8)|M_PMD(9)|M_PMD(10)|M_PMD(11)|M_PMD(12)|M_PMD(13)|M_PMD(14)|M_PMD(15)|M_PMD(16)) 00175 00176 #endif /* _PAPI_PERFMON_IA64_H */