mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 20:06:09 +08:00
27 lines
378 B
PHP
27 lines
378 B
PHP
<?php
|
|
|
|
namespace App\Library;
|
|
|
|
class Benchmark
|
|
{
|
|
|
|
protected $startTime = 0;
|
|
|
|
protected $endTime = 0;
|
|
|
|
public function start()
|
|
{
|
|
$this->startTime = microtime(true);
|
|
}
|
|
|
|
public function stop()
|
|
{
|
|
$this->endTime = microtime(true);
|
|
}
|
|
|
|
public function getElapsedTime()
|
|
{
|
|
return $this->endTime - $this->startTime;
|
|
}
|
|
|
|
} |