fix: 修复 Tauri 编译错误(SystemStatsResponse 定义)
问题: - SystemStatsResponse 在 bin/proxy.rs 中定义 - 库模块 proxy.rs 和 validate.rs 试图从 super 导入,但路径错误 修复: - 将 SystemStatsResponse 定义移到库模块 proxy.rs - 在 validate.rs 中添加正确的导入 - 移除 bin/proxy.rs 中的重复定义(稍后处理)
This commit is contained in:
@@ -1244,7 +1244,36 @@ mod macmon_sampler {
|
||||
pub fn get_metrics() -> Option<MacmonData> { None }
|
||||
}
|
||||
|
||||
pub use super::SystemStatsResponse;
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
pub struct SystemStatsResponse {
|
||||
pub cpu_used_percent: f64,
|
||||
pub memory_used_percent: f64,
|
||||
pub memory_available_mb: u64,
|
||||
pub memory_total_mb: u64,
|
||||
pub swap_used_percent: f64,
|
||||
pub swap_available_mb: u64,
|
||||
pub swap_total_mb: u64,
|
||||
pub gpu_available: bool,
|
||||
pub gpu_utilization: Option<f64>,
|
||||
pub gpu_memory_used_pct: Option<f64>,
|
||||
pub ane_available: bool,
|
||||
pub ane_utilization: Option<f64>,
|
||||
pub source: String,
|
||||
pub chip_name: Option<String>,
|
||||
pub cpu_power: Option<f64>,
|
||||
pub gpu_power: Option<f64>,
|
||||
pub ane_power: Option<f64>,
|
||||
pub sys_power: Option<f64>,
|
||||
pub ram_power: Option<f64>,
|
||||
pub cpu_temp: Option<f64>,
|
||||
pub gpu_temp: Option<f64>,
|
||||
pub ecpu_freq_mhz: Option<u32>,
|
||||
pub pcpu_freq_mhz: Option<u32>,
|
||||
pub gpu_freq_mhz: Option<u32>,
|
||||
pub ecpu_cores: Option<u8>,
|
||||
pub pcpu_cores: Option<u8>,
|
||||
pub gpu_cores: Option<u8>,
|
||||
}
|
||||
|
||||
async fn get_system_stats_handler() -> Response {
|
||||
// 1. Try macmon first (Apple Silicon only)
|
||||
|
||||
@@ -5,6 +5,8 @@ use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use super::proxy::SystemStatsResponse;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum ValidationStatus {
|
||||
Pass,
|
||||
@@ -282,7 +284,7 @@ pub fn validate_thermal_state_via_pmset() -> Option<MetricValidation> {
|
||||
|
||||
// ==================== Main Validation Function ====================
|
||||
|
||||
pub fn run_validation(layers: &[u32], macmon_stats: &super::SystemStatsResponse) -> ValidationResult {
|
||||
pub fn run_validation(layers: &[u32], macmon_stats: &SystemStatsResponse) -> ValidationResult {
|
||||
write_log(&format!("[INFO] Validation started: layers={:?}", layers));
|
||||
|
||||
let mut result = ValidationResult {
|
||||
|
||||
Reference in New Issue
Block a user