ruvector_memopt/windows/
system.rs

1//! System-level Windows APIs
2
3use sysinfo::System;
4
5#[derive(Debug, Clone)]
6pub struct SystemInfo {
7    pub os_name: String,
8    pub kernel_version: String,
9    pub host_name: String,
10    pub cpu_count: usize,
11    pub cpu_usage: f32,
12    pub total_memory_mb: u64,
13    pub used_memory_mb: u64,
14}
15
16pub fn get_system_info() -> SystemInfo {
17    let mut sys = System::new_all();
18    sys.refresh_all();
19
20    SystemInfo {
21        os_name: System::name().unwrap_or_default(),
22        kernel_version: System::kernel_version().unwrap_or_default(),
23        host_name: System::host_name().unwrap_or_default(),
24        cpu_count: sys.cpus().len(),
25        cpu_usage: sys.global_cpu_info().cpu_usage(),
26        total_memory_mb: sys.total_memory() / 1024 / 1024,
27        used_memory_mb: sys.used_memory() / 1024 / 1024,
28    }
29}