libcpuid
Data Structures | Macros | Typedefs | Enumerations | Functions
libcpuid.h File Reference
#include <stdbool.h>
#include "libcpuid_types.h"
#include "libcpuid_constants.h"

Go to the source code of this file.

Data Structures

struct  cpu_raw_data_t
 Contains just the raw CPUID data. More...
 
struct  cpu_raw_data_array_t
 Contains an array of raw CPUID data. More...
 
struct  cpu_sgx_t
 This contains information about SGX features of the processor Example usage: More...
 
struct  x86_id_t
 Contains x86 specific info. More...
 
struct  arm_id_t
 Contains ARM specific info. More...
 
struct  cpu_id_t
 This contains the recognized CPU features/info. More...
 
struct  system_id_t
 This contains the recognized features/info for all CPUs on the system. More...
 
struct  cpu_mark_t
 Internal structure, used in cpu_tsc_mark, cpu_tsc_unmark and cpu_clock_by_mark. More...
 
struct  cpu_epc_t
 The return value of cpuid_get_epc(). More...
 
struct  cpu_list_t
 a structure that holds a list of processor names More...
 

Macros

#define LIBCPUID_DEPRECATED(message)
 
#define NUM_CPU_VENDORS   NUM_CPU_VENDORS
 
#define NUM_CPU_ARCHITECTURES   NUM_CPU_ARCHITECTURES
 
#define NUM_FEATURE_LEVELS   NUM_FEATURE_LEVELS
 
#define NUM_CPU_PURPOSES   NUM_CPU_PURPOSES
 
#define NUM_HYPERVISOR_VENDORS   NUM_HYPERVISOR_VENDORS
 
#define CPU_INVALID_VALUE   0x3fffffff
 

Typedefs

typedef void(* libcpuid_warn_fn_t) (const char *msg)
 

Enumerations

enum  cpu_vendor_t {
  VENDOR_INTEL = 0 , VENDOR_AMD , VENDOR_CYRIX , VENDOR_NEXGEN ,
  VENDOR_TRANSMETA , VENDOR_UMC , VENDOR_CENTAUR , VENDOR_RISE ,
  VENDOR_SIS , VENDOR_NSC , VENDOR_HYGON , VENDOR_ARM ,
  VENDOR_BROADCOM , VENDOR_CAVIUM , VENDOR_DEC , VENDOR_FUJITSU ,
  VENDOR_HISILICON , VENDOR_INFINEON , VENDOR_FREESCALE , VENDOR_NVIDIA ,
  VENDOR_APM , VENDOR_QUALCOMM , VENDOR_SAMSUNG , VENDOR_MARVELL ,
  VENDOR_APPLE , VENDOR_FARADAY , VENDOR_MICROSOFT , VENDOR_PHYTIUM ,
  VENDOR_AMPERE , NUM_CPU_VENDORS , VENDOR_UNKNOWN = -1
}
 CPU vendor, as guessed from the Vendor String. More...
 
enum  cpu_architecture_t { ARCHITECTURE_X86 = 0 , ARCHITECTURE_ARM , NUM_CPU_ARCHITECTURES , ARCHITECTURE_UNKNOWN = -1 }
 CPU architecture. More...
 
