diff options
Diffstat (limited to 'lib/SystemStatistics.php')
-rw-r--r-- | lib/SystemStatistics.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/SystemStatistics.php b/lib/SystemStatistics.php index 28966de..d139831 100644 --- a/lib/SystemStatistics.php +++ b/lib/SystemStatistics.php @@ -58,7 +58,9 @@ class SystemStatistics { 'freespace' => $this->view->free_space(), 'cpuload' => sys_getloadavg(), 'mem_total' => $memoryUsage['mem_total'], - 'mem_free' => $memoryUsage['mem_free'] + 'mem_free' => $memoryUsage['mem_free'], + 'swap_total' => $memoryUsage['swap_total'], + 'swap_free' => $memoryUsage['swap_free'] ]; } @@ -75,7 +77,7 @@ class SystemStatistics { } // check if determining memoryUsage failed if ($memoryUsage === false) { - return ['mem_free' => 'N/A', 'mem_total' => 'N/A']; + return ['mem_free' => 'N/A', 'mem_total' => 'N/A', 'swap_free' => 'N/A', 'swap_total' => 'N/A']; } $array = explode(PHP_EOL, $memoryUsage); // the last value is a empty string after explode, skip it @@ -94,8 +96,10 @@ class SystemStatistics { } return [ - 'mem_free' => (int)$available + (int)$data['SwapFree'], - 'mem_total' => (int)$data['MemTotal'] + (int)$data['SwapTotal'] + 'mem_free' => (int)$available, + 'mem_total' => (int)$data['MemTotal'], + 'swap_free' => (int)$data['SwapFree'], + 'swap_total' => (int)$data['SwapTotal'] ]; } |