cpuid

Crates.iocpuid
lib.rscpuid
version0.1.1
sourcesrc
created_at2014-11-21 14:12:40.343368
updated_at2015-12-11 23:58:10.571132
descriptionRust bindings for libpcuid CPU detection and feature extraction library.
homepagehttps://github.com/zsiciarz/rust-cpuid
repositoryhttps://github.com/zsiciarz/rust-cpuid
max_upload_size
id304
size15,611
rust-libs (github:doublify:rust-libs)

documentation

http://www.rust-ci.org/zsiciarz/rust-cpuid/doc/cpuid/

README

rust-cpuid

crates.io Build Status Coverage Status

Rust bindings for libpcuid CPU detection and feature extraction library.

Usage

First - download, and build libcpuid as described in the readme. Install it by running make install (you may want to run ldconfig afterwards).

Add to your Cargo.toml:

[dependencies]
cpuid = "*"

Add extern crate cpuid to your crate root and you're good to go! For example:

extern crate cpuid;

fn main () {
    match cpuid::identify() {
        Ok(info) => {
            println!("Found: {} CPU, model: {}", info.vendor, info.codename);
            println!("The full brand string is: {}", info.brand);
            println!("Hardware AES support: {}", if info.has_feature(cpuid::CpuFeature::AES) { "yes" } else { "no" });
        },
        Err(err) => println!("cpuid error: {}", err),
    };
    match cpuid::clock_frequency() {
        Some(frequency) => println!("CPU speed: {} MHz", frequency),
        None => println!("Couldn't get CPU speed."),
    };
}

Resources

Author

  • Zbigniew Siciarz (zbigniew at siciarz dot net)

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

Commit count: 93

cargo fmt