Skip to content

[benchmark] Fix OpenBSD build #97269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged

[benchmark] Fix OpenBSD build #97269

merged 1 commit into from
Jul 1, 2024

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Jul 1, 2024

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)
@llvmbot
Copy link
Member

llvmbot commented Jul 1, 2024

@llvm/pr-subscribers-third-party-benchmark

Author: Brad Smith (brad0)

Changes

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)


Full diff: https://github.com/llvm/llvm-project/pull/97269.diff

1 Files Affected:

  • (modified) third-party/benchmark/src/sysinfo.cc (+2-2)
diff --git a/third-party/benchmark/src/sysinfo.cc b/third-party/benchmark/src/sysinfo.cc
index 46df973b069a7..2bed1663af2e9 100644
--- a/third-party/benchmark/src/sysinfo.cc
+++ b/third-party/benchmark/src/sysinfo.cc
@@ -169,7 +169,7 @@ ValueUnion GetSysctlImp(std::string const& name) {
       mib[1] = HW_CPUSPEED;
     }
 
-    if (sysctl(mib, 2, buff.data(), &buff.Size, nullptr, 0) == -1) {
+    if (sysctl(mib, 2, buff.data(), &buff.size, nullptr, 0) == -1) {
       return ValueUnion();
     }
     return buff;
@@ -742,7 +742,7 @@ double GetCPUCyclesPerSecond(CPUInfo::Scaling scaling) {
 #endif
   unsigned long long hz = 0;
 #if defined BENCHMARK_OS_OPENBSD
-  if (GetSysctl(freqStr, &hz)) return hz * 1000000;
+  if (GetSysctl(freqStr, &hz)) return static_cast<double>(hz * 1000000);
 #else
   if (GetSysctl(freqStr, &hz)) return hz;
 #endif

Copy link
Member

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for making sure this was in upstream google/benchmakr first!

@brad0 brad0 merged commit 3eb795c into llvm:main Jul 1, 2024
7 checks passed
@brad0 brad0 deleted the openbsd_sysinfo branch July 1, 2024 21:11
lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants