clippy clean up
This commit is contained in:
parent
4c6c707dd0
commit
11506699e3
@ -6,7 +6,7 @@ pub struct GpuMetrics {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub utilization_gpu_pct: u32, // 0..100
|
pub utilization_gpu_pct: u32, // 0..100
|
||||||
pub mem_used_bytes: u64,
|
pub mem_used_bytes: u64,
|
||||||
pub mem_total_bytes: u64
|
pub mem_total_bytes: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>> {
|
pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>> {
|
||||||
@ -17,7 +17,7 @@ pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>>
|
|||||||
name: gpu.model().to_string(),
|
name: gpu.model().to_string(),
|
||||||
utilization_gpu_pct: info.load_pct() as u32,
|
utilization_gpu_pct: info.load_pct() as u32,
|
||||||
mem_used_bytes: info.used_vram(),
|
mem_used_bytes: info.used_vram(),
|
||||||
mem_total_bytes: info.total_vram()
|
mem_total_bytes: info.total_vram(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(vec![metrics])
|
Ok(vec![metrics])
|
||||||
|
|||||||
@ -62,7 +62,7 @@ async fn main() {
|
|||||||
wake_sampler: Arc::new(Notify::new()),
|
wake_sampler: Arc::new(Notify::new()),
|
||||||
auth_token: std::env::var("SOCKTOP_TOKEN")
|
auth_token: std::env::var("SOCKTOP_TOKEN")
|
||||||
.ok()
|
.ok()
|
||||||
.filter(|s| !s.is_empty())
|
.filter(|s| !s.is_empty()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start background sampler (adjust cadence as needed)
|
// Start background sampler (adjust cadence as needed)
|
||||||
|
|||||||
@ -13,13 +13,13 @@ pub struct Metrics {
|
|||||||
pub swap_total_mb: u64,
|
pub swap_total_mb: u64,
|
||||||
pub swap_used_mb: u64,
|
pub swap_used_mb: u64,
|
||||||
pub net_aggregate: NetTotals,
|
pub net_aggregate: NetTotals,
|
||||||
pub top_processes: Vec<Proc>
|
pub top_processes: Vec<Proc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct NetTotals {
|
pub struct NetTotals {
|
||||||
pub rx_bytes: u64,
|
pub rx_bytes: u64,
|
||||||
pub tx_bytes: u64
|
pub tx_bytes: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@ -28,5 +28,5 @@ pub struct Proc {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub cpu: f32,
|
pub cpu: f32,
|
||||||
pub mem_mb: u64,
|
pub mem_mb: u64,
|
||||||
pub status: String
|
pub status: String,
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ impl AppState {
|
|||||||
last_json: Arc::new(RwLock::new(String::new())),
|
last_json: Arc::new(RwLock::new(String::new())),
|
||||||
client_count: Arc::new(AtomicUsize::new(0)),
|
client_count: Arc::new(AtomicUsize::new(0)),
|
||||||
wake_sampler: Arc::new(Notify::new()),
|
wake_sampler: Arc::new(Notify::new()),
|
||||||
auth_token: std::env::var("SOCKTOP_TOKEN").ok().filter(|s| !s.is_empty())
|
auth_token: std::env::var("SOCKTOP_TOKEN").ok().filter(|s| !s.is_empty()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user