#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.

29 releases (stable)

8.1.1 Jul 3, 2020
8.0.0 Apr 29, 2020
7.0.3 Sep 8, 2019
6.1.0 Nov 12, 2018
0.0.2 Mar 24, 2015

#1 in Hardware support

Download history 11151/week @ 2020-05-28 10395/week @ 2020-06-04 11237/week @ 2020-06-11 11837/week @ 2020-06-18 12475/week @ 2020-06-25 10365/week @ 2020-07-02 11037/week @ 2020-07-09 11469/week @ 2020-07-16 10513/week @ 2020-07-23 11347/week @ 2020-07-30 11496/week @ 2020-08-06 11329/week @ 2020-08-13 13592/week @ 2020-08-20 12509/week @ 2020-08-27 12444/week @ 2020-09-03 14592/week @ 2020-09-10

54,661 downloads per month
Used in 115 crates (21 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

~17–370KB