Skip to content

Commit

Permalink
Add AMD Ryzen temperature based on "die" of the CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Nov 16, 2020
1 parent 21bf940 commit 9463635
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions proc/linux-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ sub get_current_cpu_temps
my $fh = "SENSORS";
my $aa;
my $ab;
my $ac;
&open_execute_command($fh, "sensors </dev/null 2>/dev/null", 1);
while(<$fh>) {
if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) {
Expand All @@ -522,7 +523,7 @@ sub get_current_cpu_temps
if ($aa && /temp(\d+):\s+([\+\-][0-9\.]+)\s+.*?[=+].*?\)/) {
# Adjust to start from `0` as all other outputs
push(@rvx, { 'core' => (int($1) - 1),
'temp' => $2 });
'temp' => $2 });
}

# New line - new device
Expand All @@ -531,10 +532,20 @@ sub get_current_cpu_temps
$ab = 1 if (/cpu_thermal-virtual-[\d]+/i);
# Get odd output like in #1280
if ($ab && /temp(\d+):\s+([\+\-][0-9\.]+)/) {
push(@rvx, { 'core' => $1,
'temp' => $2 });
}
push(@rvx, { 'core' => $1,
'temp' => $2 });
}

# AMD Ryzen oddness
$ac = 0 if (/^\s*$/);
# Check for CPU
$ac = 1 if (/[\d]+temp-pci/i);
# Get odd output like in #discussion/600155
if ($ac && /Tdie:\s+([\+\-][0-9\.]+)/) {
push(@rvx, { 'core' => 0,
'temp' => $1 });
}
}
}
close($fh);
}
Expand Down

0 comments on commit 9463635

Please sign in to comment.