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.
28 lines
710 B
PHP
28 lines
710 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 $timer->getLastStepRelativeDuration()->toUserString() . PHP_EOL;
|
|
echo $timer->getLastStepDuration() . PHP_EOL;
|
|
|
|
sleep(2);
|
|
|
|
$timer->step('sleep 2');
|
|
echo $timer->getLastStepRelativeDuration()->toUserString() . PHP_EOL;
|
|
echo $timer->getLastStepDuration() . PHP_EOL;
|
|
$timer->stop();
|
|
|
|
$final = $timer->getDuration();
|
|
echo $timer->getRelativeDuration()->toUserString() . PHP_EOL;
|
|
echo $timer->getRelativeDuration() . PHP_EOL;
|
|
|
|
echo $timer->getDuration()->toUserString() . PHP_EOL;
|
|
echo $timer->getDuration() . PHP_EOL; |