• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..30-Mar-2022-

ci/H30-Mar-2022-13189

examples/H30-Mar-2022-331263

src/H30-Mar-2022-5,3544,307

.cargo-checksum.jsonH A D03-May-202289 11

AUTHORSH A D30-Mar-2022113 43

Cargo.lockH A D30-Mar-20224.1 KiB162143

Cargo.tomlH A D30-Mar-20221.6 KiB5648

LICENSE.mdH A D30-Mar-20221.1 KiB2117

README.mdH A D30-Mar-20221.3 KiB3930

build.rsH A D30-Mar-2022500 1714

README.md

1# cpuid [![Build Status](https://travis-ci.org/gz/rust-cpuid.svg)](https://travis-ci.org/gz/rust-cpuid) [![Crates.io](https://img.shields.io/crates/v/raw_cpuid.svg)](https://crates.io/crates/raw-cpuid)
2
3A 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.
4
5The code should be in sync with the latest March 2018 revision of the Intel Architectures Software Developer’s Manual.
6
7## Library usage
8```rust
9let cpuid = CpuId::new();
10
11match cpuid.get_vendor_info() {
12    Some(vf) => assert!(vf.as_string() == "GenuineIntel"),
13    None => ()
14}
15
16let has_sse = match cpuid.get_feature_info() {
17    Some(finfo) => finfo.has_sse(),
18    None => false
19};
20
21if has_sse {
22    println!("CPU supports SSE!");
23}
24
25match cpuid.get_cache_parameters() {
26    Some(cparams) => {
27        for cache in cparams {
28            let size = cache.associativity() * cache.physical_line_partitions() * cache.coherency_line_size() * cache.sets();
29            println!("L{}-Cache size is {}", cache.level(), size);
30        }
31    },
32    None => println!("No cache parameter information available"),
33}
34```
35
36## Documentation
37* [API Documentation](https://docs.rs/raw-cpuid/)
38* [Examples](https://github.com/gz/rust-cpuid/tree/master/examples)
39