function Poll($secs = 5) { $this->conn->fnExecute = false; //$this->conn->debug=1; if ($secs <= 1) { $secs = 1; } echo "Accumulating statistics, every {$secs} seconds...\n"; flush(); $arro =& $this->PollParameters(); $cnt = 0; set_time_limit(0); sleep($secs); while (1) { $arr =& $this->PollParameters(); $hits = sprintf('%2.2f', $arr[0]); $reads = sprintf('%12.4f', ($arr[1] - $arro[1]) / $secs); $writes = sprintf('%12.4f', ($arr[2] - $arro[2]) / $secs); $sess = sprintf('%5d', $arr[3]); $load = $this->CPULoad(); if ($load !== false) { $oslabel = 'WS-CPU%'; $osval = sprintf(" %2.1f ", (double) $load); } else { $oslabel = ''; $osval = ''; } if ($cnt % 10 == 0) { echo " Time " . $oslabel . " Hit% Sess Reads/s Writes/s\n"; } $cnt += 1; echo date('H:i:s') . ' ' . $osval . "{$hits} {$sess} {$reads} {$writes}\n"; flush(); if (connection_aborted() || connection_timeout()) { return; } sleep($secs); $arro = $arr; } }
function VS($x, $y) { var_dump($x === $y); if ($x !== $y) { echo "Failed: {$y}\n"; echo "Got: {$x}\n"; var_dump(debug_backtrace()); } } function VERIFY($x) { VS($x, true); } ////////////////////////////////////////////////////////////////////// VERIFY(connection_aborted() != true); VERIFY(connection_status() == CONNECTION_NORMAL); VERIFY(connection_timeout() != true); constant("a"); VERIFY(defined("a") != true); __halt_compiler(); ignore_user_abort("a"); VERIFY(empty(uniqid()) != true); VS(token_name(258), "T_REQUIRE_ONCE"); VS(count(sys_getloadavg()), 3); $src = "blarb <?php 1"; VS(token_get_all(src), array(array(T_INLINE_HTML, "blarb ", 1), array(T_OPEN_TAG, "<?php", 1)));