<div style="text-align:center; font-style: italic;">
<?php
-if (!file_exists(TEMP_PATH.'/stat') || filemtime(TEMP_PATH.'/stat')+3600<time()) {
- $x = fetchRows(DBSelect("SHOW STATUS WHERE Variable_name IN ('Questions','Uptime')"),'Variable_name');
- $v = $x['Questions']['Value'];
- $t = $x['Uptime']['Value'];
- file_put_contents(TEMP_PATH.'/stat',implode("\n",array($v,$t)));
-} else {
- $x = file_get_contents(TEMP_PATH.'/stat');
- list($v, $t) = explode("\n", $x);
+if (file_exists('/afs/athena.mit.edu/contrib/sql/stat/questions')) {
+ $x = file_get_contents('/afs/athena.mit.edu/contrib/sql/stat/questions');
+ list($t, $v) = explode("\n", $x);
+ $qavg = $v/$t;
+ $qunits = array('','k','M','G','T','P','E','Z','Y');
+ while (count($qunits) && $v/1000>1) {
+ array_shift($qunits);
+ $v /= 1000;
+ }
+ printf('sql.mit.edu has served %.3f%s queries', $v, array_shift($qunits));
+ $qunits = array('minutes', 'hours', 'days');
+ $qdiv = array(60, 60, 24);
+ while (count($qdiv) && $t/$qdiv[0]>0) {
+ $t /= array_shift($qdiv);
+ $tunits = array_shift($qunits);
+ }
+ printf(' in the last %.2f %s (%.2f qps)', $t, $tunits, $qavg);
}
-$qavg = $v/$t;
-$qunits = array('','k','M','G','T','P','E','Z','Y');
-while (count($qunits) && $v/1000>1) {
- array_shift($qunits);
- $v /= 1000;
-}
-printf('sql.mit.edu has served %.3f%s queries', $v, array_shift($qunits));
-
-$qunits = array('minutes', 'hours', 'days');
-$qdiv = array(60, 60, 24);
-while (count($qdiv) && $t/$qdiv[0]>0) {
- $t /= array_shift($qdiv);
- $tunits = array_shift($qunits);
-}
-printf(' in the last %.2f %s (%.2f qps)', $t, $tunits, $qavg);
?>
</div>