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

Method CacheSize

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

Source from the content-addressed store, hash-verified

400}
401
402int64_t CpuInfo::CacheSize(CacheLevel level) const {
403 constexpr auto kDefaultCacheSizes = std::array<int64_t, 3>{
404 32 * 1024, // Level 1: 32K
405 256 * 1024, // Level 2: 256K
406 3072 * 1024, // Level 3: 3M
407 };
408 static_assert(kDefaultCacheSizes.size() == kCacheLevels);
409
410 static_assert(static_cast<int>(CacheLevel::L1) == 0);
411 const int i = static_cast<int>(level);
412 if (cache_sizes_[i] > 0) return cache_sizes_[i];
413 if (i == 0) return kDefaultCacheSizes[0];
414 // l3 may be not available, return maximum of l2 or default size
415 return std::max(kDefaultCacheSizes[i], cache_sizes_[i - 1]);
416}
417
418bool CpuInfo::IsSupported(int64_t flags) const {
419 return (hardware_flags_ & flags) == flags;

Callers 3

benchmark_util.hFile · 0.80
TESTFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64