Merge pull request #1192 from shirou/feature/m1_not_return_when_cpu_freq

[cpu][mac] change not return error even if cpu.frequency errors
pull/1199/merge
shirou 4 years ago committed by GitHub
commit c6bccaff3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -87,10 +87,9 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
// Use the rated frequency of the CPU. This is a static value and does not
// account for low power or Turbo Boost modes.
cpuFrequency, err := unix.SysctlUint64("hw.cpufrequency")
if err != nil {
return ret, err
if err == nil {
c.Mhz = float64(cpuFrequency) / 1000000.0
}
c.Mhz = float64(cpuFrequency) / 1000000.0
return append(ret, c), nil
}

Loading…
Cancel
Save