diff options
| author | Erik Kundiman <erik@megapahit.org> | 2023-12-31 20:17:04 +0800 | 
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2024-06-05 19:47:19 +0800 | 
| commit | 2117dca25e1d15cbbf9def774ec0fac29e5c01dd (patch) | |
| tree | ea73ee8ad8472908c3ecabe503c95df1a647b070 /indra | |
| parent | 268281a5705b277eb0b1c9d5f3e63fc0d637c261 (diff) | |
tbfreq x clockrate.hz only when cpufrequency is 0
Just maybe M3 implements cpufrequency, which should be more accurate
than the alternative (different results on my Intel Mac).
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llcommon/llprocessor.cpp | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index f07a32c179..d3ff48073d 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -637,15 +637,15 @@ public:      LLProcessorInfoDarwinImpl()      {          getCPUIDInfo(); -#ifdef __arm64__ -        auto frequency = getSysctlInt64("hw.tbfrequency"); -        struct clockinfo clockrate; -        auto clockrate_len = sizeof(clockrate); -        if (!sysctlbyname("kern.clockrate", &clockrate, &clockrate_len, NULL, 0)) -            frequency *= clockrate.hz; -#else          uint64_t frequency = getSysctlInt64("hw.cpufrequency"); -#endif +        if (!frequency) +        { +            auto tbfrequency = getSysctlInt64("hw.tbfrequency"); +            struct clockinfo clockrate; +            auto clockrate_len = sizeof(clockrate); +            if (!sysctlbyname("kern.clockrate", &clockrate, &clockrate_len, NULL, 0)) +                frequency = tbfrequency * clockrate.hz; +        }          setInfo(eFrequency, (F64)frequency  / (F64)1000000);      } | 