enum  cpu_feature_level_t {
  FEATURE_LEVEL_I386 , FEATURE_LEVEL_I486 , FEATURE_LEVEL_I586 , FEATURE_LEVEL_I686 ,
  FEATURE_LEVEL_X86_64_V1 , FEATURE_LEVEL_X86_64_V2 , FEATURE_LEVEL_X86_64_V3 , FEATURE_LEVEL_X86_64_V4 ,
  FEATURE_LEVEL_ARM_V1 = 100 , FEATURE_LEVEL_ARM_V2 , FEATURE_LEVEL_ARM_V3 , FEATURE_LEVEL_ARM_V4 ,
  FEATURE_LEVEL_ARM_V4T , FEATURE_LEVEL_ARM_V5 , FEATURE_LEVEL_ARM_V5T , FEATURE_LEVEL_ARM_V5TE ,
  FEATURE_LEVEL_ARM_V5TEJ , FEATURE_LEVEL_ARM_V6 , FEATURE_LEVEL_ARM_V6_M , FEATURE_LEVEL_ARM_V7_A ,
  FEATURE_LEVEL_ARM_V7_M , FEATURE_LEVEL_ARM_V7_R , FEATURE_LEVEL_ARM_V7E_M , FEATURE_LEVEL_ARM_V8_0_A ,
  FEATURE_LEVEL_ARM_V8_0_M , FEATURE_LEVEL_ARM_V8_0_R , FEATURE_LEVEL_ARM_V8_1_A , FEATURE_LEVEL_ARM_V8_1_M ,
  FEATURE_LEVEL_ARM_V8_2_A , FEATURE_LEVEL_ARM_V8_3_A , FEATURE_LEVEL_ARM_V8_4_A , FEATURE_LEVEL_ARM_V8_5_A ,
  FEATURE_LEVEL_ARM_V8_6_A , FEATURE_LEVEL_ARM_V8_7_A , FEATURE_LEVEL_ARM_V8_8_A , FEATURE_LEVEL_ARM_V8_9_A ,
  FEATURE_LEVEL_ARM_V9_0_A , FEATURE_LEVEL_ARM_V9_1_A , FEATURE_LEVEL_ARM_V9_2_A , FEATURE_LEVEL_ARM_V9_3_A ,
  FEATURE_LEVEL_ARM_V9_4_A , NUM_FEATURE_LEVELS , FEATURE_LEVEL_UNKNOWN = -1
}
 CPU feature level. More...
 
enum  cpu_purpose_t {
  PURPOSE_GENERAL = 0 , PURPOSE_PERFORMANCE , PURPOSE_EFFICIENCY , PURPOSE_LP_EFFICIENCY ,
  PURPOSE_U_PERFORMANCE , NUM_CPU_PURPOSES
}
 CPU purpose. More...
 
enum  hypervisor_vendor_t {
  HYPERVISOR_NONE = 0 , HYPERVISOR_BHYVE , HYPERVISOR_HYPERV , HYPERVISOR_KVM ,
  HYPERVISOR_PARALLELS , HYPERVISOR_QEMU , HYPERVISOR_VIRTUALBOX , HYPERVISOR_VMWARE ,
  HYPERVISOR_XEN , NUM_HYPERVISOR_VENDORS , HYPERVISOR_UNKNOWN = -1
}
 Hypervisor vendor, as guessed from the CPU_FEATURE_HYPERVISOR flag. More...
 
