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

Method CacheSize

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

Source from the content-addressed store, hash-verified

554const std::string& CpuInfo::model_name() const { return impl_->model_name; }
555
556int64_t CpuInfo::CacheSize(CacheLevel level) const {
557 constexpr int64_t kDefaultCacheSizes[] = {
558 32 * 1024, // Level 1: 32K
559 256 * 1024, // Level 2: 256K
560 3072 * 1024, // Level 3: 3M
561 };
562 static_assert(
563 sizeof(kDefaultCacheSizes) / sizeof(kDefaultCacheSizes[0]) == kCacheLevels, "");
564
565 static_assert(static_cast<int>(CacheLevel::L1) == 0, "");
566 const int i = static_cast<int>(level);
567 if (impl_->cache_sizes[i] > 0) return impl_->cache_sizes[i];
568 if (i == 0) return kDefaultCacheSizes[0];
569 // l3 may be not available, return maximum of l2 or default size
570 return std::max(kDefaultCacheSizes[i], impl_->cache_sizes[i - 1]);
571}
572
573bool CpuInfo::IsSupported(int64_t flags) const {
574 return (impl_->hardware_flags & flags) == flags;

Callers 3

benchmark_util.hFile · 0.80
TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64