vSMC
vSMC: Scalable Monte Carlo
Classes | Public Types | Static Public Member Functions | List of all members
vsmc::CPUID Class Reference

Query CPUID information. More...

#include <vsmc/utility/cpuid.hpp>

Classes

struct  cache_param_type
 Structure of deterministic cache parameter. More...
 

Public Types

typedef Array< unsigned, 4 > reg_type
 The array type that holds EAX, EBX, ECX, and EDX, in that order. More...
 

Static Public Member Functions

static unsigned base_freq ()
 Base frequency in MHz (EAX = 0x16; EAX[15:0]) More...
 
static std::string brand ()
 Processor brand string (EAX = 0x80000002,0x80000003,0x80000004; EAX, EBX, ECX, EDX) More...
 
static unsigned bus_freq ()
 Bus (reference) frequency in MHz (EAX = 0x16; ECX[15:0]) More...
 
static cache_param_type cache_param (unsigned cache_index)
 Get the cache parameters (EAX = 0x04; EAX, EBX, ECX, EDX) More...
 
static unsigned cache_param_num ()
 Get the number of caches. More...
 
template<CPUIDFeature Feat>
static bool has_feature ()
 CPU feature. More...
 
template<typename CharT , typename Traits >
static std::basic_ostream< CharT, Traits > & info (std::basic_ostream< CharT, Traits > &os)
 Get CPU feature using CPUID. More...
 
template<unsigned EAX, unsigned ECX>
static const reg_typeinfo ()
 Get the CPUID information stored in EAX, EBX, ECX and EDX, given input EAX and ECX values. More...
 
static bool intel_turbo_boost ()
 Intel Turbo Boost (EAX = 0x06; EAX[1]) More...
 
static unsigned max_eax ()
 Maximum calling parameter EAX (EAX = 0x00; EAX) More...
 
static unsigned max_eax_ext ()
 Maximum extended calling parameter EAX (EAX = 0x80000000; EAX) More...
 
static unsigned max_freq ()
 Maximum frequency in MHz (EAX = 0x16; EBX[15:0]) More...
 
static std::string vendor ()
 Vendor ID (EAX = 0x00; EBX, EDX, ECX) More...
 

Detailed Description

Query CPUID information.

Note
Most member functions are not thread-safe. However, normal program shall not need to call CPUID instruction from multiple threads. Most information shall be obtained once when the program launch.

Definition at line 422 of file cpuid.hpp.

Member Typedef Documentation

typedef Array<unsigned, 4> vsmc::CPUID::reg_type

The array type that holds EAX, EBX, ECX, and EDX, in that order.

Definition at line 427 of file cpuid.hpp.

Member Function Documentation

static unsigned vsmc::CPUID::base_freq ( )
inlinestatic

Base frequency in MHz (EAX = 0x16; EAX[15:0])

Definition at line 650 of file cpuid.hpp.

static std::string vsmc::CPUID::brand ( )
inlinestatic

Processor brand string (EAX = 0x80000002,0x80000003,0x80000004; EAX, EBX, ECX, EDX)

Definition at line 604 of file cpuid.hpp.

static unsigned vsmc::CPUID::bus_freq ( )
inlinestatic

Bus (reference) frequency in MHz (EAX = 0x16; ECX[15:0])

Definition at line 658 of file cpuid.hpp.

static cache_param_type vsmc::CPUID::cache_param ( unsigned  cache_index)
inlinestatic

Get the cache parameters (EAX = 0x04; EAX, EBX, ECX, EDX)

Note
The maximum of the cache_index parameter cache_param_num() - 1

Definition at line 637 of file cpuid.hpp.

static unsigned vsmc::CPUID::cache_param_num ( )
inlinestatic

Get the number of caches.

Definition at line 619 of file cpuid.hpp.

template<CPUIDFeature Feat>
static bool vsmc::CPUID::has_feature ( )
inlinestatic

CPU feature.

Definition at line 663 of file cpuid.hpp.

template<typename CharT , typename Traits >
static std::basic_ostream<CharT, Traits>& vsmc::CPUID::info ( std::basic_ostream< CharT, Traits > &  os)
inlinestatic

Get CPU feature using CPUID.

Definition at line 536 of file cpuid.hpp.

template<unsigned EAX, unsigned ECX>
static const reg_type& vsmc::CPUID::info ( )
inlinestatic

Get the CPUID information stored in EAX, EBX, ECX and EDX, given input EAX and ECX values.

Note
Unlike the cpuid(eax, ecx) call, the results are cached. Therefore, for subsequent calls of this function with the same value of EAX and ECX, the CPUID instruction will not be called.

Definition at line 571 of file cpuid.hpp.

static bool vsmc::CPUID::intel_turbo_boost ( )
inlinestatic

Intel Turbo Boost (EAX = 0x06; EAX[1])

Definition at line 646 of file cpuid.hpp.

static unsigned vsmc::CPUID::max_eax ( )
inlinestatic

Maximum calling parameter EAX (EAX = 0x00; EAX)

Definition at line 582 of file cpuid.hpp.

static unsigned vsmc::CPUID::max_eax_ext ( )
inlinestatic

Maximum extended calling parameter EAX (EAX = 0x80000000; EAX)

Definition at line 586 of file cpuid.hpp.

static unsigned vsmc::CPUID::max_freq ( )
inlinestatic

Maximum frequency in MHz (EAX = 0x16; EBX[15:0])

Definition at line 654 of file cpuid.hpp.

static std::string vsmc::CPUID::vendor ( )
inlinestatic

Vendor ID (EAX = 0x00; EBX, EDX, ECX)

Definition at line 590 of file cpuid.hpp.