You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to trickery on Apple's part, this call returns nothing on new Apple Silicon parts like the M1.
This can be confirmed by trying to call sysinfo::Cpu::frequency on an Apple Silicon device, or by running sysctl in a terminal:
$ sysctl hw.cpufrequency
# no output
$ sudo sysctl hw.cpufrequency
# no output
It seems that Apple Silicon broke a lot of sysinfo-like libraries in other languages, and there are long threads discussing potential solutions, e.g. here: giampaolo/psutil#1892
The upshot of that thread seems to be that parsing the voltage-states1-sram value from ioreg -l is the most promising way of determining something vaguely like the CPU's nominal frequency. I haven't dug into how to call ioreg via a syscall, or how to parse its output.
The text was updated successfully, but these errors were encountered:
Interesting, thanks for the information! I'd prefer to not run external binaries (because it's very slow) so I'll wait for a solution to appear before checking how this solution actually gets the information.
sysinfo
currently uses thesysctl
callhw.cpufrequency
to get the CPU frequency on macOS.sysinfo/src/apple/cpu.rs
Lines 128 to 134 in 463a88c
Due to trickery on Apple's part, this call returns nothing on new Apple Silicon parts like the M1.
This can be confirmed by trying to call
sysinfo::Cpu::frequency
on an Apple Silicon device, or by runningsysctl
in a terminal:It seems that Apple Silicon broke a lot of
sysinfo
-like libraries in other languages, and there are long threads discussing potential solutions, e.g. here: giampaolo/psutil#1892The upshot of that thread seems to be that parsing the
voltage-states1-sram
value fromioreg -l
is the most promising way of determining something vaguely like the CPU's nominal frequency. I haven't dug into how to callioreg
via a syscall, or how to parse its output.The text was updated successfully, but these errors were encountered: