MCPcopy Create free account
hub / github.com/apache/arrow / CpuInfo

Method CpuInfo

cpp/src/arrow/util/cpu_info.cc:378–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376} // namespace
377
378CpuInfo::CpuInfo() {
379 OsRetrieveCacheSize(&cache_sizes_);
380 OsRetrieveCpuInfo(&hardware_flags_, &vendor_);
381 original_hardware_flags_ = hardware_flags_;
382 num_cores_ = std::max(static_cast<int>(std::thread::hardware_concurrency()), 1);
383
384 // parse user simd level
385 auto maybe_env_var = GetEnvVar("ARROW_USER_SIMD_LEVEL");
386 if (!maybe_env_var.ok()) {
387 return;
388 }
389 std::string s = *std::move(maybe_env_var);
390 std::transform(s.begin(), s.end(), s.begin(),
391 [](unsigned char c) { return std::toupper(c); });
392 if (!ArchParseUserSimdLevel(s, &hardware_flags_)) {
393 ARROW_LOG(WARNING) << "Invalid value for ARROW_USER_SIMD_LEVEL: " << s;
394 }
395}
396
397const CpuInfo* CpuInfo::GetInstance() {
398 static const CpuInfo cpu_info;

Callers

nothing calls this directly

Calls 7

OsRetrieveCacheSizeFunction · 0.85
OsRetrieveCpuInfoFunction · 0.85
GetEnvVarFunction · 0.85
ArchParseUserSimdLevelFunction · 0.85
okMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected