Addition of Error Correction Type information

It would be great to start integrating ECC/EDAC support to unRAID, one of the first steps might be the relevant information from the BIOS/UEFI.

It would be good to reduce the `dmidecode -t 16` calls to one, I'm not aware if `Maximum Capacity` and `Error Correction Type` can be extracted with `awk` in one go without having to `explode` the row, otherwise it would be fine.
This commit is contained in:
realies
2017-09-22 01:30:59 +03:00
committed by GitHub
parent 4fde569a6b
commit 4b48bf768f
@@ -140,10 +140,14 @@ $memory_installed = exec("dmidecode -t 17 | awk -F: '/^\tSize: [0-9]+ MB$/{t+=$2
// might have two or more of these. The trick is to filter out any Flash/Bios types by matching on GB
// Sum up all the Physical Memory Arrays to get the motherboard's total memory capacity
$memory_maximum = exec("dmidecode -t 16 | awk -F: '/^\tMaximum Capacity: [0-9]+ GB$/{t+=$2} END{print t}'");
// Read the physical memory info again and extract the error correction type. If the type is "None",
// empty the correction type string, otherwise insert a whitespace at the end of it as a hacky separator.
$ecc_support = exec("dmidecode -t 16 | awk -F': ' '/^\tError Correction Type: / {print $2}'");
if($ecc_support == "None") $ecc_support = ""; else $ecc_support = $ecc_support." ";
$star = "";
// If maximum < installed then roundup maximum to the next power of 2 size of installed. E.g. 6 -> 8 or 12 -> 16
if ($memory_maximum < $memory_installed) {$memory_maximum = pow(2,ceil(log($memory_installed)/log(2))); $star = "*";}
echo "$memory_installed GB (max. installable capacity $memory_maximum GB)$star";
echo "$memory_installed GB $ecc_support(max. installable capacity $memory_maximum GB)$star";
?>
</div>
<div><span class="key">Network:</span>