本文整理汇总了PHP中getLoad函数的典型用法代码示例。如果您正苦于以下问题:PHP getLoad函数的具体用法?PHP getLoad怎么用?PHP getLoad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLoad函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCpu
function getCpu(){
$sock=new sockets();
$cpu_purc=$sock->getFrameWork("cmd.php?cpualarm=yes");
$cpu_purc_text=$cpu_purc."%";
$cpu_color="#5DD13D";
if($cpu_purc>70){$cpu_color="#F59C44";}
if($cpu_purc>90){$cpu_color="#D32D2D";}
$pouc_disk_io_text="<br><span style='font-size:9px'>% CPU:$pouc_disk_io%</span>";
$cpu="
<div style='width:100px;background-color:white;padding-left:0px;border:1px solid $color;margin-top:3px'>
<div style='width:{$pouc_disk_io}px;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:$color'></div>
</div>
";
$cpu="<tr>
<td width=1% nowrap class=legend nowrap>{cpu_usage}:</strong></td>
<td align='left'>
<div style='width:100px;background-color:white;padding-left:0px;border:1px solid $cpu_color'>
<div style='width:{$cpu_purc}px;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:$cpu_color'>
<strong>{$cpu_purc}%</strong></div>
</div>
</td>
<td width=1% nowrap><strong style='color:$cpu_color'>{$cpu_purc}%</strong></td>
</tr>";
$load=getLoad();
$html="<table>$cpu$load
</table>";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例2: addInfo
addInfo('Requests in last 5 minutes', $requests->count());
$info = $redis->info();
$mem = $info['used_memory_human'];
$stats = $mdb->getDb()->command(['dbstats' => 1]);
$dataSize = number_format($stats['dataSize'] / (1024 * 1024 * 1024), 2);
$storageSize = number_format($stats['storageSize'] / (1024 * 1024 * 1024), 2);
$memory = getSystemMemInfo();
$memTotal = number_format($memory['MemTotal'] / (1024 * 1024), 2);
$memUsed = number_format(($memory['MemTotal'] - $memory['MemFree'] - $memory['Cached']) / (1024 * 1024), 2);
$maxLen = 0;
foreach ($infoArray as $i) {
foreach ($i as $key => $value) {
$maxLen = max($maxLen, strlen("{$value}"));
}
}
echo exec('date') . ' Load: ' . getLoad() . " Memory: {$memUsed}G/{$memTotal}G Redis: {$mem} TokuDB: {$storageSize}G / {$dataSize}G\n";
echo "\n";
foreach ($infoArray as $i) {
foreach ($i as $name => $count) {
if (trim($name) == '') {
echo "\n";
continue;
}
while (strlen($count) < 20 + $maxLen) {
$count = ' ' . $count;
}
echo "{$count} {$name}\n";
}
}
$output = ob_get_clean();
file_put_contents("{$baseDir}/public/ztop.txt", $output);
示例3: makeLoadBars
function makeLoadBars()
{
printBar(getLoad(0), "1 min");
printBar(getLoad(1), "5 min");
printBar(getLoad(2), "15 min");
}
示例4: preg_match
">
<input type="hidden" name="view" value="<?php
echo $view;
?>
"/>
<input type="hidden" name="action" value=""/>
<div id="header">
<h3 id="systemTime"><?php
echo preg_match('/%/', DATE_FMT_CONSOLE_LONG) ? strftime(DATE_FMT_CONSOLE_LONG) : date(DATE_FMT_CONSOLE_LONG);
?>
</h3>
<h3 id="systemStats"><?php
echo translate('Load');
?>
: <?php
echo getLoad();
?>
/ <?php
echo translate('Disk');
?>
: <?php
echo getDiskPercent();
?>
%</h3>
<h2 id="title"><a href="http://www.zoneminder.com" target="ZoneMinder">ZoneMinder</a> <?php
echo translate('Console');
?>
- <?php
echo makePopupLink('?view=state', 'zmState', 'state', $status, canEdit('System'));
?>
- <?php
示例5: parseFilter
function parseFilter(&$filter, $saveToSession = false, $querySep = '&')
{
$filter['query'] = '';
$filter['sql'] = '';
$filter['fields'] = '';
if (isset($filter['terms']) && count($filter['terms'])) {
for ($i = 0; $i < count($filter['terms']); $i++) {
if (isset($filter['terms'][$i]['cnj'])) {
$filter['query'] .= $querySep . "filter[terms][{$i}][cnj]=" . urlencode($filter['terms'][$i]['cnj']);
$filter['sql'] .= " " . $filter['terms'][$i]['cnj'] . " ";
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[terms][{$i}][cnj]\" value=\"" . htmlspecialchars($filter['terms'][$i]['cnj']) . "\"/>\n";
}
if (isset($filter['terms'][$i]['obr'])) {
$filter['query'] .= $querySep . "filter[terms][{$i}][obr]=" . urlencode($filter['terms'][$i]['obr']);
$filter['sql'] .= " " . str_repeat("(", $filter['terms'][$i]['obr']) . " ";
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[terms][{$i}][obr]\" value=\"" . htmlspecialchars($filter['terms'][$i]['obr']) . "\"/>\n";
}
if (isset($filter['terms'][$i]['attr'])) {
$filter['query'] .= $querySep . "filter[terms][{$i}][attr]=" . urlencode($filter['terms'][$i]['attr']);
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[terms][{$i}][attr]\" value=\"" . htmlspecialchars($filter['terms'][$i]['attr']) . "\"/>\n";
switch ($filter['terms'][$i]['attr']) {
case 'MonitorName':
$filter['sql'] .= 'M.' . preg_replace('/^Monitor/', '', $filter['terms'][$i]['attr']);
break;
case 'DateTime':
$filter['sql'] .= "E.StartTime";
break;
case 'Date':
$filter['sql'] .= "to_days( E.StartTime )";
break;
case 'Time':
$filter['sql'] .= "extract( hour_second from E.StartTime )";
break;
case 'Weekday':
$filter['sql'] .= "weekday( E.StartTime )";
break;
case 'Id':
case 'Name':
case 'MonitorId':
case 'Length':
case 'Frames':
case 'AlarmFrames':
case 'TotScore':
case 'AvgScore':
case 'MaxScore':
case 'Cause':
case 'Notes':
case 'Archived':
$filter['sql'] .= 'E.' . $filter['terms'][$i]['attr'];
break;
case 'DiskPercent':
$filter['sql'] .= getDiskPercent();
break;
case 'DiskBlocks':
$filter['sql'] .= getDiskBlocks();
break;
case 'SystemLoad':
$filter['sql'] .= getLoad();
break;
}
$valueList = array();
foreach (preg_split('/["\'\\s]*?,["\'\\s]*?/', preg_replace('/^["\']+?(.+)["\']+?$/', '$1', $filter['terms'][$i]['val'])) as $value) {
switch ($filter['terms'][$i]['attr']) {
case 'MonitorName':
case 'Name':
case 'Cause':
case 'Notes':
$value = dbEscape($value);
break;
case 'DateTime':
$value = "'" . strftime(STRF_FMT_DATETIME_DB, strtotime($value)) . "'";
break;
case 'Date':
$value = "to_days( '" . strftime(STRF_FMT_DATETIME_DB, strtotime($value)) . "' )";
break;
case 'Time':
$value = "extract( hour_second from '" . strftime(STRF_FMT_DATETIME_DB, strtotime($value)) . "' )";
break;
default:
$value = dbEscape($value);
break;
}
$valueList[] = $value;
}
switch ($filter['terms'][$i]['op']) {
case '=':
case '!=':
case '>=':
case '>':
case '<':
case '<=':
$filter['sql'] .= " " . $filter['terms'][$i]['op'] . " {$value}";
break;
case '=~':
$filter['sql'] .= " regexp " . $value;
break;
case '!~':
$filter['sql'] .= " not regexp " . $value;
break;
case '=[]':
//.........这里部分代码省略.........
示例6: header
$uri = @$_SERVER['REQUEST_URI'];
header("Location: https://zkillboard.com{$uri}");
die;
}
$timer = new Timer();
// Starting Slim Framework
$app = new \Slim\Slim($config);
// Session
session_set_save_handler(new RedisSessionHandler(), true);
session_cache_limiter(false);
session_start();
$visitors = new RedisTtlCounter('ttlc:visitors', 300);
$visitors->add(IP::get());
$requests = new RedisTtlCounter('ttlc:requests', 300);
$requests->add(uniqid());
$load = getLoad();
// Check if the user has autologin turned on
if ($load < 20 && !User::isLoggedIn()) {
User::autoLogin();
}
if ($load >= 20) {
$uri = @$_SERVER['REQUEST_URI'];
if ($uri != '') {
$contents = $redis->get("cache:{$uri}");
if ($contents !== false) {
echo $contents;
exit;
}
$_SERVER['requestDttm'] = $mdb->now();
$qServer = new RedisQueue('queueServer');
$qServer->push($_SERVER);