diff options
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | libs/memory.php | 13 |
2 files changed, 11 insertions, 6 deletions
@@ -245,7 +245,7 @@ $update = $Config->checkUpdate(); <table class="firstBold"> <tbody> <tr> - <td class="w20p">Used</td> + <td class="w20p">Used %</td> <td><div class="progressbar-wrap"><div class="progressbar" style="width: 0%;">0%</div></div></td> </tr> <tr> @@ -277,7 +277,7 @@ $update = $Config->checkUpdate(); <table class="firstBold"> <tbody> <tr> - <td class="w20p">Used</td> + <td class="w20p">Used %</td> <td><div class="progressbar-wrap"><div class="progressbar" style="width: 0%;">0%</div></div></td> </tr> <tr> diff --git a/libs/memory.php b/libs/memory.php index 67fee34..81d9ac9 100644 --- a/libs/memory.php +++ b/libs/memory.php @@ -1,14 +1,19 @@ <?php require 'Utils/Misc.class.php'; -// Free -if (!($free = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $4+$6+$7}\''))) +$free = 0; + +if (shell_exec('cat /proc/meminfo')) { - $free = 0; + $free = shell_exec('grep MemFree /proc/meminfo | awk \'{print $2}\''); + $buffers = shell_exec('grep Buffers /proc/meminfo | awk \'{print $2}\''); + $cached = shell_exec('grep Cached /proc/meminfo | awk \'{print $2}\''); + + $free = (int)$free + (int)$buffers + (int)$cached; } // Total -if (!($total = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $2}\''))) +if (!($total = shell_exec('grep MemTotal /proc/meminfo | awk \'{print $2}\''))) { $total = 0; } |