You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
823 B
PHP

<?php
require_once __DIR__ . '/../vendor/autoload.php';
use jrosset\ExecutionTimer\ExecutionTimer;
$timer = new ExecutionTimer(false);
$timer->start();
sleep(3);
$timer->step('sleep 1');
echo 'sleep 1' . PHP_EOL;
echo "\t" . $timer->getLastStepRelativeDuration() . PHP_EOL;
echo "\t" . $timer->getLastStepDuration() . PHP_EOL;
sleep(2);
$timer->step('sleep 2');
echo 'sleep 2' . PHP_EOL;
echo "\t" . $timer->getLastStepRelativeDuration() . PHP_EOL;
echo "\t" . $timer->getLastStepDuration() . PHP_EOL;
sleep(3);
$timer->step('sleep 3');
echo 'sleep 3' . PHP_EOL;
echo "\t" . $timer->getLastStepRelativeDuration() . PHP_EOL;
echo "\t" . $timer->getLastStepDuration() . PHP_EOL;
$timer->stop();
echo 'STOP' . PHP_EOL;
echo "\t" . $timer->getRelativeDuration() . PHP_EOL;
echo "\t" . $timer->getDuration() . PHP_EOL;