修复运行内存单位错误的问题

调整load保留两位小数
This commit is contained in:
Chenx221 2024-04-15 16:43:52 +08:00
parent 83c68999e5
commit 34cb3ae2b9
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -159,7 +159,7 @@ class SystemInfoHelper
$this->ram = FileSizeHelper::formatBytes($computer->TotalPhysicalMemory); $this->ram = FileSizeHelper::formatBytes($computer->TotalPhysicalMemory);
} }
} else { } else {
$this->ram = FileSizeHelper::formatBytes(intval(shell_exec("grep MemTotal /proc/meminfo | awk '{print $2}'"))); $this->ram = FileSizeHelper::formatBytes(intval(shell_exec("grep MemTotal /proc/meminfo | awk '{print $2}'"))*1024);
} }
if ($this->EnableTimeRecords) { if ($this->EnableTimeRecords) {
$this->timeRecords['detectRam'] = microtime(true) - $start; $this->timeRecords['detectRam'] = microtime(true) - $start;
@ -239,7 +239,7 @@ class SystemInfoHelper
if ($this->EnableTimeRecords) { if ($this->EnableTimeRecords) {
$start = microtime(true); $start = microtime(true);
} }
$this->load = sys_getloadavg()[0]; $this->load = round(sys_getloadavg()[0],2);
if ($this->EnableTimeRecords) { if ($this->EnableTimeRecords) {
$this->timeRecords['detectLoad'] = microtime(true) - $start; $this->timeRecords['detectLoad'] = microtime(true) - $start;
} }