alnilam-hal 0.0.4

Alnilam HAL
Documentation
// Copyright (c) TribuFu. All Rights Reserved.

use crate::get_system_info;
use sysinfo::{CpuExt, SystemExt};

/// Returns the number of physical cores of the current CPU.
pub fn get_physical_cores() -> usize {
    num_cpus::get_physical()
}

/// Returns the number of logical cores of the current CPU.
pub fn get_logical_cores() -> usize {
    num_cpus::get()
}

/// Returns the model of the current CPU.
pub fn get_processor_model() -> String {
    get_system_info()
        .global_cpu_info()
        .brand()
        .trim()
        .to_string()
}

/// Returns the vendor of the current CPU.
pub fn get_processor_vendor() -> String {
    get_system_info()
        .global_cpu_info()
        .vendor_id()
        .trim()
        .to_string()
}