Expand description
§Automatic Hardware/Software Feature Detection
Runtime detection and automatic configuration of platform-specific features.
§Overview
This module provides unified detection of system capabilities including:
- Kernel Version: Linux kernel features (
io_uring, XDP requirements) - CPU Features: SIMD capabilities (AVX2, AVX-512, NEON), cache configuration
- I/O Capabilities:
io_uringsupport levels, storage type detection - Network: XDP/eBPF availability
- Memory: NUMA topology, huge pages, total memory
§Usage
use laminar_core::detect::SystemCapabilities;
// Detect all system capabilities (cached after first call)
let caps = SystemCapabilities::detect();
// Print system summary
println!("{}", caps.summary());
// Get recommended configuration
let config = caps.recommended_config();
println!("Recommended cores: {}", config.num_cores);
println!("Use io_uring: {}", config.use_io_uring);§Auto-Configuration
Use SystemCapabilities::recommended_config() to get an optimized configuration
based on detected hardware:
ⓘ
use laminar_core::detect::SystemCapabilities;
use laminar_core::tpc::TpcConfig;
use laminar_core::io_uring::IoUringConfig;
let caps = SystemCapabilities::detect();
let recommended = caps.recommended_config();
// Apply to TPC runtime
let tpc_config = TpcConfig::builder()
.num_cores(recommended.num_cores)
.cpu_pinning(recommended.cpu_pinning)
.numa_aware(recommended.numa_aware)
.build()?;§Platform Support
| Feature | Linux | Windows | macOS |
|---|---|---|---|
| Kernel version | Full | N/A | Darwin |
| CPU features | Full | Full | Full |
| NUMA nodes | Full | Single | Single |
| io_uring | Full | N/A | N/A |
| XDP | Full | N/A | N/A |
| Storage detection | Full | Limited | Limited |
| Huge pages | Full | Limited | Limited |
Structs§
- CpuFeatures
- CPU feature flags.
- IoUring
Capabilities io_uringcapabilities.- Kernel
Version - Linux kernel version.
- Memory
Info - Memory information.
- Recommended
Config - Recommended configuration based on detected capabilities.
- Storage
Info - Storage device information.
- System
Capabilities - Detected system capabilities.
- XdpCapabilities
- XDP/eBPF capabilities.
Enums§
- Performance
Tier - Performance tier based on available features.
- Platform
- Detected platform.
- Simd
Level - SIMD capability level.
- Storage
Type - Storage device type.
Functions§
- cache_
line_ size - Detect the cache line size.
- is_
smt_ enabled - Check if SMT (Hyper-Threading) is enabled.
- logical_
cpu_ count - Get the number of logical CPUs.
- physical_
cpu_ count - Get the number of physical CPU cores.