File: timer_example.php

package info (click to toggle)
php-benchmark 1.2.7-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 100 kB
  • ctags: 101
  • sloc: xml: 304; php: 76; makefile: 7
file content (18 lines) | stat: -rw-r--r-- 453 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'Benchmark/Timer.php';

function wait($amount) {
    for ($i=0; $i < $amount; $i++) {
        for ($i=0; $i < 100; $i++);
    }
}
// Pass the param "true" to constructor to automatically display the results
$timer = new Benchmark_Timer();
$timer->start();
wait(10);
$timer->setMarker('Mark1');
echo "Elapsed time between Start and Mark1: " .
      $timer->timeElapsed('Start', 'Mark1') . "\n";
wait(50);
$timer->stop();
$timer->display();