function find_range($c) { echo "{find_range} {$c}\n"; $query = array("x" => array('$gt' => PER_TRIAL / 2, '$lt' => PER_TRIAL / 2 + BATCH_SIZE)); $start = micro_time(); for ($i = 0; $i < PER_TRIAL; $i++) { $cursor = $c->find($query); while ($cursor->hasNext()) { $cursor->next(); } } $end = micro_time(); $total = $end - $start; $ops = PER_TRIAL / $total; echo "total time: {$total}\n"; echo "ops/sec: {$ops}\n"; echo "------\n"; }
function MarcaMomentos($momento) { global $momentosIndex, $logMomentos, $ultimoMomento, $sumaTiemposTotal; $ahora = micro_time(); //$diff = bcsub($ahora, $ultimoMomento, 6); $diff = $ahora - $ultimoMomento; $logMomentos[$momentosIndex] = "<tr><td>[{$momento}]</td><td>{$diff}</td></tr>"; $ultimoMomento = $ahora; $momentosIndex++; //$sumaTiemposTotal = bcadd($sumaTiemposTotal, $diff,6); $sumaTiemposTotal = $sumaTiemposTotal + $diff; }
{ $time_start = microtime(true); for ($i = 0; $i < $count; $i++) { if ($i == -1) { } elseif ($i == -2) { } else { if ($i == -3) { } } } return number_format(microtime(true) - $time_start, 3); } $time_start = micro_time(); /* muhammed zaim*/ sleep(1); $time_stop = micro_time(); $time_overall = bcsub($time_stop, $time_start, 6); echo "<div align='center'>"; echo "<b>"; $kb = 512; echo "Streaming {$kb} Kb...<!-"; flush(); $time = explode(" ", microtime()); $start = $time[0] + $time[1]; for ($x = 0; $x < $kb; $x++) { echo str_pad('', 1024, '.'); flush(); } /* muhammed zaim*/ $time = explode(" ", microtime()); $finish = $time[0] + $time[1];
public function lost() { return number_format(micro_time() - $this->s_time, 2); }