Added benchmark helper
This commit is contained in:
parent
c3b2c68add
commit
c4faa3bf85
1 changed files with 20 additions and 0 deletions
20
src/Helpers/BenchmarkHelper.php
Normal file
20
src/Helpers/BenchmarkHelper.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
class BenchmarkHelper
|
||||||
|
{
|
||||||
|
protected static $lastTime;
|
||||||
|
|
||||||
|
public static function init()
|
||||||
|
{
|
||||||
|
self::$lastTime = microtime(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tick()
|
||||||
|
{
|
||||||
|
$t = microtime(true);
|
||||||
|
$lt = self::$lastTime;
|
||||||
|
self::$lastTime = $t;
|
||||||
|
return $t - $lt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BenchmarkHelper::init();
|
Loading…
Reference in a new issue