17 #include <boost/algorithm/string.hpp>
30 using boost::algorithm::contains;
31 using boost::algorithm::trim;
35 DEFINE_int32(num_cores, 0,
"(Advanced) If > 0, it sets the number of cores available to"
36 " Impala. Setting it to 0 means Impala will use all available cores on the machine"
37 " according to /proc/cpuinfo.");
86 ifstream cpuinfo(
"/proc/cpuinfo", ios::in);
88 getline(cpuinfo, line);
89 size_t colon = line.find(
':');
90 if (colon != string::npos) {
91 name = line.substr(0, colon - 1);
92 value = line.substr(colon + 1, string::npos);
95 if (name.compare(
"flags") == 0) {
97 }
else if (name.compare(
"cpu MHz") == 0) {
102 float mhz = atof(value.c_str());
103 max_mhz = max(mhz, max_mhz);
104 }
else if (name.compare(
"processor") == 0) {
106 }
else if (name.compare(
"model name") == 0) {
111 if (cpuinfo.is_open()) cpuinfo.close();
132 if (FLAGS_num_cores > 0)
num_cores_ = FLAGS_num_cores;
139 LOG(ERROR) <<
"CPU does not support the Supplemental SSE3 (SSSE3) instruction set, "
140 <<
"which is required. Exiting if Supplemental SSE3 is not functional...";
161 stream <<
"Cpu Info:" << endl
167 <<
" Hardware Supports:" << endl;
const StringSearch UrlParser::colon_search & colon
DEFINE_int32(num_cores, 0,"(Advanced) If > 0, it sets the number of cores available to"" Impala. Setting it to 0 means Impala will use all available cores on the machine"" according to /proc/cpuinfo.")
static void EnableFeature(long flag, bool enable)
static const int64_t SSSE3
static long cache_sizes_[L3_CACHE+1]
static void VerifyCpuRequirements()
static std::string Print(bool value, TUnit::type ignored, bool verbose=false)
static int64_t original_hardware_flags_
static long CacheSize(CacheLevel level)
Returns the size of the cache in KB at this cache level.
static int64_t hardware_flags_
static const int64_t POPCNT
static int64_t cycles_per_ms_
static const int64_t SSE4_2
static std::string DebugString()
static const int64_t SSE4_1
static std::string model_name_
DECLARE_bool(abort_on_config_error)
static void Init()
Initialize CpuInfo.
static int num_cores()
Returns the number of cores (including hyper-threaded) on this machine.
int64_t ParseCPUFlags(const string &values)
static bool IsSupported(long flag)
Returns whether of not the cpu supports this flag.
static struct impala::@19 flag_mappings[]
static const long num_flags