Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/diag/ |
Upload File : |
<?php namespace Bitrix\Main\Diag; class StopWatch { // seconds with nanoseconds protected ?float $start = null; protected float $timer = 0.0; protected int $precision; public function __construct(int $precision = 6) { $this->precision = $precision; } public function start(): static { $this->start = hrtime(true); return $this; } public function stop(): float { if ($this->start !== null) { $this->timer += (hrtime(true) - $this->start)/1e+9; $this->start = null; } return $this->get(); } public function reset(): static { return $this->set(0.0); } public function flyback(): float { $time = $this->stop(); $this->reset(); $this->start(); return $time; } public function set(float $timer): static { $this->timer = $timer; $this->start = null; return $this; } public function get(): float { return round($this->timer, $this->precision); } }