Giter Club home page Giter Club logo

rust-cpuid's Introduction

cpuid Crates.io Standard checks

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 works in no_std environments. Some additional cargo features require std (e.g., pretty printing, serialization).

  • For Intel platforms: The code should be in sync with the March 2018 revision of the Intel Architectures SDM.
  • For AMD platforms it should be in sync with the AMD64 systems manual no. 24594, Revision 3.32 (March 2021).

Library usage

use raw_cpuid::CpuId;
let cpuid = CpuId::new();

if let Some(vf) = cpuid.get_vendor_info() {
    assert!(vf.as_str() == "GenuineIntel" || vf.as_str() == "AuthenticAMD");
}

let has_sse = cpuid.get_feature_info().map_or(false, |finfo| finfo.has_sse());
if has_sse {
    println!("CPU supports SSE!");
}

if let Some(cparams) = cpuid.get_cache_parameters() {
    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);
    }
} else {
    println!("No cache parameter information available")
}

cpuid binary

raw-cpuid ships with a cpuid binary that can be installed to inspect the output of the CPUID instruction on a host system.

To install, use:

cargo install raw-cpuid --features cli

The cli feature is currently required to build the binary version due to cargo limitations.

Documentation

rust-cpuid's People

Contributors

gz avatar umio-yasuno avatar phip1611 avatar dependabot[bot] avatar gabrielmajeri avatar isaacdynamo avatar waywardmonkeys avatar niklasf avatar ericson2314 avatar semiviral avatar hiraokatakuya avatar mkeeter avatar tones111 avatar pireax avatar tylerwhall avatar alex-mckenna avatar spaceeraser avatar a1phyr avatar colinfinck avatar g2p avatar johnbartholomew avatar mssun avatar npmccallum avatar olivierlemasle avatar rafalmiel avatar stlankes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.