Skip to content

Commit e4dd63c

Browse files
bckpdg
authored andcommitted
Debugger::timer: switch from microtime to hrtime
hrtime is faster on virtual machines, due microtime use system call that need to change context from user to kernel (PHP7.3+)
1 parent 7c4c59e commit e4dd63c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Tracy/Debugger/Debugger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ public static function dump(mixed $var, bool $return = false): mixed
511511
public static function timer(?string $name = null): float
512512
{
513513
static $time = [];
514-
$now = microtime(true);
514+
$now = hrtime(true);
515515
$delta = isset($time[$name]) ? $now - $time[$name] : 0;
516516
$time[$name] = $now;
517-
return $delta;
517+
return $delta / 1e+9;
518518
}
519519

520520

0 commit comments

Comments
 (0)