enum  cpu_feature_t {
  CPU_FEATURE_FPU = 0 , CPU_FEATURE_VME , CPU_FEATURE_DE , CPU_FEATURE_PSE ,
  CPU_FEATURE_TSC , CPU_FEATURE_MSR , CPU_FEATURE_PAE , CPU_FEATURE_MCE ,
  CPU_FEATURE_CX8 , CPU_FEATURE_APIC , CPU_FEATURE_MTRR , CPU_FEATURE_SEP ,
  CPU_FEATURE_PGE , CPU_FEATURE_MCA , CPU_FEATURE_CMOV , CPU_FEATURE_PAT ,
  CPU_FEATURE_PSE36 , CPU_FEATURE_PN , CPU_FEATURE_CLFLUSH , CPU_FEATURE_DTS ,
  CPU_FEATURE_ACPI , CPU_FEATURE_MMX , CPU_FEATURE_FXSR , CPU_FEATURE_SSE ,
  CPU_FEATURE_SSE2 , CPU_FEATURE_SS , CPU_FEATURE_HT , CPU_FEATURE_TM ,
  CPU_FEATURE_IA64 , CPU_FEATURE_PBE , CPU_FEATURE_PNI , CPU_FEATURE_PCLMUL ,
  CPU_FEATURE_DTS64 , CPU_FEATURE_MONITOR , CPU_FEATURE_DS_CPL , CPU_FEATURE_VMX ,
  CPU_FEATURE_SMX , CPU_FEATURE_EST , CPU_FEATURE_TM2 , CPU_FEATURE_SSSE3 ,
  CPU_FEATURE_CID , CPU_FEATURE_CX16 , CPU_FEATURE_XTPR , CPU_FEATURE_PDCM ,
  CPU_FEATURE_DCA , CPU_FEATURE_SSE4_1 , CPU_FEATURE_SSE4_2 , CPU_FEATURE_SYSCALL ,
  CPU_FEATURE_XD , CPU_FEATURE_MOVBE , CPU_FEATURE_POPCNT , CPU_FEATURE_AES ,
  CPU_FEATURE_XSAVE , CPU_FEATURE_OSXSAVE , CPU_FEATURE_AVX , CPU_FEATURE_MMXEXT ,
  CPU_FEATURE_3DNOW , CPU_FEATURE_3DNOWEXT , CPU_FEATURE_NX , CPU_FEATURE_FXSR_OPT ,
  CPU_FEATURE_RDTSCP , CPU_FEATURE_LM , CPU_FEATURE_LAHF_LM , CPU_FEATURE_CMP_LEGACY ,
  CPU_FEATURE_SVM , CPU_FEATURE_ABM , CPU_FEATURE_MISALIGNSSE , CPU_FEATURE_SSE4A ,
  CPU_FEATURE_3DNOWPREFETCH , CPU_FEATURE_OSVW , CPU_FEATURE_IBS , CPU_FEATURE_SSE5 ,
  CPU_FEATURE_SKINIT , CPU_FEATURE_WDT , CPU_FEATURE_TS , CPU_FEATURE_FID ,
  CPU_FEATURE_VID , CPU_FEATURE_TTP , CPU_FEATURE_TM_AMD , CPU_FEATURE_STC ,
  CPU_FEATURE_100MHZSTEPS , CPU_FEATURE_HWPSTATE , CPU_FEATURE_CONSTANT_TSC , CPU_FEATURE_XOP ,
  CPU_FEATURE_FMA3 , CPU_FEATURE_FMA4 , CPU_FEATURE_TBM , CPU_FEATURE_F16C ,
  CPU_FEATURE_RDRAND , CPU_FEATURE_X2APIC , CPU_FEATURE_CPB , CPU_FEATURE_APERFMPERF ,
  CPU_FEATURE_PFI , CPU_FEATURE_PA , CPU_FEATURE_AVX2 , CPU_FEATURE_BMI1 ,
  CPU_FEATURE_BMI2 , CPU_FEATURE_HLE , CPU_FEATURE_RTM , CPU_FEATURE_AVX512F ,
  CPU_FEATURE_AVX512DQ , CPU_FEATURE_AVX512PF , CPU_FEATURE_AVX512ER , CPU_FEATURE_AVX512CD ,
  CPU_FEATURE_SHA_NI , CPU_FEATURE_AVX512BW , CPU_FEATURE_AVX512VL , CPU_FEATURE_SGX ,
  CPU_FEATURE_RDSEED , CPU_FEATURE_ADX , CPU_FEATURE_AVX512VNNI , CPU_FEATURE_AVX512VBMI ,
  CPU_FEATURE_AVX512VBMI2 , CPU_FEATURE_HYPERVISOR , CPU_FEATURE_SWAP , CPU_FEATURE_THUMB ,
  CPU_FEATURE_ADVMULTU , CPU_FEATURE_ADVMULTS , CPU_FEATURE_JAZELLE , CPU_FEATURE_DEBUGV6 ,
  CPU_FEATURE_DEBUGV6P1 , CPU_FEATURE_THUMB2 , CPU_FEATURE_DEBUGV7 , CPU_FEATURE_DEBUGV7P1 ,
  CPU_FEATURE_THUMBEE , CPU_FEATURE_DIVIDE , CPU_FEATURE_LPAE , CPU_FEATURE_PMUV1 ,
  CPU_FEATURE_PMUV2 , CPU_FEATURE_ASID16 , CPU_FEATURE_ADVSIMD , CPU_FEATURE_CRC32 ,
  CPU_FEATURE_CSV2_1P1 , CPU_FEATURE_CSV2_1P2 , CPU_FEATURE_CSV2_2 , CPU_FEATURE_CSV2_3 ,
  CPU_FEATURE_DOUBLELOCK , CPU_FEATURE_ETS2 , CPU_FEATURE_FP , CPU_FEATURE_MIXEDEND ,
  CPU_FEATURE_MIXEDENDEL0 , CPU_FEATURE_PMULL , CPU_FEATURE_PMUV3 , CPU_FEATURE_SHA1 ,
  CPU_FEATURE_SHA256 , CPU_FEATURE_NTLBPA , CPU_FEATURE_HAFDBS , CPU_FEATURE_HPDS ,
  CPU_FEATURE_LOR , CPU_FEATURE_LSE , CPU_FEATURE_PAN , CPU_FEATURE_PMUV3P1 ,
  CPU_FEATURE_RDM , CPU_FEATURE_VHE , CPU_FEATURE_VMID16 , CPU_FEATURE_AA32HPD ,
  CPU_FEATURE_AA32I8MM , CPU_FEATURE_DPB , CPU_FEATURE_DEBUGV8P2 , CPU_FEATURE_F32MM ,
  CPU_FEATURE_F64MM , CPU_FEATURE_FP16 , CPU_FEATURE_HPDS2 , CPU_FEATURE_I8MM ,
  CPU_FEATURE_IESB , CPU_FEATURE_LPA , CPU_FEATURE_LSMAOC , CPU_FEATURE_LVA ,
  CPU_FEATURE_PAN2 , CPU_FEATURE_RAS , CPU_FEATURE_SHA3 , CPU_FEATURE_SHA512 ,
  CPU_FEATURE_SM3 , CPU_FEATURE_SM4 , CPU_FEATURE_SPE , CPU_FEATURE_SVE ,
  CPU_FEATURE_TTCNP , CPU_FEATURE_UAO , CPU_FEATURE_XNX , CPU_FEATURE_CCIDX ,
  CPU_FEATURE_CONSTPACFIELD , CPU_FEATURE_EPAC , CPU_FEATURE_FCMA , CPU_FEATURE_FPAC ,
  CPU_FEATURE_FPACCOMBINE , CPU_FEATURE_JSCVT , CPU_FEATURE_LRCPC , CPU_FEATURE_PACIMP ,
  CPU_FEATURE_PACQARMA3 , CPU_FEATURE_PACQARMA5 , CPU_FEATURE_PAUTH , CPU_FEATURE_SPEV1P1 ,
  CPU_FEATURE_AMUV1 , CPU_FEATURE_BBM , CPU_FEATURE_DIT , CPU_FEATURE_DEBUGV8P4 ,
  CPU_FEATURE_DOTPROD , CPU_FEATURE_DOUBLEFAULT , CPU_FEATURE_FHM , CPU_FEATURE_FLAGM ,
  CPU_FEATURE_IDST , CPU_FEATURE_LRCPC2 , CPU_FEATURE_LSE2 , CPU_FEATURE_MPAM ,
  CPU_FEATURE_PMUV3P4 , CPU_FEATURE_RASV1P1 , CPU_FEATURE_S2FWB , CPU_FEATURE_SEL2 ,
  CPU_FEATURE_TLBIOS , CPU_FEATURE_TLBIRANGE , CPU_FEATURE_TRF , CPU_FEATURE_TTL ,
  CPU_FEATURE_TTST , CPU_FEATURE_BTI , CPU_FEATURE_CSV2 , CPU_FEATURE_CSV3 ,
  CPU_FEATURE_DPB2 , CPU_FEATURE_E0PD , CPU_FEATURE_EVT , CPU_FEATURE_EXS ,
  CPU_FEATURE_FRINTTS , CPU_FEATURE_FLAGM2 , CPU_FEATURE_MTE , CPU_FEATURE_MTE2 ,
  CPU_FEATURE_PMUV3P5 , CPU_FEATURE_RNG , CPU_FEATURE_RNG_TRAP , CPU_FEATURE_SB ,
  CPU_FEATURE_SPECRES , CPU_FEATURE_SSBS , CPU_FEATURE_SSBS2 , CPU_FEATURE_AA32BF16 ,
  CPU_FEATURE_AMUV1P1 , CPU_FEATURE_BF16 , CPU_FEATURE_DGH , CPU_FEATURE_ECV ,
  CPU_FEATURE_FGT , CPU_FEATURE_HPMN0 , CPU_FEATURE_MPAMV0P1 , CPU_FEATURE_MPAMV1P1 ,
  CPU_FEATURE_MTPMU , CPU_FEATURE_PAUTH2 , CPU_FEATURE_TWED , CPU_FEATURE_AFP ,
  CPU_FEATURE_EBF16 , CPU_FEATURE_HCX , CPU_FEATURE_LPA2 , CPU_FEATURE_LS64 ,
  CPU_FEATURE_LS64_ACCDATA , CPU_FEATURE_LS64_V , CPU_FEATURE_MTE3 , CPU_FEATURE_MTE_ASYM_FAULT ,
  CPU_FEATURE_PAN3 , CPU_FEATURE_PMUV3P7 , CPU_FEATURE_RPRES , CPU_FEATURE_SPEV1P2 ,
  CPU_FEATURE_WFXT , CPU_FEATURE_XS , CPU_FEATURE_CMOW , CPU_FEATURE_DEBUGV8P8 ,
  CPU_FEATURE_HBC , CPU_FEATURE_MOPS , CPU_FEATURE_NMI , CPU_FEATURE_PMUV3P8 ,
  CPU_FEATURE_SCTLR2 , CPU_FEATURE_SPEV1P3 , CPU_FEATURE_TCR2 , CPU_FEATURE_TIDCP1 ,
  CPU_FEATURE_ADERR , CPU_FEATURE_AIE , CPU_FEATURE_ANERR , CPU_FEATURE_ATS1A ,
  CPU_FEATURE_CLRBHB , CPU_FEATURE_CSSC , CPU_FEATURE_DEBUGV8P9 , CPU_FEATURE_DOUBLEFAULT2 ,
  CPU_FEATURE_ECBHB , CPU_FEATURE_FGT2 , CPU_FEATURE_HAFT , CPU_FEATURE_LRCPC3 ,
  CPU_FEATURE_MTE4 , CPU_FEATURE_MTE_ASYNC , CPU_FEATURE_MTE_CANONICAL_TAGS , CPU_FEATURE_MTE_NO_ADDRESS_TAGS ,
  CPU_FEATURE_MTE_PERM , CPU_FEATURE_MTE_STORE_ONLY , CPU_FEATURE_MTE_TAGGED_FAR , CPU_FEATURE_PFAR ,
  CPU_FEATURE_PMUV3_ICNTR , CPU_FEATURE_PMUV3_SS , CPU_FEATURE_PMUV3P9 , CPU_FEATURE_PRFMSLC ,
  CPU_FEATURE_RASV2 , CPU_FEATURE_RPRFM , CPU_FEATURE_S1PIE , CPU_FEATURE_S1POE ,
  CPU_FEATURE_S2PIE , CPU_FEATURE_S2POE , CPU_FEATURE_SPECRES2 , CPU_FEATURE_SPE_DPFZS ,
  CPU_FEATURE_SPEV1P4 , CPU_FEATURE_SPMU , CPU_FEATURE_THE , CPU_FEATURE_SVE2 ,
  CPU_FEATURE_SVE_AES , CPU_FEATURE_SVE_BITPERM , CPU_FEATURE_SVE_PMULL128 , CPU_FEATURE_SVE_SHA3 ,
  CPU_FEATURE_SVE_SM4 , CPU_FEATURE_TME , CPU_FEATURE_TRBE , CPU_FEATURE_BRBE ,
  CPU_FEATURE_RME , CPU_FEATURE_SME , CPU_FEATURE_SME_F64F64 , CPU_FEATURE_SME_FA64 ,
  CPU_FEATURE_SME_I16I64 , CPU_FEATURE_BRBEV1P1 , CPU_FEATURE_MEC , CPU_FEATURE_SME2 ,
  CPU_FEATURE_ABLE , CPU_FEATURE_BWE , CPU_FEATURE_D128 , CPU_FEATURE_EBEP ,
  CPU_FEATURE_GCS , CPU_FEATURE_ITE , CPU_FEATURE_LSE128 , CPU_FEATURE_LVA3 ,
  CPU_FEATURE_SEBEP , CPU_FEATURE_SME2P1 , CPU_FEATURE_SME_F16F16 , CPU_FEATURE_SVE2P1 ,
  CPU_FEATURE_SVE_B16B16 , CPU_FEATURE_SYSINSTR128 , CPU_FEATURE_SYSREG128 , CPU_FEATURE_TRBE_EXT ,
  NUM_CPU_FEATURES
}
 CPU feature identifiers. More...
 
