fixed comments

This commit is contained in:
2025-10-01 12:11:34 +02:00
parent 8c49a63a50
commit f78e48900a
11 changed files with 146 additions and 144 deletions

View File

@@ -2,20 +2,20 @@ use anyhow::Result;
use std::error::Error;
use sysinfo::System;
//! # CPU Hardware Module
//!
//! This module provides CPU information collection for WatcherAgent, including load, temperature, and system uptime.
//!
//! ## Responsibilities
//! - **CPU Detection:** Identifies CPU model and core count.
//! - **Metric Collection:** Queries CPU load, temperature, and uptime.
//! - **Error Handling:** Graceful fallback if metrics are unavailable.
//!
//! ## Units
//! - `current_load`: CPU usage as a percentage (**0.0100.0**)
//! - `current_temp`: CPU temperature in **degrees Celsius (°C)**
//! - `uptime`: System uptime in **seconds (s)**
//!
/// # CPU Hardware Module
///
/// This module provides CPU information collection for WatcherAgent, including load, temperature, and system uptime.
///
/// ## Responsibilities
/// - **CPU Detection:** Identifies CPU model and core count.
/// - **Metric Collection:** Queries CPU load, temperature, and uptime.
/// - **Error Handling:** Graceful fallback if metrics are unavailable.
///
/// ## Units
/// - `current_load`: CPU usage as a percentage (**0.0100.0**)
/// - `current_temp`: CPU temperature in **degrees Celsius (°C)**
/// - `uptime`: System uptime in **seconds (s)**
///
/// CPU statistics for the host system.
///
/// # Fields

View File

@@ -7,19 +7,19 @@ use sysinfo::{Component, Components, Disk, Disks};
use serde::Serialize;
//! # Disk Hardware Module
//!
//! This module provides disk information collection for WatcherAgent, including total and per-disk statistics and temperature data.
//!
//! ## Responsibilities
//! - **Disk Enumeration:** Lists all physical disks and their properties.
//! - **Usage Calculation:** Computes total and per-disk usage, available space, and usage percentage.
//! - **Temperature Monitoring:** Associates disk components with temperature sensors if available.
//!
//! ## Units
//! - All sizes are in **bytes** unless otherwise noted.
//! - Temperatures are in **degrees Celsius (°C)**.
//!
/// # Disk Hardware Module
///
/// This module provides disk information collection for WatcherAgent, including total and per-disk statistics and temperature data.
///
/// ## Responsibilities
/// - **Disk Enumeration:** Lists all physical disks and their properties.
/// - **Usage Calculation:** Computes total and per-disk usage, available space, and usage percentage.
/// - **Temperature Monitoring:** Associates disk components with temperature sensors if available.
///
/// ## Units
/// - All sizes are in **bytes** unless otherwise noted.
/// - Temperatures are in **degrees Celsius (°C)**.
///
/// Summary of disk statistics for the system.
///
/// # Fields

View File

@@ -2,21 +2,21 @@ use anyhow::Result;
use nvml_wrapper::Nvml;
use std::error::Error;
//! # GPU Hardware Module
//!
//! This module provides GPU information collection for WatcherAgent, including load, temperature, and VRAM statistics.
//!
//! ## Responsibilities
//! - **GPU Detection:** Identifies GPU model and capabilities.
//! - **Metric Collection:** Queries GPU load, temperature, and VRAM usage using NVML (NVIDIA only).
//! - **Error Handling:** Graceful fallback if GPU or NVML is unavailable.
//!
//! ## Units
//! - `current_load`: GPU usage as a percentage (**0.0100.0**)
//! - `current_temp`: GPU temperature in **degrees Celsius (°C)**
//! - `vram_total`: Total VRAM in **megabytes (MB)**
//! - `vram_used`: Used VRAM in **megabytes (MB)**
//!
/// # GPU Hardware Module
///
/// This module provides GPU information collection for WatcherAgent, including load, temperature, and VRAM statistics.
///
/// ## Responsibilities
/// - **GPU Detection:** Identifies GPU model and capabilities.
/// - **Metric Collection:** Queries GPU load, temperature, and VRAM usage using NVML (NVIDIA only).
/// - **Error Handling:** Graceful fallback if GPU or NVML is unavailable.
///
/// ## Units
/// - `current_load`: GPU usage as a percentage (**0.0100.0**)
/// - `current_temp`: GPU temperature in **degrees Celsius (°C)**
/// - `vram_total`: Total VRAM in **megabytes (MB)**
/// - `vram_used`: Used VRAM in **megabytes (MB)**
///
/// GPU statistics for the host system.
///
/// # Fields

