本文整理汇总了PHP中uptime函数的典型用法代码示例。如果您正苦于以下问题:PHP uptime函数的具体用法?PHP uptime怎么用?PHP uptime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uptime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wml_vitals
function wml_vitals()
{
global $XPath;
global $text;
$_text = "<card id=\"vitals\" title=\"" . $text['vitals'] . "\">\n" . "<p>" . $text['hostname'] . ":<br/>\n" . "- " . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</p>\n" . "<p>" . $text['ip'] . ":<br/>\n" . "- " . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</p>\n" . "<p>" . $text['kversion'] . ":<br/>\n" . "- " . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</p>\n" . "<p>" . $text['uptime'] . ":<br/>\n" . "- " . uptime($XPath->getData("/phpsysinfo/Vitals/Uptime")) . "</p>\n" . "<p>" . $text['users'] . ":<br/>" . "- " . $XPath->getData("/phpsysinfo/Vitals/Users") . "</p>\n" . "<p>" . $text['loadavg'] . ":<br/>" . "- " . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . "</p>\n" . "</card>\n";
return $_text;
}
示例2: passthru
</font></div></td>
</tr>
<tr>
<TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> </FONT></TD>
</tr>
</table></TD>
</TR></TBODY></TABLE>
<TABLE cellSpacing=0 width="100%" bgColor="#e97948" background="images/frame4.gif" border=0>
<TBODY>
<TR>
<TD><div align="left"><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#000000 size=2>Pbx Hostname: <?php
echo passthru('hostname');
?>
</FONT></div></TD>
<TD><div align="right"><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#000000 size=2><?php
echo "online: " . uptime();
?>
</FONT></div></TD>
</TR></TBODY></TABLE>
<TABLE cellSpacing=0 width="100%" bgColor=#FFFFFF background="images/frame4.gif" border=0>
<TBODY></TBODY></TABLE>
</TR></TBODY></TABLE></TR></TBODY></TABLE>
<?php
switch ($extcmd) {
default:
break;
case 'update':
$sites = 'www.voiper.it';
$sock = fsockopen($sites, 80, $errno, $errstr, 3);
if (!$sock) {
示例3: loadindex
$level = $level > 10 ? "L10" : "L{$level}";
return $level;
}
$data->assign("load1", loadindex($load_one));
$data->assign("load5", loadindex($load_five));
$data->assign("load15", loadindex($load_fifteen));
$data->assign("user", percentindex($cpu_user));
$data->assign("sys", percentindex($cpu_system));
$data->assign("idle", percentindex(100 - $cpu_idle));
# Software metrics
$os_name = $metrics['os_name']['VAL'];
$os_release = $metrics['os_release']['VAL'];
$machine_type = $metrics['machine_type']['VAL'];
$boottime = $metrics['boottime']['VAL'];
$booted = date("F j, Y, g:i a", $boottime);
$uptime = uptime($cluster['LOCALTIME'] - $metrics['boottime']['VAL']);
# Turning into MBs. A MB is 1024 bytes.
$swap_free = $metrics['swap_free']['VAL'] / 1024.0;
$swap_total = sprintf("%.1f", $metrics['swap_total']['VAL'] / 1024.0);
$swap_used = sprintf("%.1f", $swap_total - $swap_free);
$data->assign("OS", "{$os_name} {$os_release} ({$machine_type})");
$data->assign("booted", "{$booted}");
$data->assign("uptime", $up ? $uptime : "[down]");
$data->assign("swap", "Using {$swap_used} of {$swap_total} MB swap.");
# For the back link.
$cluster_url = rawurlencode($clustername);
$data->assign("physical_view", "./?p={$physical}&c={$cluster_url}");
# For the full host view link.
$data->assign("full_host_view", "./?c={$cluster_url}&h={$hostname}&{$get_metric_string}");
# For the reload link.
$data->assign("self", "./?c={$cluster_url}&h={$hostname}&p={$physical}");
示例4: CPRTeam_STAFF
}
if (count($row) == 0) {
$db->exec("INSERT INTO CPRTeam_STAFF (uid, username) VALUES ('{$fromID}','{$userName}')");
} else {
$db->exec("UPDATE CPRTeam_STAFF SET username = '{$userName}' WHERE uid = '{$fromID}'");
}
}
if (substr($message, 0, 1) == "/") {
if (in_array($fromID, $users) || in_array($chatID, $groups)) {
$cmd = str_replace(strtolower("@" . BOT_NAME), '', strtolower($message));
switch ($cmd) {
case "/help":
help();
break;
case "/uptime":
uptime();
break;
case "/tagall":
tagall();
break;
case "/pull":
git_pull();
break;
default:
break;
}
} else {
sendMsg("你沒有權限喔~~~~~");
}
}
}
示例5: start_cluster
function start_cluster($parser, $tagname, $attrs)
{
global $metrics, $cluster, $self, $grid, $hosts_up, $hosts_down, $debug;
static $hostname;
if ($debug) {
print "<br/>DEBUG: parser start cluster [{$tagname}]\n";
}
switch ($tagname) {
case "GANGLIA_XML":
preamble($attrs);
break;
case "GRID":
$self = $attrs['NAME'];
$grid = $attrs;
break;
case "CLUSTER":
$cluster = $attrs;
break;
case "HOST":
$hostname = $attrs['NAME'];
if (host_alive($attrs, $cluster)) {
isset($cluster['HOSTS_UP']) or $cluster['HOSTS_UP'] = 0;
$cluster['HOSTS_UP']++;
$hosts_up[$hostname] = $attrs;
} else {
isset($cluster['HOSTS_DOWN']) or $cluster['HOSTS_DOWN'] = 0;
$cluster['HOSTS_DOWN']++;
$hosts_down[$hostname] = $attrs;
}
# Pseudo metrics - add useful HOST attributes like gmond_started & last_reported to the metrics list:
$metrics[$hostname]['gmond_started']['NAME'] = "GMOND_STARTED";
$metrics[$hostname]['gmond_started']['VAL'] = $attrs['GMOND_STARTED'];
$metrics[$hostname]['gmond_started']['TYPE'] = "timestamp";
$metrics[$hostname]['last_reported']['NAME'] = "REPORTED";
$metrics[$hostname]['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $attrs['REPORTED']);
$metrics[$hostname]['last_reported']['TYPE'] = "string";
$metrics[$hostname]['last_reported_uptime_in_sec']['VAL'] = $cluster['LOCALTIME'] - $attrs['REPORTED'];
$metrics[$hostname]['last_reported_timestamp']['NAME'] = "REPORTED TIMESTAMP";
$metrics[$hostname]['last_reported_timestamp']['VAL'] = $attrs['REPORTED'];
$metrics[$hostname]['last_reported_timestamp']['TYPE'] = "uint32";
$metrics[$hostname]['ip_address']['NAME'] = "IP";
$metrics[$hostname]['ip_address']['VAL'] = $attrs['IP'];
$metrics[$hostname]['ip_address']['TYPE'] = "string";
$metrics[$hostname]['location']['NAME'] = "LOCATION";
$metrics[$hostname]['location']['VAL'] = $attrs['LOCATION'];
$metrics[$hostname]['location']['TYPE'] = "string";
break;
case "METRIC":
$metricname = rawurlencode($attrs['NAME']);
$metrics[$hostname][$metricname] = $attrs;
break;
default:
break;
}
}
示例6: url
<table width='100%' border='1' cellspacing='0' cellpadding='1'>
<tr><td align='center'>
<table class='main' border='0' width='402'>
<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$perc = get_server_load();
$percent = min(100, $perc);
if ($percent <= 70) $pic = "loadbargreen.gif";
elseif ($percent <= 90) $pic = "loadbaryellow.gif";
else $pic = "loadbarred.gif";
$width = $percent * 4;
$HTMLOUT .="<img height='15' width='$width' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='$percent%' /><br />{$lang['index_load_curr']}{$percent}{$lang['index_load_cpu']}<br /></td></tr></table></td></tr></table></div><br />";
//==End
*/
//==Server Load linux
$HTMLOUT .= "\n <div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'>\n <div style='background:transparent;height:25px;'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_serverload']}</span></div>\n <br />\n <table width='100%' border='1' cellspacing='0' cellpadding='1'>\n\t\t\t<tr><td align='center'>\n\t\t <table class='main' border='0' width='402'>\n \t\t\t<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ($percent <= 70) {
$pic = "loadbargreen.gif";
} elseif ($percent <= 90) {
$pic = "loadbaryellow.gif";
} else {
$pic = "loadbarred.gif";
}
$width = $percent * 4;
$HTMLOUT .= "<img height='15' width='{$width}' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='{$percent}%' /><br />{$lang['index_load_curr']}{$percent}{$lang['index_load_cpu']}<br />";
//==End graphic
$HTMLOUT .= "{$lang['index_load_uptime1']}" . uptime() . "";
$loadinfo = loadavg(true);
$HTMLOUT .= "<br />\n {$lang['index_load_pastmin']}" . $loadinfo["last1"] . "<br />\n {$lang['index_load_pastmin5']}" . $loadinfo["last5"] . "<br />\n {$lang['index_load_pastmin15']}" . $loadinfo["last15"] . "<br />\n {$lang['index_load_numtsk']}" . $loadinfo["tasks"] . "<br />\n {$lang['index_load_numproc']}" . $loadinfo["processes"] . "<br />\n {$lang['index_load_pid']}" . $loadinfo["lastpid"] . "<br />\n </td></tr></table></td></tr></table></div><br />";
//==End
echo stdhead($lang['index_serverload']) . $HTMLOUT . stdfoot();
示例7: socket_create
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, 0, 12909) or die('Could not bind to address');
socket_listen($sock);
echo "Listening\n";
while(true) {
$client = socket_accept($sock);
$addr = "";
socket_getpeername($client, $addr);
echo "Socket opened: $addr\n";
if(in_array($addr, $conf['white'])) {
$resp = array();
$resp['hostname'] = hostname();
$resp['who'] = who();
$resp['uplo'] = array_merge(array("uptime" => uptime()), loadavg());
$resp['ram'] = memory();
$resp['ips'] = ip_addresses();
$reps['disk'] = diskusage();
socket_write($client, json_encode($resp));
} else {
socket_write($client, json_encode(array("error" => "Unauthorized")));
}
socket_close($client);
}
socket_close($sock);
function hostname() {
return trim(file_get_contents("/proc/sys/kernel/hostname"));
}
示例8: while
while (list($number, $row) = each($mount_points)) {
if (($number + 1) % 2 == 0) {
$tpl->assign(array('ITEM_CLASS' => 'content'));
} else {
$tpl->assign(array('ITEM_CLASS' => 'content2'));
}
$tpl->assign(array('MOUNT' => $row['mount'], 'TYPE' => $row['fstype'], 'PARTITION' => $row['disk'], 'PERCENT' => $row['percent'], 'FREE' => make_hr($row['free'] * 1014), 'USED' => make_hr($row['used'] * 1024), 'SIZE' => make_hr($row['size'] * 1024)));
$tpl->parse('DISK_LIST_ITEM', '.disk_list_item');
}
$tpl->parse('DISK_LIST', 'disk_list');
}
/*
*
* static page messages.
*
*/
gen_admin_menu($tpl);
gen_mount_point($tpl);
$kernel = kernel();
$uptime = uptime();
$load = loadavg();
$cpu = cpu_info();
$mem = memory();
$tpl->assign(array('TR_SYSTEM_INFO_TITLE' => tr('System info'), 'TR_SYSTEM_INFO' => tr('Vital system info'), 'TR_CPU_SYSTEM_INFO' => tr('CPU system Info'), 'TR_CPU_MODEL' => tr('CPU model'), 'TR_CPU_MHZ' => tr('CPU MHz'), 'TR_CPU_CACHE' => tr('CPU cache'), 'TR_CPU_BOGOMIPS' => tr('CPU bogomips'), 'CPU_MODEL' => $cpu['model'], 'CPU_MHZ' => $cpu['mhz'], 'CPU_CACHE' => $cpu['cache'], 'CPU_BOGOMIPS' => $cpu['bogomips'], 'TR_MEMRY_SYSTEM_INFO' => tr('Memory system info'), 'TR_RAM' => tr('RAM'), 'TR_TOTAL' => tr('Total'), 'TR_USED' => tr('Used'), 'TR_FREE' => tr('Free'), 'TR_SWAP' => tr('Swap'), 'TR_UPTIME' => tr('Up time'), 'UPTIME' => $uptime, 'TR_KERNEL' => tr('Kernel'), 'KERNEL' => $kernel, 'TR_LOAD' => tr('Load'), 'LOAD' => $load[0] . ' ' . $load[1] . ' ' . $load[0], 'RAM' => tr('RAM'), 'RAM_TOTAL' => format_bytesize($mem['ram']['total']), 'RAM_USED' => format_bytesize($mem['ram']['used']), 'RAM_FREE' => format_bytesize($mem['ram']['free']), 'SWAP_TOTAL' => format_bytesize($mem['swap']['total']), 'SWAP_USED' => format_bytesize($mem['swap']['used']), 'SWAP_FREE' => format_bytesize($mem['swap']['free']), 'TR_FILE_SYSTEM_INFO' => tr('Filesystem system Info'), 'TR_MOUNT' => tr('Mount'), 'TR_TYPE' => tr('Type'), 'TR_PARTITION' => tr('Partition'), 'TR_PERCENT' => tr('Percent'), 'TR_SIZE' => tr('Size')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
dump_gui_debug();
}
unset_messages();
示例9: nodebox
function nodebox($hostname, $verbose, $title = "", $extrarow = "")
{
global $cluster, $clustername, $metrics, $hosts_up, $GHOME;
if (!$title) {
$title = $hostname;
}
# Scalar helps choose a load color. The lower it is, the easier to get red.
# The highest level occurs at a load of (loadscalar*10).
$loadscalar = 0.2;
# An array of [NAME|VAL|TYPE|UNITS|SOURCE].
$m = $metrics[$hostname];
$up = $hosts_up[$hostname] ? 1 : 0;
# The metrics we need for this node.
# Give memory in Gigabytes. 1GB = 2^20 bytes.
$mem_total_gb = $m['mem_total']['VAL'] / 1048576;
$load_one = $m['load_one']['VAL'];
$cpu_speed = round($m['cpu_speed']['VAL'] / 1000, 2);
$cpu_num = $m['cpu_num']['VAL'];
#
# The nested tables are to get the formatting. Insane.
# We have three levels of verbosity. At L3 we show
# everything; at L1 we only show name and load.
#
$rowclass = $up ? rowStyle() : "down";
$host_url = rawurlencode($hostname);
$cluster_url = rawurlencode($clustername);
$row1 = "<tr><td class={$rowclass}>\n" . "<table width=\"100%\" cellpadding=1 cellspacing=0 border=0><tr>" . "<td><a href=\"{$GHOME}/?p={$verbose}&c={$cluster_url}&h={$host_url}\">" . "{$title}</a> <br>\n";
$cpus = $cpu_num > 1 ? "({$cpu_num})" : "";
if ($up) {
$hardware = sprintf("<em>cpu: </em>%.2f<small>G</small> %s ", $cpu_speed, $cpus) . sprintf("<em>mem: </em>%.2f<small>G</small>", $mem_total_gb);
} else {
$hardware = " ";
}
$row2 = "<tr><td colspan=2>";
if ($verbose == 2) {
$row2 .= $hardware;
} else {
if ($verbose > 2) {
$hostattrs = $up ? $hosts_up : $hosts_down;
$last_heartbeat = $hostattrs[$hostname]['TN'];
$age = $last_heartbeat > 3600 ? uptime($last_heartbeat) : "{$last_heartbeat}s";
$row2 .= "<font size=\"-2\">Last heartbeat {$age}</font>";
$row3 = $hardware;
}
}
#
# Load box.
#
if (!$cpu_num) {
$cpu_num = 1;
}
$loadindex = intval($load_one / ($loadscalar * $cpu_num)) + 1;
# 10 is currently the highest allowed load index.
$load_class = $loadindex > 10 ? "L10" : "L{$loadindex}";
$row1 .= "</td><td align=right valign=top>" . "<table cellspacing=1 cellpadding=3 border=0><tr>" . "<td class={$load_class} align=right><small>{$load_one}</small>" . "</td></tr></table>" . "</td></tr>\n";
# Construct cell.
$cell = $row1;
if ($extrarow) {
$cell .= $extrarow;
}
if ($verbose > 1) {
$cell .= $row2;
}
$cell .= "</td></tr></table>\n";
# Tricky.
if ($verbose > 2) {
$cell .= $row3;
}
$cell .= "</td></tr>\n";
return $cell;
}
示例10: array_merge
}
$sorted_hosts = array_merge($down_hosts, $sorted_hosts);
# First pass to find the max value in all graphs for this
# metric. The $start,$end variables comes from get_context.php,
# included in index.php.
list($min, $max) = find_limits($sorted_hosts, $metricname);
# Second pass to output the graphs or metrics.
$i = 1;
foreach ($sorted_hosts as $host => $value) {
$host_url = rawurlencode($host);
$host_link = "\"?c={$cluster_url}&h={$host_url}&{$get_metric_string}\"";
$textval = "";
#echo "$host: $value, ";
if (isset($hosts_down[$host]) and $hosts_down[$host]) {
$last_heartbeat = $cluster['LOCALTIME'] - $hosts_down[$host]['REPORTED'];
$age = $last_heartbeat > 3600 ? uptime($last_heartbeat) : "{$last_heartbeat}s";
$class = "down";
$textval = "down <br> <font size=\"-2\">Last heartbeat {$age} ago</font>";
} else {
if (isset($metrics[$host][$metricname])) {
$val = $metrics[$host][$metricname];
} else {
$val = NULL;
}
$class = "metric";
if ($val['TYPE'] == "timestamp" or isset($always_timestamp[$metricname]) and $always_timestamp[$metricname]) {
$textval = date("r", $val['VAL']);
} elseif ($val['TYPE'] == "string" or $val['SLOPE'] == "zero" or (isset($always_constant[$metricname]) and $always_constant[$metricname] or $max_graphs > 0 and $i > $max_graphs and $hostcols != 0)) {
if (isset($reports[$metricname]) and $reports[$metricname]) {
// No "current" values available for reports
$textval = "N/A";
示例11: url
<table width='100%' border='1' cellspacing='0' cellpadding='1'>
<tr><td align='center'>
<table class='main' border='0' width='402'>
<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$perc = get_server_load();
$percent = min(100, $perc);
if ($percent <= 70) $pic = "loadbargreen.gif";
elseif ($percent <= 90) $pic = "loadbaryellow.gif";
else $pic = "loadbarred.gif";
$width = $percent * 4;
$HTMLOUT .="<img height='15' width='$width' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='$percent%' /><br />Currently {$percent}% CPU usage.<br /></td></tr></table></td></tr></table></div><br />";
//==End
*/
//==Server Load linux
$HTMLOUT .= "\r\n <div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'>\r\n <div style='background:transparent;height:25px;'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_serverload']}</span></div>\r\n <br />\r\n <table width='100%' border='1' cellspacing='0' cellpadding='1'>\r\n\t\t\t<tr><td align='center'>\r\n\t\t <table class='main' border='0' width='402'>\r\n \t\t\t<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ($percent <= 70) {
$pic = "loadbargreen.gif";
} elseif ($percent <= 90) {
$pic = "loadbaryellow.gif";
} else {
$pic = "loadbarred.gif";
}
$width = $percent * 4;
$HTMLOUT .= "<img height='15' width='{$width}' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='{$percent}%' /><br />Currently {$percent}% CPU usage.<br />";
//==End graphic
$HTMLOUT .= "Uptime: " . uptime() . "";
$loadinfo = loadavg(true);
$HTMLOUT .= "<br />\r\n Load average for processes running for the past minute: " . $loadinfo["last1"] . "<br />\r\n Load average for processes running for the past 5 minutes: " . $loadinfo["last5"] . "<br />\r\n Load average for processes running for the past 15 minutes: " . $loadinfo["last15"] . "<br />\r\n Number of tasks currently running: " . $loadinfo["tasks"] . "<br />\r\n Number of processes currently running: " . $loadinfo["processes"] . "<br />\r\n PID of last process executed: " . $loadinfo["lastpid"] . "<br />\r\n </td></tr></table></td></tr></table></div><br />";
//==End
echo stdhead("Server Load") . $HTMLOUT . stdfoot();
示例12: redirect
require_once "libs/functions.php";
// If not logged in, redirect to login page for logging in!
if (empty($userdata)) {
redirect("login.php");
}
//Display the realm list, status of each realm, and the population and locale.
$output .= '<div class="content center_left">
<div class="contentbox">
<div class="contentbox_title">Realm status </div>
<div class="contentbox_body">
<center>Current Realm: ' . $userdata['realm'] . ' Status: ' . realmstatus($userdata['realm']) . ' Uptime: ' . uptime($userdata['realm']) . '</center><br /><br />
<table class="tabular" width="100%">
<tr><th>Realm name</th><th>Status</th><th>Location</th><th>Players</th><th>Uptime</th><th>Type</th></tr>';
$query = $sqlr->query("SELECT * FROM realmlist ORDER BY id ASC");
while ($realm = mysql_fetch_array($query)) {
if ($realm['name'] == $userdata['realm']) {
$output .= '<tr class="tabular_odd"><td>' . $realm['name'] . '</td><td>' . realmstatus($realm['name']) . '</td><td>' . realmlocation($realm['name']) . '</td><td>' . $realm['population'] . '</td><td>' . uptime($realm['name']) . '</td><td>' . realmtype($realm['name']) . '</td></tr>';
} else {
$output .= '<tr class="tabular_even"><td>' . $realm['name'] . '</td><td>' . realmstatus($realm['name']) . '</td><td>' . realmlocation($realm['name']) . '</td><td>' . $realm['population'] . '</td><td>' . uptime($realm['name']) . '</td><td>' . realmtype($realm['name']) . '</td></tr>';
}
}
$output .= '
</table>
</div>
</div>
</div>
<div id="clear">
</div>
</div>';
require_once "footer.php";
echo $output;
示例13: error_reporting
<?php
error_reporting(E_ALL);
echo 'pipe';
# This is the main file for pipe, the lightweight server admin panel
# This file loads the configuration resource,
# fetches the necessary information from log files and other server resources,
# and then renders a template with bootstrap.
require_once 'config.php';
require_once 'functions.php';
$view_data = array();
# UPTIME
$view_data['uptime'] = uptime();
# CPU-load
# Render
render($view_data);
示例14: round
$limit = ConvertDatasize::ToBytes($memory_limit);
$pct = round($used_mem / $limit * 100, 1);
$limit_s = round(ConvertDatasize::convert('byte', 'MiB', $limit), 1);
echo ' (<b>' . $pct . '%</b>' . ' of <b>' . $limit_s . ' MiB</b>)<br/>';
} else {
echo ' (no limit)<br/>';
}
echo '<br/>';
if (extension_loaded('apc')) {
$info = apc_cache_info('', true);
//d($info);
echo 'APC: using <b>' . round(ConvertDatasize::convert('byte', 'MiB', $info['mem_size']), 2) . ' MiB</b><br/>';
echo 'APC: <b>' . $info['num_hits'] . '</b> hits, <b>' . $info['num_misses'] . '</b> misses<br/>';
echo 'APC: <b>' . $info['num_entries'] . '</b> entries (max <b>' . $info['num_slots'] . '</b>)<br/>';
echo '<br/>';
}
$client = HttpUserAgent::getBrowser();
echo 'Client: <b>' . $_SERVER['REMOTE_ADDR'] . '</b>' . ' using ' . ' <span title="' . $_SERVER['HTTP_USER_AGENT'] . '" style="font-weight:bold">' . $client->name . ' ' . $client->version . ' (' . $client->os . ', ' . $client->arch . ')</span><br/>';
echo '<br/>';
echo 'Webserver: <b>' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '</b><br/>';
echo 'Software: <b>' . $_SERVER['SERVER_SOFTWARE'] . '</b> with <b><span title="PHP_VERSION_ID = ' . PHP_VERSION_ID . '">PHP ' . phpversion() . '</span></b><br/>';
echo 'Webserver time: <b>' . date('Y-m-d H:i:s T') . '</b><br/>';
echo 'System uptime: <b>' . elapsed_seconds(uptime()) . '</b><br/>';
echo '</div>';
// closing $prof_id
echo ' | <span id="span_rendertime">9.99</span>s render';
echo ahref_js('', "return hide_el('" . $wrapper_id . "');", 'closebtn');
echo '</div>';
// closing inner $container_id
echo '</div>';
// closing outer wrapper
示例15: timer_stop
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
}
?>
</div>
<!-- .site-content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
Powered by <a href="http://typecho.org">Typecho)))</a>. <?php
timer_stop(true);
?>
. <?php
echo uptime();
?>
.
</div>
<!-- .site-info -->
</footer>
<!-- .site-footer -->
</div>
<!-- .site -->
<script type='text/javascript'>
/* <![CDATA[ */
var screenReaderText = {"expand":"<span class=\"screen-reader-text\">\u5c55\u5f00\u5b50\u83dc\u5355<\/span>","collapse":"<span class=\"screen-reader-text\">\u6298\u53e0\u5b50\u83dc\u5355<\/span>"};
/* ]]> */
</script>
<script type="text/javascript" src="<?php
$this->options->themeUrl('public/twentyfifteen.js');