Skip to content

Commit

Permalink
feat: use new power1_input interface instead of average when it is av…
Browse files Browse the repository at this point in the history
…ailable
  • Loading branch information
ilya-zlobintsev committed Nov 15, 2023
1 parent ca3292f commit 51e187e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lact-daemon/src/server/gpu_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl GpuController {
},
power: PowerStats {
average: self.hw_mon_and_then(HwMon::get_power_average),
current: self.hw_mon_and_then(HwMon::get_power_input),
cap_current: self.hw_mon_and_then(HwMon::get_power_cap),
cap_max: self.hw_mon_and_then(HwMon::get_power_cap_max),
cap_min: self.hw_mon_and_then(HwMon::get_power_cap_min),
Expand Down
7 changes: 6 additions & 1 deletion lact-gui/src/app/root_stack/oc_page/stats_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ impl StatsFrame {

let PowerStats {
average: power_average,
current: power_current,
cap_current: power_cap_current,
..
} = stats.power;

let power_current = power_current
.filter(|value| *value != 0.0)
.or(power_average);

self.power_usage_label.set_markup(&format!(
"<b>{}/{}W</b>",
power_average.unwrap_or(0.0),
power_current.unwrap_or(0.0),
power_cap_current.unwrap_or(0.0)
));

Expand Down
2 changes: 1 addition & 1 deletion lact-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
args = ["clap"]

[dependencies]
amdgpu-sysfs = { version = "0.12.2", features = ["serde"] }
amdgpu-sysfs = { version = "0.12.3", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
indexmap = { version = "*", features = ["serde"] }
clap = { version = "4.4.6", features = ["derive"], optional = true }
Expand Down
1 change: 1 addition & 0 deletions lact-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ pub struct VramStats {
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
pub struct PowerStats {
pub average: Option<f64>,
pub current: Option<f64>,
pub cap_current: Option<f64>,
pub cap_max: Option<f64>,
pub cap_min: Option<f64>,
Expand Down

0 comments on commit 51e187e

Please sign in to comment.