You can use the sysinfo
crate in Rust to get the CPU frequency (in Hz) in a Linux system. Here's an example code snippet to get the CPU frequency:
main.rs276 chars12 lines
Make sure to add sysinfo
crate to your Cargo.toml
:
34 chars3 lines
Additionally, this code will work for Linux systems, but if you want to get CPU frequency on other systems, you'll need to use different approaches.
gistlibby LogSnag