Location: PHPKode > projects > DebWeb GUI > debwgui/functions/memory.php
<?php
// getting memory info and putting in array
exec ("$CMD_VMSTAT -s",$memarray);

// cleaning up the text and spaces and putting back in array
$memcleanup = preg_replace('/[^0-9]/', "", $memarray);

// making a list of variables based on the cleaned up array
list($totalmem, $usedmem, $activemem, $inactivemem, $freemem,$buffermem, $swapcache, $totalswap, $usedswap,$freeswap) = $memcleanup;

// calculate % used of total memory
if ($totalmem == 0) {
$totalmem = 1;
}
$memUsage = round(($usedmem * 100) / $totalmem, 0);

// calculate % user of total swap
if ($totalswap == 0) {
$totalswap = 1;
}
$swapUsage = round(($usedswap * 100) / $totalswap, 0);
?>
Return current item: DebWeb GUI