#cpuid #x86 #amd64 #os #libcore

bin+lib raw-cpuid

A library to parse the x86 CPUID instruction, written in rust with no external dependencies. The implementation closely resembles the Intel CPUID manual description. The library does only depend on libcore.

26 releases (stable)

7.0.3 Sep 8, 2019
6.1.0 Nov 12, 2018
6.0.0 Oct 2, 2018
5.0.0 Jul 13, 2018
0.0.2 Mar 24, 2015

#1 in #x86

Download history 1361/week @ 2019-05-26 1428/week @ 2019-06-02 1591/week @ 2019-06-09 1732/week @ 2019-06-16 2653/week @ 2019-06-23 1855/week @ 2019-06-30 1784/week @ 2019-07-07 1709/week @ 2019-07-14 1816/week @ 2019-07-21 2485/week @ 2019-07-28 2576/week @ 2019-08-04 1966/week @ 2019-08-11 3426/week @ 2019-08-18 3967/week @ 2019-08-25 3434/week @ 2019-09-01

10,295 downloads per month
Used in 47 crates (11 directly)

MIT license

180KB
4.5K SLoC

cpuid Build Status Crates.io

A library to parse the x86 CPUID instruction, written in rust with no external dependencies. The implementation closely resembles the Intel CPUID manual description. The library does only depend on libcore.

The code should be in sync with the latest March 2018 revision of the Intel Architectures Software Developer’s Manual.

Library usage

let cpuid = CpuId::new();

match cpuid.get_vendor_info() {
    Some(vf) => assert!(vf.as_string() == "GenuineIntel"),
    None => ()
}

let has_sse = match cpuid.get_feature_info() {
    Some(finfo) => finfo.has_sse(),
    None => false
};

if has_sse {
    println!("CPU supports SSE!");
}

match cpuid.get_cache_parameters() {
    Some(cparams) => {
        for cache in cparams {
            let size = cache.associativity() * cache.physical_line_partitions() * cache.coherency_line_size() * cache.sets();
            println!("L{}-Cache size is {}", cache.level(), size);
        }
    },
    None => println!("No cache parameter information available"),
}

Documentation

Dependencies

~18–380KB