Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/serverinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-11-13 17:05:10 +0300
committerGitHub <noreply@github.com>2017-11-13 17:05:10 +0300
commit9e6b60768498206e80d4f603c49777da62883d3d (patch)
tree42c31f6ca8774f111861b9baa37207fea39e15bf /lib
parent54f746cb107dcf1565d740720d17785bf0587cbf (diff)
parent2a3b31b2dc626ac4eed86f7a2c40e1e6c70c9f6d (diff)
Merge pull request #105 from Noodlesalat/masterv13.0.0beta1
Splitted swap and memory graph into two different graphs
Diffstat (limited to 'lib')
-rw-r--r--lib/SystemStatistics.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/SystemStatistics.php b/lib/SystemStatistics.php
index ca0aa07..d9cd669 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']
];
}
@@ -88,7 +90,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
@@ -107,8 +109,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']
];
}