enum  cpu_hint_t { CPU_HINT_SSE_SIZE_AUTH = 0 , NUM_CPU_HINTS }
 CPU detection hints identifiers. More...
 
enum  cpu_sgx_feature_t { INTEL_SGX1 , INTEL_SGX2 , NUM_SGX_FEATURES }
 SGX features flags. More...
 
enum  cpu_error_t {
  ERR_OK = 0 , ERR_NO_CPUID = -1 , ERR_NO_RDTSC = -2 , ERR_NO_MEM = -3 ,
  ERR_OPEN = -4 , ERR_BADFMT = -5 , ERR_NOT_IMP = -6 , ERR_CPU_UNKN = -7 ,
  ERR_NO_RDMSR = -8 , ERR_NO_DRIVER = -9 , ERR_NO_PERMS = -10 , ERR_EXTRACT = -11 ,
  ERR_HANDLE = -12 , ERR_INVMSR = -13 , ERR_INVCNB = -14 , ERR_HANDLE_R = -15 ,
  ERR_INVRANGE = -16 , ERR_NOT_FOUND = -17 , ERR_IOCTL = -18 , ERR_REQUEST = -19
}
 Describes common library error codes. More...
 
enum  cpu_msrinfo_request_t {
  INFO_MPERF , INFO_APERF , INFO_MIN_MULTIPLIER , INFO_CUR_MULTIPLIER ,
  INFO_MAX_MULTIPLIER , INFO_TEMPERATURE , INFO_THROTTLING , INFO_VOLTAGE ,
  INFO_BCLK , INFO_BUS_CLOCK
}
 

