valpackett / systemstat

Rust library for getting system information | also on https://codeberg.org/valpackett/systemstat

Home Page:https://crates.io/crates/systemstat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request for proper name/model of CPU

raum-dellamorte opened this issue · comments

I have a project I'm working on that I think I'm about to incorporate your crate for. The goal is to get the name and clock rate of the CPU and GPU, the amount of RAM and its clock rate, and the total storage size of attached SSDs and HDDs, and to display them on the screen in a screensaver kind of fashion. I'm having a hard time finding a way to do this. It looks like your crate will work great for the RAM and other useful info, but right now I'm resorting to using command line output from wmic on windows to get the proper name of the processor and it feels hacky. It works, but I want it to compile and run on any system, not just windows. It tells me I have an Intel Core i5, etc., which is true, but there has to be a way to get that same string without resorting to the command line.

In summary... PLEASE! PLEASE PLEASE PLEASE!
I'm sorry, I lost it there for a minute.

You can use cpuid as an OS-independent way to get CPU data on x86 (64) machines.

Thanks! While it does add the complication of compiling a C library, the rust interface looks super simple. There's a chance that the C code is portable... I'll close this.

For anyone else who might wind up here, the cupid crate did exactly what I wanted without resorting to trying to work with a C library. cpuid would be easier to compile on a Posix system. One of my favourite things about Rust is ease of compilation. Thanks again, never would have found cupid if I hadn't started with cpuid.