Exemple #1
0
 public function testReset()
 {
     $timer = new Zym_Timer();
     $timer->start();
     $timer->stop();
     $timer->reset();
     $this->assertAttributeEquals(null, '_start', $timer);
     $this->assertAttributeEquals(array(), '_totalTime', $timer);
 }
Exemple #2
0
<?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();
Exemple #3
0
<?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()
Exemple #4
0
<?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()
Exemple #5
0
<?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();