Expand description
§lscpu
Implementation of lscpu in rust
§Run a std example
cargo run --example stdThis code can be runned also in a no-std environment.
§Cpu Data:
/// Represents the main CPU information obtained via CPUID instructions.
pub struct Cpu {
/// Detected architecture (e.g., "x86_64").
pub architecture: &'static str,
/// Supported CPU operation modes (e.g., "32-bit, 64-bit").
pub cpu_op_modes: &'static str,
/// Physical and virtual address sizes.
pub address_sizes: String,
/// CPU byte order ("Little Endian" or "Big Endian").
pub byte_order: &'static str,
/// Total number of logical CPUs detected.
pub cpu_count: u32,
/// Number of online CPUs detected.
pub on_line_cpu: u32,
/// CPU vendor identifier.
pub vendor_id: String,
/// CPU model name.
pub model_name: String,
/// CPU family.
pub cpu_family: u32,
/// CPU model.
pub cpu_model: u32,
/// Indicates if the CPU is hybrid.
pub is_hybrid: &'static str,
/// Threads per core.
pub threads_per_core: u32,
/// Cores per socket.
pub cores_per_socket: u32,
/// Number of sockets detected.
pub sockets: u32,
/// CPU stepping.
pub stepping: u32,
/// Indicates if frequency boost is enabled.
pub boost_enabled: &'static str,
}Structs§
- Cpu
- Represents the main CPU information obtained via CPUID instructions.
Functions§
- fix_
result - Helper function to fix the result for certain topology queries.
- get_
address_ sizes - Returns the physical and virtual address sizes of the CPU.
- get_
boost_ enabled - Returns whether frequency boost is enabled (“enabled” or “disabled”).
- get_
byte_ order - Returns the CPU byte order (“Little Endian” or “Big Endian”).
- get_
cores_ per_ socket - Returns the number of cores per socket.
- get_
cpu_ architecture - Returns the detected CPU architecture (e.g., “x86_64”) using CPUID.
- get_
cpu_ count - Returns the total number of logical CPUs detected.
- get_
cpu_ family - Returns the CPU family number.
- get_
cpu_ model - Returns the CPU model number.
- get_
cpu_ op_ modes - Returns the supported CPU operation modes (e.g., “32-bit, 64-bit”).
- get_
hybrid_ flag - Returns whether the CPU is hybrid (“hybrid” or “no”).
- get_
model_ name - Returns the CPU model name as a string.
- get_
on_ line_ cpu - Returns the number of online CPUs detected.
- get_
sockets - Returns the number of sockets detected.
- get_
stepping - Returns the CPU stepping value.
- get_
threads_ per_ core - Returns the number of threads per core.
- get_
vendor_ id - Returns the CPU vendor identifier as a string.