Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Resources/CPU.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,22 @@ public class Monitor.CPU : Object {
get {
double summed = 0;
int number_of_temperatures = temperatures.size;
if (number_of_temperatures == 0) return 0.0;
foreach (var temperature in temperatures.values) {
if (number_of_temperatures == 0) {
return 0.0;
}

// The newer AMD Ryzen CPU's requires the zenpower module to provide the Tdie temperature value.
if (temperatures.has_key ("Tdie")) {
return double.parse (temperatures["Tdie"].input) / 1000;
}

// checking if AMD Ryzen; in AMD Ryzen we only want Tdie
if (temperature.label == "Tdie") return double.parse (temperature.input) / 1000;
// The k10temp module does not expose Tdie, so use the Tctl temperature value as fallback.
if (temperatures.has_key ("Tctl")) {
return double.parse (temperatures["Tctl"].input) / 1000;
}

// for Intel we want only temperatures of cores
// Intel we want only temperatures of cores.
foreach (var temperature in temperatures.values) {
if (temperature.label.contains ("Package")) {
number_of_temperatures--;
continue;
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/Hwmon/HwmonPathsParser.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Monitor.HwmonPathParser : Object {

if (interface_name == "coretemp" ||
interface_name == "k10temp" ||
interface_name == "cpu_thermal"
interface_name == "cpu_thermal" ||
interface_name == "zenpower"
) {
debug ("Found HWMON CPU Interface: %s in: %s", interface_name, hwmonx_name);
this.parse (cpu_paths_parser, hwmonx);
Expand Down
Loading