00001 /** 00002 * @file op_cpu_type.h 00003 * CPU type determination 00004 * 00005 * @remark Copyright 2002 OProfile authors 00006 * @remark Read the file COPYING 00007 * 00008 * @author John Levon 00009 * @author Philippe Elie 00010 */ 00011 00012 #ifndef OP_CPU_TYPE_H 00013 #define OP_CPU_TYPE_H 00014 00015 #ifdef __cplusplus 00016 extern "C" { 00017 #endif 00018 00019 /** 00020 * Supported cpu type. Always add new CPU types at the very end. 00021 */ 00022 typedef enum { 00023 CPU_NO_GOOD = -1, /**< unsupported CPU type */ 00024 CPU_PPRO, /**< Pentium Pro */ 00025 CPU_PII, /**< Pentium II series */ 00026 CPU_PIII, /**< Pentium III series */ 00027 CPU_ATHLON, /**< AMD P6 series */ 00028 CPU_TIMER_INT, /**< CPU using the timer interrupt */ 00029 CPU_RTC, /**< other CPU to use the RTC */ 00030 CPU_P4, /**< Pentium 4 / Xeon series */ 00031 CPU_IA64, /**< Generic IA64 */ 00032 CPU_IA64_1, /**< IA64 Merced */ 00033 CPU_IA64_2, /**< IA64 McKinley */ 00034 CPU_HAMMER, /**< AMD Hammer family */ 00035 CPU_P4_HT2, /**< Pentium 4 / Xeon series with 2 hyper-threads */ 00036 CPU_AXP_EV4, /**< Alpha EV4 family */ 00037 CPU_AXP_EV5, /**< Alpha EV5 family */ 00038 CPU_AXP_PCA56, /**< Alpha PCA56 family */ 00039 CPU_AXP_EV6, /**< Alpha EV6 family */ 00040 CPU_AXP_EV67, /**< Alpha EV67 family */ 00041 CPU_P6_MOBILE, /**< Pentium M series */ 00042 CPU_ARM_XSCALE1, /**< ARM XScale 1 */ 00043 CPU_ARM_XSCALE2, /**< ARM XScale 2 */ 00044 CPU_PPC64_POWER4, /**< ppc64 POWER4 family */ 00045 CPU_PPC64_POWER5, /**< ppc64 POWER5 family */ 00046 CPU_PPC64_POWER5p, /**< ppc64 Power5+ family */ 00047 CPU_PPC64_970, /**< ppc64 970 family */ 00048 CPU_MIPS_20K, /**< MIPS 20K */ 00049 CPU_MIPS_24K, /**< MIPS 24K */ 00050 CPU_MIPS_25K, /**< MIPS 25K */ 00051 CPU_MIPS_34K, /**< MIPS 34K */ 00052 CPU_MIPS_5K, /**< MIPS 5K */ 00053 CPU_MIPS_R10000, /**< MIPS R10000 */ 00054 CPU_MIPS_R12000, /**< MIPS R12000 */ 00055 CPU_MIPS_RM7000, /**< QED RM7000 */ 00056 CPU_MIPS_RM9000, /**< PMC-Sierra RM9000 */ 00057 CPU_MIPS_SB1, /**< Broadcom SB1 */ 00058 CPU_MIPS_VR5432, /**< NEC VR5432 */ 00059 CPU_MIPS_VR5500, /**< MIPS VR5500, VR5532 and VR7701 */ 00060 CPU_PPC_E500, /**< e500 */ 00061 CPU_PPC_E500_2, /**< e500v2 */ 00062 CPU_CORE, /**< Core Solo / Duo series */ 00063 CPU_PPC_7450, /**< PowerPC G4 */ 00064 CPU_CORE_2, /**< Intel Core 2 */ 00065 CPU_PPC64_POWER6, /**< ppc64 POWER6 family */ 00066 CPU_PPC64_970MP, /**< ppc64 970MP */ 00067 CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/ 00068 CPU_FAMILY10, /**< AMD family 10 */ 00069 CPU_PPC64_PA6T, /**< ppc64 PA6T */ 00070 CPU_ARM_MPCORE, /**< ARM MPCore */ 00071 CPU_ARM_V6, /**< ARM V6 */ 00072 CPU_PPC64_POWER5pp, /**< ppc64 Power5++ family */ 00073 CPU_PPC_E300, /**< e300 */ 00074 CPU_AVR32, /**< AVR32 */ 00075 CPU_ARM_V7, /**< ARM Cortex-A8 */ 00076 CPU_ARCH_PERFMON, /**< Intel architectural perfmon */ 00077 CPU_FAMILY11H, /**< AMD family 11h */ 00078 CPU_PPC64_POWER7, /**< ppc64 POWER7 family */ 00079 CPU_PPC64_IBM_COMPAT_V1, /**< IBM PPC64 processor compat mode version 1 */ 00080 CPU_CORE_I7, /* Intel Core i7, Nehalem */ 00081 CPU_ATOM, /* First generation Intel Atom */ 00082 CPU_MIPS_LOONGSON2, /* < loongson2 family */ 00083 CPU_NEHALEM, /* Intel Nehalem microarchitecture */ 00084 CPU_ARM_V7_CA9, /**< ARM Cortex-A9 */ 00085 CPU_MIPS_74K, /**< MIPS 74K */ 00086 CPU_MIPS_1004K, /**< MIPS 1004K */ 00087 CPU_FAMILY12H, /**< AMD family 12h */ 00088 CPU_FAMILY14H, /**< AMD family 14h */ 00089 CPU_FAMILY15H, /**< AMD family 15h */ 00090 CPU_WESTMERE, /* Intel Westmere microarchitecture */ 00091 CPU_ARM_SCORPION, /**< ARM SCORPION */ 00092 CPU_ARM_SCORPIONMP, /**< ARM SCORPIONMP */ 00093 CPU_SANDYBRIDGE, /* Intel Sandy-Bridge microarchitecture */ 00094 CPU_TILE_TILE64, /**< Tilera TILE64 family */ 00095 CPU_TILE_TILEPRO, /**< Tilera TILEPro family (Pro64 or Pro36) */ 00096 CPU_TILE_TILEGX, /**< Tilera TILE-GX family */ 00097 CPU_S390_Z10, /* IBM System z10 */ 00098 CPU_S390_Z196, /* IBM zEnterprise z196 */ 00099 CPU_IVYBRIDGE, /* Intel Ivy-Bridge microarchitecture */ 00100 CPU_ARM_V7_CA5, /**< ARM Cortex-A5 */ 00101 CPU_ARM_V7_CA7, /**< ARM Cortex-A7 */ 00102 CPU_ARM_V7_CA15, /**< ARM Cortex-A15 */ 00103 MAX_CPU_TYPE 00104 } op_cpu; 00105 00106 /** 00107 * the CPU lowest common denominator 00108 * 00109 * returns 1 if there are variations for the base cpu type; 00110 */ 00111 int op_cpu_variations(op_cpu cpu_type); 00112 00113 /** 00114 * get the CPU lowest common denominator 00115 * 00116 * returns cpu_type if cpu_type does not have a lowest common denominator. 00117 */ 00118 op_cpu op_cpu_base_type(op_cpu cpu_type); 00119 00120 /** 00121 * get the CPU type from the kernel 00122 * 00123 * returns CPU_NO_GOOD if the CPU could not be identified. 00124 * This function can not work if the module is not loaded 00125 */ 00126 op_cpu op_get_cpu_type(void); 00127 00128 /** 00129 * get the cpu number based on string 00130 * @param cpu_string with either the cpu type identifier or cpu type number 00131 * 00132 * The function returns CPU_NO_GOOD if no matching string was found. 00133 */ 00134 op_cpu op_get_cpu_number(char const * cpu_string); 00135 00136 /** 00137 * get the cpu string. 00138 * @param cpu_type the cpu type identifier 00139 * 00140 * The function always return a valid char const * the core cpu denomination 00141 * or "invalid cpu type" if cpu_type is not valid. 00142 */ 00143 char const * op_get_cpu_type_str(op_cpu cpu_type); 00144 00145 /** 00146 * op_get_cpu_name - get the cpu name 00147 * @param cpu_type the cpu identifier name 00148 * 00149 * The function always return a valid char const * 00150 * Return the OProfile CPU name, e.g. "i386/pii" 00151 */ 00152 char const * op_get_cpu_name(op_cpu cpu_type); 00153 00154 #if defined(__i386__) || defined(__x86_64__) 00155 int op_is_cpu_vendor(char * vendor); 00156 #endif 00157 00158 /** 00159 * compute the number of counters available 00160 * @param cpu_type numeric processor type 00161 * 00162 * returns 0 if the CPU could not be identified 00163 */ 00164 int op_get_nr_counters(op_cpu cpu_type); 00165 00166 typedef enum { 00167 OP_INTERFACE_NO_GOOD = -1, 00168 OP_INTERFACE_24, 00169 OP_INTERFACE_26 00170 } op_interface; 00171 00172 /** 00173 * get the INTERFACE used to communicate between daemon and the kernel 00174 * 00175 * returns OP_INTERFACE_NO_GOOD if the INTERFACE could not be identified. 00176 * This function will identify the interface as OP_INTERFACE_NO_GOOD if 00177 * the module is not loaded. 00178 */ 00179 op_interface op_get_interface(void); 00180 00181 /** 00182 * determine if the /dev/oprofile/timer is available 00183 * 00184 * return true if the kernel modules provides the /dev/oprofile 00185 * interface for timer mode sampling. 00186 */ 00187 int op_cpu_has_timer_fs(void); 00188 00189 #ifdef __cplusplus 00190 } 00191 #endif 00192 00193 #endif /* OP_CPU_TYPE_H */
1.6.1