public function testReset() { $timer = new Zym_Timer(); $timer->start(); $timer->stop(); $timer->reset(); $this->assertAttributeEquals(null, '_start', $timer); $this->assertAttributeEquals(array(), '_totalTime', $timer); }
<?php // Retrieve complete times, assume each start/stop is 1 second $timer = new Zym_Timer(); $timer->start(); $time = $timer->stop(); // 1s $timer->start(); $time = $timer->stop(); // 2s // Time $runTime = $timer->getRun(); // 2s $timer->start(); // Get time elapsed $runTime = $timer->getElapsed(); // 2.5s $timer->stop();
<?php $timer = new Zym_Timer(); // Start timer $timer->start(); for ($x = 0; $x < 100000; ++$x) { // Long execution } // Stop timer $runTime = $timer->stop(); // Returns time elapsed since start()