Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <cpu-info.h>
Public Types | |
enum | CacheLevel { L1_CACHE = 0, L2_CACHE = 1, L3_CACHE = 2 } |
Cache enums for L1 (data), L2 and L3. More... | |
Static Public Member Functions | |
static void | Init () |
Initialize CpuInfo. More... | |
static void | VerifyCpuRequirements () |
static int64_t | hardware_flags () |
Returns all the flags for this cpu. More... | |
static bool | IsSupported (long flag) |
Returns whether of not the cpu supports this flag. More... | |
static void | EnableFeature (long flag, bool enable) |
static long | CacheSize (CacheLevel level) |
Returns the size of the cache in KB at this cache level. More... | |
static int64_t | cycles_per_ms () |
Returns the number of cpu cycles per millisecond. More... | |
static int | num_cores () |
Returns the number of cores (including hyper-threaded) on this machine. More... | |
static std::string | model_name () |
Returns the model name of the cpu (e.g. Intel i7-2600) More... | |
static std::string | DebugString () |
Static Public Attributes | |
static const int64_t | SSSE3 = (1 << 1) |
static const int64_t | SSE4_1 = (1 << 2) |
static const int64_t | SSE4_2 = (1 << 3) |
static const int64_t | POPCNT = (1 << 4) |
Static Private Attributes | |
static bool | initialized_ = false |
static int64_t | hardware_flags_ = 0 |
static int64_t | original_hardware_flags_ |
static long | cache_sizes_ [L3_CACHE+1] |
static int64_t | cycles_per_ms_ |
static int | num_cores_ = 1 |
static std::string | model_name_ = "unknown" |
CpuInfo is an interface to query for cpu information at runtime. The caller can ask for the sizes of the caches and what hardware features are supported. On Linux, this information is pulled from a couple of sys files (/proc/cpuinfo and /sys/devices)
Definition at line 30 of file cpu-info.h.
Cache enums for L1 (data), L2 and L3.
Enumerator | |
---|---|
L1_CACHE | |
L2_CACHE | |
L3_CACHE |
Definition at line 38 of file cpu-info.h.
|
inlinestatic |
Returns the size of the cache in KB at this cache level.
Definition at line 68 of file cpu-info.h.
References cache_sizes_, and initialized_.
Referenced by DebugString().
|
inlinestatic |
Returns the number of cpu cycles per millisecond.
Definition at line 74 of file cpu-info.h.
References cycles_per_ms_, and initialized_.
Referenced by impala::Benchmark::Measure().
|
static |
Definition at line 155 of file cpu-info.cc.
References CacheSize(), impala::flag, impala::flag_mappings, initialized_, IsSupported(), L1_CACHE, L2_CACHE, L3_CACHE, model_name_, num_cores_, impala::num_flags, and impala::PrettyPrinter::Print().
Referenced by impala::Webserver::RootHandler(), and impala::TEST().
|
static |
Toggle a hardware feature on and off. It is not valid to turn on a feature that the underlying hardware cannot support. This is useful for testing.
Definition at line 144 of file cpu-info.cc.
References impala::flag, hardware_flags_, initialized_, and original_hardware_flags_.
|
inlinestatic |
Returns all the flags for this cpu.
Definition at line 52 of file cpu-info.h.
References hardware_flags_, and initialized_.
|
static |
Initialize CpuInfo.
Definition at line 75 of file cpu-info.cc.
References cache_sizes_, impala::colon, cycles_per_ms_, hardware_flags_, initialized_, model_name_, impala::name, num_cores(), num_cores_, original_hardware_flags_, and impala::ParseCPUFlags().
Referenced by main().
|
inlinestatic |
Returns whether of not the cpu supports this flag.
Definition at line 58 of file cpu-info.h.
References hardware_flags_, and initialized_.
Referenced by CheckSseSupport(), impala::HashUtil::CrcHash(), DebugString(), impala::DelimitedTextParser::FindFirstInstance(), impala::LlvmCodeGen::GetHashFunction(), impala::HashUtil::Hash(), impala::LlvmCodeGen::LoadImpalaIR(), impala::DelimitedTextParser::ParseFieldLocations(), impala::DelimitedTextParser::ParseSingleTuple(), impala::DelimitedTextParser::ParseSse(), impala::BitUtil::Popcount(), impala::StringCompare(), StringCompare1(), StringCompare2(), StringCompare3(), and VerifyCpuRequirements().
|
inlinestatic |
Returns the model name of the cpu (e.g. Intel i7-2600)
Definition at line 86 of file cpu-info.h.
References initialized_, and model_name_.
Referenced by impala::Benchmark::GetMachineInfo().
|
inlinestatic |
Returns the number of cores (including hyper-threaded) on this machine.
Definition at line 80 of file cpu-info.h.
References initialized_, and num_cores_.
Referenced by Init(), and impala::ThreadResourceMgr::ThreadResourceMgr().
|
static |
Determine if the CPU meets the minimum CPU requirements and if not, issue an error and terminate.
Definition at line 137 of file cpu-info.cc.
References IsSupported(), and SSSE3.
|
staticprivate |
Definition at line 97 of file cpu-info.h.
Referenced by CacheSize(), and Init().
|
staticprivate |
Definition at line 98 of file cpu-info.h.
Referenced by cycles_per_ms(), and Init().
|
staticprivate |
Definition at line 95 of file cpu-info.h.
Referenced by EnableFeature(), hardware_flags(), Init(), and IsSupported().
|
staticprivate |
Definition at line 94 of file cpu-info.h.
Referenced by CacheSize(), cycles_per_ms(), DebugString(), EnableFeature(), hardware_flags(), Init(), IsSupported(), model_name(), and num_cores().
|
staticprivate |
Definition at line 100 of file cpu-info.h.
Referenced by DebugString(), Init(), and model_name().
|
staticprivate |
Definition at line 99 of file cpu-info.h.
Referenced by DebugString(), Init(), and num_cores().
|
staticprivate |
Definition at line 96 of file cpu-info.h.
Referenced by EnableFeature(), and Init().
|
static |
Definition at line 35 of file cpu-info.h.
Referenced by impala::BitUtil::Popcount().
|
static |
Definition at line 33 of file cpu-info.h.
|
static |
Definition at line 34 of file cpu-info.h.
Referenced by CheckSseSupport(), impala::HashUtil::CrcHash(), impala::DelimitedTextParser::FindFirstInstance(), impala::LlvmCodeGen::GetHashFunction(), impala::HashUtil::Hash(), impala::LlvmCodeGen::LoadImpalaIR(), impala::DelimitedTextParser::ParseFieldLocations(), impala::DelimitedTextParser::ParseSingleTuple(), impala::DelimitedTextParser::ParseSse(), impala::StringCompare(), StringCompare1(), StringCompare2(), and StringCompare3().
|
static |
Definition at line 32 of file cpu-info.h.
Referenced by VerifyCpuRequirements().