Skip to main content

Module detect

Module detect 

Source
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_uring support 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

FeatureLinuxWindowsmacOS
Kernel versionFullN/ADarwin
CPU featuresFullFullFull
NUMA nodesFullSingleSingle
io_uringFullN/AN/A
XDPFullN/AN/A
Storage detectionFullLimitedLimited
Huge pagesFullLimitedLimited

Structs§

CpuFeatures
CPU feature flags.
IoUringCapabilities
io_uring capabilities.
KernelVersion
Linux kernel version.
MemoryInfo
Memory information.
RecommendedConfig
Recommended configuration based on detected capabilities.
StorageInfo
Storage device information.
SystemCapabilities
Detected system capabilities.
XdpCapabilities
XDP/eBPF capabilities.

Enums§

PerformanceTier
Performance tier based on available features.
Platform
Detected platform.
SimdLevel
SIMD capability level.
StorageType
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.