mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
delete core.rs
This commit is contained in:
parent
ee7ea6b86d
commit
1283e5be14
2 changed files with 3 additions and 52 deletions
51
src/core.rs
51
src/core.rs
|
@ -1,51 +0,0 @@
|
||||||
pub struct SystemInfo {
|
|
||||||
// Overall system details
|
|
||||||
pub cpu_model: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct CpuCoreInfo {
|
|
||||||
// Per-core data
|
|
||||||
pub core_id: u32,
|
|
||||||
pub temperature_celsius: Option<f32>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct CpuGlobalInfo {
|
|
||||||
// System-wide CPU settings
|
|
||||||
pub epp: Option<String>, // Energy Performance Preference
|
|
||||||
pub epb: Option<String>, // Energy Performance Bias
|
|
||||||
pub average_temperature_celsius: Option<f32>, // Average temperature across all cores
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct BatteryInfo {
|
|
||||||
// Battery status (AC connected, charging state, capacity, power rate, charge start/stop thresholds if available).
|
|
||||||
pub name: String,
|
|
||||||
pub ac_connected: bool,
|
|
||||||
pub charging_state: Option<String>, // e.g., "Charging", "Discharging", "Full"
|
|
||||||
pub capacity_percent: Option<u8>,
|
|
||||||
pub power_rate_watts: Option<f32>, // positive for charging, negative for discharging
|
|
||||||
pub charge_start_threshold: Option<u8>,
|
|
||||||
pub charge_stop_threshold: Option<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct SystemLoad {
|
|
||||||
// System load averages.
|
|
||||||
pub load_avg_1min: f32,
|
|
||||||
pub load_avg_5min: f32,
|
|
||||||
pub load_avg_15min: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct SystemReport {
|
|
||||||
// Now combine all the above for a snapshot of the system state.
|
|
||||||
pub system_info: SystemInfo,
|
|
||||||
pub cpu_cores: Vec<CpuCoreInfo>,
|
|
||||||
pub cpu_global: CpuGlobalInfo,
|
|
||||||
pub batteries: Vec<BatteryInfo>,
|
|
||||||
pub system_load: SystemLoad,
|
|
||||||
pub timestamp: std::time::SystemTime, // so we know when the report was generated
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum OperationalMode {
|
|
||||||
Powersave,
|
|
||||||
Performance,
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@ use std::{
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
|
||||||
use crate::config;
|
use crate::{config, system};
|
||||||
|
|
||||||
/// Calculate the idle time multiplier based on system idle time.
|
/// Calculate the idle time multiplier based on system idle time.
|
||||||
///
|
///
|
||||||
|
@ -254,6 +254,8 @@ pub fn run(config: config::DaemonConfig) -> anyhow::Result<()> {
|
||||||
})
|
})
|
||||||
.context("failed to set Ctrl-C handler")?;
|
.context("failed to set Ctrl-C handler")?;
|
||||||
|
|
||||||
|
let mut system = system::System::new()?;
|
||||||
|
|
||||||
while !cancelled.load(Ordering::SeqCst) {}
|
while !cancelled.load(Ordering::SeqCst) {}
|
||||||
|
|
||||||
log::info!("exiting...");
|
log::info!("exiting...");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue