op_cpu_type.h revision cc2ee177dbb3befca43e36cfc56778b006c3d050
1/** 2 * @file op_cpu_type.h 3 * CPU type determination 4 * 5 * @remark Copyright 2002 OProfile authors 6 * @remark Read the file COPYING 7 * 8 * @author John Levon 9 * @author Philippe Elie 10 */ 11 12#ifndef OP_CPU_TYPE_H 13#define OP_CPU_TYPE_H 14 15#ifdef __cplusplus 16extern "C" { 17#endif 18 19/** supported cpu type */ 20typedef enum { 21 CPU_NO_GOOD = -1, /**< unsupported CPU type */ 22 CPU_PPRO, /**< Pentium Pro */ 23 CPU_PII, /**< Pentium II series */ 24 CPU_PIII, /**< Pentium III series */ 25 CPU_ATHLON, /**< AMD P6 series */ 26 CPU_TIMER_INT, /**< CPU using the timer interrupt */ 27 CPU_RTC, /**< other CPU to use the RTC */ 28 CPU_P4, /**< Pentium 4 / Xeon series */ 29 CPU_IA64, /**< Generic IA64 */ 30 CPU_IA64_1, /**< IA64 Merced */ 31 CPU_IA64_2, /**< IA64 McKinley */ 32 CPU_HAMMER, /**< AMD Hammer family */ 33 CPU_P4_HT2, /**< Pentium 4 / Xeon series with 2 hyper-threads */ 34 CPU_AXP_EV4, /**< Alpha EV4 family */ 35 CPU_AXP_EV5, /**< Alpha EV5 family */ 36 CPU_AXP_PCA56, /**< Alpha PCA56 family */ 37 CPU_AXP_EV6, /**< Alpha EV6 family */ 38 CPU_AXP_EV67, /**< Alpha EV67 family */ 39 CPU_P6_MOBILE, /**< Pentium M series */ 40 CPU_ARM_XSCALE1, /**< ARM XScale 1 */ 41 CPU_ARM_XSCALE2, /**< ARM XScale 2 */ 42 CPU_PPC64_POWER4, /**< ppc64 POWER4 family */ 43 CPU_PPC64_POWER5, /**< ppc64 POWER5 family */ 44 CPU_PPC64_970, /**< ppc64 970 family */ 45 CPU_MIPS_24K, /**< MIPS 24K */ 46 CPU_MIPS_R10000, /**< MIPS R10000 */ 47 CPU_MIPS_R12000, /**< MIPS R12000 */ 48 CPU_MIPS_RM7000, /**< QED RM7000 */ 49 CPU_MIPS_RM9000, /**< PMC-Sierra RM9000 */ 50 CPU_MIPS_SB1, /**< Broadcom SB1 */ 51 CPU_MIPS_VR5432, /**< NEC VR5432 */ 52 CPU_MIPS_VR5500, /**< MIPS VR5500, VR5532 and VR7701 */ 53 CPU_PPC_E500, /**< e500 */ 54 MAX_CPU_TYPE 55} op_cpu; 56 57/** 58 * get the CPU type from the kernel 59 * 60 * returns CPU_NO_GOOD if the CPU could not be identified. 61 * This function can not work if the module is not loaded 62 */ 63op_cpu op_get_cpu_type(void); 64 65/** 66 * get the cpu number based on string 67 * @param cpu_string with either the cpu type identifier or cpu type number 68 * 69 * The function returns CPU_NO_GOOD if no matching string was found. 70 */ 71op_cpu op_get_cpu_number(char const * cpu_string); 72 73/** 74 * get the cpu string. 75 * @param cpu_type the cpu type identifier 76 * 77 * The function always return a valid char const * the core cpu denomination 78 * or "invalid cpu type" if cpu_type is not valid. 79 */ 80char const * op_get_cpu_type_str(op_cpu cpu_type); 81 82/** 83 * op_get_cpu_name - get the cpu name 84 * @param cpu_type the cpu identifier name 85 * 86 * The function always return a valid char const * 87 * Return the OProfile CPU name, e.g. "i386/pii" 88 */ 89char const * op_get_cpu_name(op_cpu cpu_type); 90 91/** 92 * compute the number of counters available 93 * @param cpu_type numeric processor type 94 * 95 * returns 0 if the CPU could not be identified 96 */ 97int op_get_nr_counters(op_cpu cpu_type); 98 99typedef enum { 100 OP_INTERFACE_NO_GOOD = -1, 101 OP_INTERFACE_24, 102 OP_INTERFACE_26 103} op_interface; 104 105/** 106 * get the INTERFACE used to communicate between daemon and the kernel 107 * 108 * returns OP_INTERFACE_NO_GOOD if the INTERFACE could not be identified. 109 * This function will identify the interface as OP_INTERFACE_NO_GOOD if 110 * the module is not loaded. 111 */ 112op_interface op_get_interface(void); 113 114#ifdef __cplusplus 115} 116#endif 117 118#endif /* OP_CPU_TYPE_H */ 119