memory();
$_text = " \n"
. " " . htmlspecialchars($mem['ram']['t_free'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['ram']['t_used'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['ram']['total'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['ram']['percent'], ENT_QUOTES) . "\n";
if (isset($mem['ram']['app_percent']))
$_text .= " " . htmlspecialchars($mem['ram']['app'], ENT_QUOTES) . "\n " . htmlspecialchars($mem['ram']['app_percent'], ENT_QUOTES) . "\n";
if (isset($mem['ram']['buffers_percent']))
$_text .= " " . htmlspecialchars($mem['ram']['buffers'], ENT_QUOTES) . "\n " . htmlspecialchars($mem['ram']['buffers_percent'], ENT_QUOTES) . "\n";
if (isset($mem['ram']['cached_percent']))
$_text .= " " . htmlspecialchars($mem['ram']['cached'], ENT_QUOTES) . "\n " . htmlspecialchars($mem['ram']['cached_percent'], ENT_QUOTES) . "\n";
$_text .= " \n"
. " \n"
. " " . htmlspecialchars($mem['swap']['free'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['swap']['used'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['swap']['total'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($mem['swap']['percent'], ENT_QUOTES) . "\n"
. " \n"
. " \n";
$i = 0;
foreach ($mem['devswap'] as $device) {
$_text .=" \n"
. " " . htmlspecialchars($i++, ENT_QUOTES) . "\n"
. " Swap"
. " " . htmlspecialchars($device['dev'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($device['percent'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($device['free'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($device['used'], ENT_QUOTES) . "\n"
. " " . htmlspecialchars($device['total'], ENT_QUOTES) . "\n"
. " \n";
}
$_text .= " \n";
return $_text;
}
//
// xml_memory()
//
function html_memory () {
global $XPath;
global $text;
$textdir = direction();
$scale_factor = 2;
$ram = create_bargraph($XPath->getData("/phpsysinfo/Memory/Used"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
$ram .= " " . $XPath->getData("/phpsysinfo/Memory/Percent") . "% ";
$swap = create_bargraph($XPath->getData("/phpsysinfo/Swap/Used"), $XPath->getData("/phpsysinfo/Swap/Total"), $scale_factor);
$swap .= " " . $XPath->getData("/phpsysinfo/Swap/Percent") . "% ";
if ($XPath->match("/phpsysinfo/Memory/AppPercent")) {
$app = create_bargraph($XPath->getData("/phpsysinfo/Memory/App"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
$app .= " " . $XPath->getData("/phpsysinfo/Memory/AppPercent") . "% ";
}
if ($XPath->match("/phpsysinfo/Memory/BuffersPercent")) {
$buffers = create_bargraph($XPath->getData("/phpsysinfo/Memory/Buffers"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
$buffers .= " " . $XPath->getData("/phpsysinfo/Memory/BuffersPercent") . "% ";
}
if ($XPath->match("/phpsysinfo/Memory/CachedPercent")) {
$cached = create_bargraph($XPath->getData("/phpsysinfo/Memory/Cached"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
$cached .= " " . $XPath->getData("/phpsysinfo/Memory/CachedPercent") . "% ";
}
$_text = "
\n"
. " \n"
. " \n"
. " \n"
. " \n"
. " \n"
. " \n"
. "
\n"
. " \n"
. " " . $text['phymem'] . " | \n"
. " " . $ram . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Free")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Used")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Total")) . " | \n"
. "
\n";
if (isset($app)) {
$_text .= " \n"
. " - " . $text['app'] . " | \n"
. " " . $app . " | \n"
. " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/App")) . " | \n"
. " | \n"
. "
\n";
}
if (isset($buffers)) {
$_text .= " \n"
. " - " . $text['buffers'] . " | \n"
. " " . $buffers . " | \n"
. " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Buffers")) . " | \n"
. " | \n"
. "
\n";
}
if (isset($cached)) {
$_text .= " \n"
. " - " . $text['cached'] . " | \n"
. " " . $cached . " | \n"
. " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Cached")) . " | \n"
. " | \n"
. "
\n";
}
$_text .= " \n"
. " " . $text['swap'] . " | \n"
. " " . $swap . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Free")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Used")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Total")) . " | \n"
. "
\n";
if (($max = sizeof($XPath->getDataParts("/phpsysinfo/Swapdevices"))) > 2) {
for($i = 1; $i < $max; $i++) {
$swapdev = create_bargraph($XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Used"), $XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Size"), $scale_factor);
$swapdev .= " " . $XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Percent") . "% ";
$_text .= " \n"
. " - " . $XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Device/Name") . " | \n"
. " " . $swapdev . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Free")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Used")) . " | \n"
. " " . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[$i]/Size")) . " | \n"
. "
\n";
}
}
$_text .= "
";
return $_text;
}
function wml_memory() {
global $XPath;
global $text;
$_text = "\n"
. "" . $text['phymem'] . ":
\n"
. "- " . $text['free'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Free")) . "
\n"
. "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Used")) . "
\n"
. "- " . $text['size'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Total")) . "
\n";
if ($XPath->match("/phpsysinfo/Memory/App")) {
$_text .= "" . $text['app'] . ":
\n"
. "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/App")) . "
\n";
}
if ($XPath->match("/phpsysinfo/Memory/Cached")) {
$_text .= "" . $text['cached'] . ":
\n"
. "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Cached")) . "
\n";
}
if ($XPath->match("/phpsysinfo/Memory/Buffers")) {
$_text .= "" . $text['buffers'] . ":
\n"
. "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Memory/Buffers")) . "
\n";
}
$_text .= "
" . $text['swap'] . ":
\n"
. "- " . $text['free'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Free")) . "
\n"
. "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Used")) . "
\n"
. "- " . $text['size'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Swap/Total")) . "
\n";
$_text .= "\n";
return $_text;
}
?>