pub struct Capabilities {
pub strict_memory_binding: bool,
pub strict_cpu_affinity: bool,
pub memory_locking: bool,
pub numa_balancing_disabled: bool,
pub numa_node_count: usize,
}Expand description
Detected system capabilities for NUMA operations.
This struct provides information about what NUMA features are available on the current system, including kernel capabilities, system settings, and hardware topology.
§Example
use numaperf_core::Capabilities;
let caps = Capabilities::detect();
println!("System capabilities: {}", caps.summary());
if caps.supports_hard_mode() {
println!("Hard mode is fully supported");
} else {
println!("Missing capabilities:");
for cap in caps.missing_for_hard_mode() {
println!(" - {}", cap);
}
}Fields§
§strict_memory_binding: boolHas CAP_SYS_ADMIN (for strict memory binding with MPOL_BIND).
strict_cpu_affinity: boolHas CAP_SYS_NICE (for strict CPU affinity with realtime scheduling).
memory_locking: boolHas CAP_IPC_LOCK (for memory locking with mlock).
numa_balancing_disabled: boolKernel NUMA balancing is disabled (kernel.numa_balancing=0).
numa_node_count: usizeNumber of NUMA nodes detected on the system.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect current system capabilities.
This reads from /proc and /sys filesystems to determine
what NUMA features are available.
Sourcepub fn supports_hard_mode(&self) -> bool
pub fn supports_hard_mode(&self) -> bool
Check if all hard mode requirements are met.
Hard mode requires:
- CAP_SYS_ADMIN for strict memory binding
- CAP_SYS_NICE for strict CPU affinity
- NUMA balancing disabled to prevent kernel migration
Sourcepub fn missing_for_hard_mode(&self) -> Vec<&'static str>
pub fn missing_for_hard_mode(&self) -> Vec<&'static str>
Get a list of missing capabilities required for hard mode.
Returns an empty list if supports_hard_mode() returns true.
Sourcepub fn is_numa_system(&self) -> bool
pub fn is_numa_system(&self) -> bool
Check if this is a NUMA system (more than one node).
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more