Refactor: Return frequency as double (#1782)

Adjusted the GetSysctl call in sysinfo.cc to ensure the frequency
value is returned as a double rather than an integer. This helps
maintain consistency and clarity in the codebase.
This commit is contained in:
dhairya 2024-04-13 05:22:31 +08:00 committed by GitHub
parent 70916cbf71
commit d6ce145287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -736,7 +736,7 @@ double GetCPUCyclesPerSecond(CPUInfo::Scaling scaling) {
#if defined BENCHMARK_OS_OPENBSD #if defined BENCHMARK_OS_OPENBSD
if (GetSysctl(freqStr, &hz)) return static_cast<double>(hz * 1000000); if (GetSysctl(freqStr, &hz)) return static_cast<double>(hz * 1000000);
#else #else
if (GetSysctl(freqStr, &hz)) return hz; if (GetSysctl(freqStr, &hz)) return static_cast<double>(hz);
#endif #endif
fprintf(stderr, "Unable to determine clock rate from sysctl: %s: %s\n", fprintf(stderr, "Unable to determine clock rate from sysctl: %s: %s\n",
freqStr, strerror(errno)); freqStr, strerror(errno));