Skip to main content

check_system_resources

Function check_system_resources 

Source
pub fn check_system_resources() -> ResourceStatus
Expand description

Check system resource health

Monitors two key indicators:

  1. Process memory usage - Via macOS ps command (fails safe on other platforms)
  2. GPU pending operation count - Proxy for GPU memory pressure

§Thresholds

Critical (operation should abort):

  • Process memory >90% of system RAM
  • GPU pending ops >100

Warning (elevated but operational):

  • Process memory >70% of system RAM
  • GPU pending ops >50

§Platform Support

  • macOS: Full memory monitoring via ps command
  • Other platforms: Only monitors GPU pending count (memory always returns healthy)

§Example

ⓘ
use volta::gpu::monitor::{check_system_resources, ResourceStatus};

match check_system_resources() {
    ResourceStatus::Critical(msg) => {
        panic!("Test aborted - critical resources: {}", msg);
    }
    ResourceStatus::Warning(msg) => {
        eprintln!("Warning: {}", msg);
    }
    ResourceStatus::Healthy => {}
}