Functions

int cpuid_get_total_cpus (void)
 Returns the total number of logical CPU threads (even if CPUID is not present). More...
 
int cpuid_present (void)
 Checks if the CPUID instruction is supported. More...
 
void cpu_exec_cpuid (uint32_t eax, uint32_t *regs)
 Executes the CPUID instruction. More...
 
void cpu_exec_cpuid_ext (uint32_t *regs)
 Executes the CPUID instruction with the given input registers. More...
 
int cpuid_get_raw_data (struct cpu_raw_data_t *data)
 Obtains the raw CPUID data from the current CPU. More...
 
int cpuid_get_raw_data_core (struct cpu_raw_data_t *data, logical_cpu_t logical_cpu)
 Obtains the raw CPUID data from the specified CPU. More...
 
int cpuid_get_all_raw_data (struct cpu_raw_data_array_t *data)
 Obtains the raw CPUID data from all CPUs. More...
 
int cpuid_serialize_raw_data (struct cpu_raw_data_t *data, const char *filename)
 Writes the raw CPUID data to a text file. More...
 
int cpuid_serialize_all_raw_data (struct cpu_raw_data_array_t *data, const char *filename)
 Writes all the raw CPUID data to a text file. More...
 
int cpuid_deserialize_raw_data (struct cpu_raw_data_t *data, const char *filename)
 Reads raw CPUID data from file. More...
 