View File

@@ -3,18 +3,18 @@ use std::error::Error;
use anyhow::Result;
use sysinfo::System;
//! # Memory Hardware Module
//!
//! This module provides memory information collection for WatcherAgent, including total, used, and free RAM.
//!
//! ## Responsibilities
//! - **Memory Detection:** Queries system for total, used, and free RAM.
//! - **Usage Calculation:** Computes memory usage percentage.
//! - **Error Handling:** Graceful fallback if metrics are unavailable.
//!
//! ## Units
//! - `total`, `used`, `free`: RAM in **megabytes (MB)**
//!
/// # Memory Hardware Module
///
/// This module provides memory information collection for WatcherAgent, including total, used, and free RAM.
///
/// ## Responsibilities
/// - **Memory Detection:** Queries system for total, used, and free RAM.
/// - **Usage Calculation:** Computes memory usage percentage.
/// - **Error Handling:** Graceful fallback if metrics are unavailable.
///
/// ## Units
/// - `total`, `used`, `free`: RAM in **megabytes (MB)**
///
/// Memory statistics for the host system.
///
/// # Fields

View File

@@ -14,14 +14,14 @@ pub use memory::get_memory_info;
pub use network::get_network_info;
pub use network::NetworkMonitor;
//! # Hardware Module
//!
//! This module aggregates all hardware subsystems for WatcherAgent, providing unified collection and access to CPU, GPU, memory, disk, and network statistics.
//!
//! ## Responsibilities
//! - **Subsystem Aggregation:** Combines all hardware modules into a single struct for easy access.
//! - **Unified Collection:** Provides a single async method to collect all hardware metrics at once.
//!
/// # Hardware Module
///
/// This module aggregates all hardware subsystems for WatcherAgent, providing unified collection and access to CPU, GPU, memory, disk, and network statistics.
///
/// ## Responsibilities
/// - **Subsystem Aggregation:** Combines all hardware modules into a single struct for easy access.
/// - **Unified Collection:** Provides a single async method to collect all hardware metrics at once.
///
/// Aggregated hardware statistics for the host system.
///
/// # Fields

View File

@@ -2,18 +2,18 @@ use std::error::Error;
use std::result::Result;
use std::time::Instant;
//! # Network Hardware Module
//!
//! This module provides network information collection for WatcherAgent, including interface enumeration and bandwidth statistics.
//!
//! ## Responsibilities
//! - **Interface Detection:** Lists all network interfaces.
//! - **Bandwidth Monitoring:** Tracks receive/transmit rates using a rolling monitor.
//! - **Error Handling:** Graceful fallback if metrics are unavailable.
//!
//! ## Units
//! - `rx_rate`, `tx_rate`: Network bandwidth in **bytes per second (B/s)**
//!
/// # Network Hardware Module
///
/// This module provides network information collection for WatcherAgent, including interface enumeration and bandwidth statistics.
///
/// ## Responsibilities
/// - **Interface Detection:** Lists all network interfaces.
/// - **Bandwidth Monitoring:** Tracks receive/transmit rates using a rolling monitor.
/// - **Error Handling:** Graceful fallback if metrics are unavailable.
///
/// ## Units
/// - `rx_rate`, `tx_rate`: Network bandwidth in **bytes per second (B/s)**
///
/// Network statistics for the host system.
///
/// # Fields