예제 #1
0
    print '<tr>';
    print '<th>' . $a[$i][0] . ':</th><td>' . number_format($a[$i][1], 0) . ' ' . _('posts') . ' ' . sprintf("(%0.1f%%)", $a[$i][1] / $totalposts * 100) . '</td>';
    print '<th>' . $a[$i + 12][0] . ':</th><td>' . number_format($a[$i + 12][1], 0) . ' ' . _('posts') . ' ' . sprintf("(%0.1f%%)", $a[$i + 12][1] / $totalposts * 100) . '</td>';
    print '</tr>';
}
print '</table></td><td style="text-align:right"><img src="/stat-img-hour.php" width="400" height="250" /></td></tr></table>';
$cache1 = new Memcache();
$cache1->pconnect('localhost', '11211');
$cache2 = new Memcache();
$cache2->pconnect('localhost', '11212');
$dur = new Duration();
$cs1 = $cache1->getStats();
$cs2 = $cache2->getStats();
makeSection(_('cache statistics'));
print '<table style="text-align:left"><tr><th>Statistic</th><th>Cache 1</th><th>Cache 2</th>';
print '<tr><th>Uptime</th><td>' . $dur->AgeAsString($cs1['uptime']) . '</td><td>' . $dur->AgeAsString($cs2['uptime']) . '</td></tr>';
print '<tr><th>Item Count</th><td>' . number_format($cs1['curr_items'], 0) . '</td><td>' . number_format($cs2['curr_items'], 0) . '</td></tr>';
print '<tr><th>Utilization</th><td>' . sprintf("%0.01f", $cs1['bytes'] / $cs1['limit_maxbytes'] * 100.0) . '%</td><td>' . sprintf("%0.01f", $cs2['bytes'] / $cs2['limit_maxbytes'] * 100.0) . '%</td></tr>';
print '<tr><th>Hit Efficiency</th><td>' . sprintf("%0.01f", $cs1['get_hits'] / $cs1['get_misses']) . " to 1 (" . sprintf("%0.02f", ($cs1['cmd_get'] + $cs1['cmd_set']) / $cs1['uptime']) . " req/s)</td><td>" . sprintf("%0.01f", $cs2['get_hits'] / $cs2['get_misses']) . ' to 1 (' . sprintf("%0.02f", ($cs2['cmd_get'] + $cs2['cmd_set']) / $cs2['uptime']) . ' req/s)</td></tr>';
print '<tr><th>Byte Efficiency</th><td>' . sprintf("%0.01f", $cs1['bytes_written'] / $cs1['bytes_read']) . " to 1</td><td>" . sprintf("%0.01f", $cs2['bytes_written'] / $cs2['bytes_read']) . ' to 1</td></tr>';
print '<tr><th>Average Object Size</th><td>' . number_format($cs1['bytes'] / $cs1['curr_items'], 0) . ' bytes</td><td>' . number_format($cs2['bytes'] / $cs2['curr_items'], 0) . ' bytes</td></tr>';
print '</table>';
$res = cache_pg_Exec($db, "SELECT COUNT(*) AS count,MAX(period) AS max_period,AVG(period) AS avg_period,SUM(hits) AS hits,MAX(hits) AS max_hits FROM spammers", 60);
$res = $res[0];
makeSection(_('spammer statistics'));
print '<table style="text-align:left">';
print '<tr><th>Active Spammer Count:</th><td>' . number_format($res['count']) . '</td></tr>';
print '<tr><th>Denied Spammer Requests:</th><td>' . number_format($res['hits']) . '</td></tr>';
print '<tr><th>Highest Single Denied Spammer Count:</th><td>' . number_format($res['max_hits']) . '</td></tr>';
print '<tr><th>Maximum Ban Period:</th><td>' . substr($res['max_period'], 2) . '</td></tr>';
print '<tr><th>Average Ban Period:</th><td>' . substr($res['avg_period'], 2) . '</td></tr>';