From 9463635e746004051f2f8cb51b48d7236ae2aebc Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Mon, 16 Nov 2020 22:22:22 +0300 Subject: [PATCH] Add AMD Ryzen temperature based on "die" of the CPU https://sourceforge.net/p/webadmin/discussion/600155/thread/a9d8fe19c0/?limit=25 --- proc/linux-lib.pl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/proc/linux-lib.pl b/proc/linux-lib.pl index 17ec20b05..6add0aeed 100755 --- a/proc/linux-lib.pl +++ b/proc/linux-lib.pl @@ -500,6 +500,7 @@ if (&has_command("sensors")) { my $fh = "SENSORS"; my $aa; my $ab; + my $ac; &open_execute_command($fh, "sensors /dev/null", 1); while(<$fh>) { if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) { @@ -522,7 +523,7 @@ if (&has_command("sensors")) { 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 @@ -531,10 +532,20 @@ if (&has_command("sensors")) { $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); }