This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new b83da3fc04 ARROW-17281: [C++] Fix cache size reporting on Windows
(#13813)
b83da3fc04 is described below
commit b83da3fc04fd357b19bb12ff693e4028e21715c5
Author: Yibo Cai <[email protected]>
AuthorDate: Tue Aug 9 14:05:02 2022 +0800
ARROW-17281: [C++] Fix cache size reporting on Windows (#13813)
Authored-by: Yibo Cai <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/src/arrow/util/cpu_info.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cpp/src/arrow/util/cpu_info.cc b/cpp/src/arrow/util/cpu_info.cc
index 3ba8db216e..0faf1e6f85 100644
--- a/cpp/src/arrow/util/cpu_info.cc
+++ b/cpp/src/arrow/util/cpu_info.cc
@@ -111,7 +111,8 @@ void OsRetrieveCacheSize(std::array<int64_t, kCacheLevels>*
cache_sizes) {
if (RelationCache == buffer_position->Relationship) {
PCACHE_DESCRIPTOR cache = &buffer_position->Cache;
if (cache->Level >= 1 && cache->Level <= kCacheLevels) {
- (*cache_sizes)[cache->Level - 1] += cache->Size;
+ const int64_t current = (*cache_sizes)[cache->Level - 1];
+ (*cache_sizes)[cache->Level - 1] = std::max<int64_t>(current,
cache->Size);
}
}
offset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);