| 376 | } // namespace |
| 377 | |
| 378 | CpuInfo::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 | |
| 397 | const CpuInfo* CpuInfo::GetInstance() { |
| 398 | static const CpuInfo cpu_info; |
nothing calls this directly
no test coverage detected