int cpuid_deserialize_all_raw_data (struct cpu_raw_data_array_t *data, const char *filename)
 Reads all raw CPUID data from file. More...
 
int cpu_identify (struct cpu_raw_data_t *raw, struct cpu_id_t *data)
 Identifies the CPU. More...
 
int cpu_identify_all (struct cpu_raw_data_array_t *raw_array, struct system_id_t *system)
 Identifies all the CPUs. More...
 
int cpu_request_core_type (cpu_purpose_t purpose, struct cpu_raw_data_array_t *raw_array, struct cpu_id_t *data)
 Identifies a given CPU type. More...
 
const char * cpu_architecture_str (cpu_architecture_t architecture)
 Returns the short textual representation of a CPU architecture. More...
 
const char * cpu_feature_level_str (cpu_feature_level_t level)
 Returns the short textual representation of a CPU feature level. More...
 
const char * cpu_purpose_str (cpu_purpose_t purpose)
 Returns the short textual representation of a CPU purpose. More...
 
char * affinity_mask_str_r (cpu_affinity_mask_t *affinity_mask, char *buffer, uint32_t buffer_len)
 Returns textual representation of a CPU affinity mask (thread-safe) More...
 
char * affinity_mask_str (cpu_affinity_mask_t *affinity_mask)
 Returns textual representation of a CPU affinity mask. More...
 
