cyb70289 commented on code in PR #13112:
URL: https://github.com/apache/arrow/pull/13112#discussion_r873587685
##########
cpp/src/arrow/util/io_util_test.cc:
##########
@@ -731,5 +732,31 @@ TEST(Memory, GetRSS) {
#endif
}
+// Some loose tests to check if the cpuinfo makes sense
+TEST(CpuInfo, Basic) {
+ const CpuInfo* ci = CpuInfo::GetInstance();
+
+ ASSERT_TRUE(ci->num_cores() >= 1 && ci->num_cores() <= 1000);
+
+ const auto l1 = ci->CacheSize(CpuInfo::CacheLevel::L1);
+ const auto l2 = ci->CacheSize(CpuInfo::CacheLevel::L2);
+ const auto l3 = ci->CacheSize(CpuInfo::CacheLevel::L3);
+ ASSERT_TRUE(l1 <= l2 && l2 <= l3);
+ ASSERT_TRUE(l1 >= 4 * 1024 && l1 <= 512 * 1024);
+ ASSERT_TRUE(l2 >= 32 * 1024 && l2 <= 8 * 1024 * 1024);
+ ASSERT_TRUE(l3 >= 256 * 1024 && l3 <= 128 * 1024 * 1024);
+
+ // Toggle hardware flags
+ CpuInfo* ci_rw = const_cast<CpuInfo*>(ci);
+ const int64_t original_hardware_flags = ci->hardware_flags();
+ ci_rw->EnableFeature(original_hardware_flags, false);
+ ASSERT_EQ(ci->hardware_flags(), 0);
+ ci_rw->EnableFeature(original_hardware_flags, true);
+ ASSERT_EQ(ci->hardware_flags(), original_hardware_flags);
+}
+
+// Dump detecetd cpu features in CI for manual check, not a real test
+TEST(CpuInfo, DISABLED_DebugMessage) { FAIL() <<
CpuInfo::GetInstance()->DebugMessage(); }
Review Comment:
Removed this test and `CpuInfo::DebugMessage`. Not a useful api.
##########
cpp/src/arrow/util/cpu_info.cc:
##########
@@ -200,44 +93,59 @@ bool RetrieveCacheSize(int64_t* cache_sizes) {
GetModuleHandle("kernel32"), "GetLogicalProcessorInformation");
if (!func_pointer) {
- return false;
+ return;
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]