ResourceMonitor

Models & Types · AiDotNet.TrainingMonitoring.Resources

Monitors system resources (CPU, memory, GPU) during training.

Implements: IDisposable

How It Works

For Beginners: The ResourceMonitor tracks hardware utilization to help you understand if your training is bottlenecked by resources.

Key metrics:

  • CPU Usage: How much processing power is being used
  • Memory Usage: RAM consumption and available memory
  • GPU Usage: Graphics card utilization (if available)
  • GPU Memory: VRAM consumption (if available)

Example usage:

Constructors

Constructor Summary
ResourceMonitor(int maxHistorySize) Initializes a new instance of the ResourceMonitor class.

Properties

Property Summary
ResourceThresholds Thresholds { get; set; } Gets or sets the resource warning thresholds.
bool IsRunning { get; } Gets whether the monitor is currently running.
bool MonitorGpu { get; set; } Gets or sets whether to attempt GPU monitoring.
string NvidiaSmiPath { get; set; } Gets or sets the path to nvidia-smi executable.

Methods

Method Summary
List<ResourceSnapshot> GetHistory(int? limit) Gets the resource history.
ResourceSnapshot GetAverage() Gets average resource usage over the history period.
ResourceSnapshot GetPeak() Gets peak resource usage.
ResourceSnapshot GetSnapshot() Gets the current resource snapshot.
void ClearHistory() Clears the history.
void Dispose() Disposes the resource monitor.
void Start(TimeSpan? interval) Starts the resource monitor.
void Stop() Stops the resource monitor.