const char * cpu_feature_str (cpu_feature_t feature)
 Returns the short textual representation of a CPU flag. More...
 
const char * cpuid_error (void)
 Returns textual description of the last error. More...
 
void cpu_rdtsc (uint64_t *result)
 Executes RDTSC. More...
 
void cpu_tsc_mark (struct cpu_mark_t *mark)
 Store TSC and timing info. More...
 
void cpu_tsc_unmark (struct cpu_mark_t *mark)
 Calculate TSC and timing difference. More...
 
int cpu_clock_by_mark (struct cpu_mark_t *mark)
 Calculates the CPU clock. More...
 
int cpu_clock_by_os (void)
 Returns the CPU clock, as reported by the OS. More...
 
int cpu_clock_measure (int millis, int quad_check)
 Measure the CPU clock frequency. More...
 
int cpu_clock_by_ic (int millis, int runs)
 Measure the CPU clock frequency using instruction-counting. More...
 
int cpu_clock_by_tsc (struct cpu_raw_data_t *raw)
 Measure the CPU clock frequency using TSC frequency from CPUID. More...
 
int cpu_clock (void)
 Get the CPU clock frequency (all-in-one method) More...
 
struct cpu_epc_t cpuid_get_epc (int index, const struct cpu_raw_data_t *raw)
 Fetches information about an EPC (Enclave Page Cache) area. More...
 
const char * cpuid_lib_version (void)
 Returns the libcpuid version. More...
 
libcpuid_warn_fn_t cpuid_set_warn_function (libcpuid_warn_fn_t warn_fun)
 Sets the warning print function. More...
 
void cpuid_set_verbosiness_level (int level)
 Sets the verbosiness level. More...
 
cpu_vendor_t cpuid_get_vendor (void)
 Obtains the CPU vendor from CPUID from the current CPU. More...
 
hypervisor_vendor_t cpuid_get_hypervisor (struct cpu_raw_data_t *raw, struct cpu_id_t *data)
 Obtains the hypervisor vendor from CPUID from the current CPU. More...
 
void cpuid_get_cpu_list (cpu_vendor_t vendor, struct cpu_list_t *list)
 Gets a list of all known CPU names from a specific vendor. More...
 
void cpuid_free_cpu_list (struct cpu_list_t *list)
 Frees a CPU list. More...
 
void cpuid_free_raw_data_array (struct cpu_raw_data_array_t *raw_array)
 Frees a raw array. More...
 
void cpuid_free_system_id (struct system_id_t *system)
 Frees a system ID type. More...
 
struct msr_driver_t * cpu_msr_driver_open (void)
 Starts/opens a driver, needed to read MSRs (Model Specific Registers) More...
 
struct msr_driver_t * cpu_msr_driver_open_core (unsigned core_num)
 Similar to cpu_msr_driver_open, but accept one parameter. More...
 
int cpu_rdmsr (struct msr_driver_t *handle, uint32_t msr_index, uint64_t *result)
 Reads a Model-Specific Register (MSR) More...
 
int cpu_rdmsr_range (struct msr_driver_t *handle, uint32_t msr_index, uint8_t highbit, uint8_t lowbit, uint64_t *result)
 Similar to cpu_rdmsr, but extract a range of bits. More...
 
int cpu_msrinfo (struct msr_driver_t *handle, cpu_msrinfo_request_t which)
 Reads extended CPU information from Model-Specific Registers. More...
 
int msr_serialize_raw_data (struct msr_driver_t *handle, const char *filename)
 Writes the raw MSR data to a text file. More...
 
int cpu_msr_driver_close (struct msr_driver_t *handle)
 Closes an open MSR driver. More...
 

Detailed Description

Author
Veselin Georgiev
Date
Oct 2008
Version
0.7.1

Version history: