Total Complexity | 7 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
4 | final class Statistics |
||
5 | { |
||
6 | protected $duration; // <seconds>.<microseconds> |
||
7 | protected $memoryPeakUsage; // K |
||
8 | protected $timeStart; |
||
9 | protected $timeFinish; |
||
10 | protected $timeZone; |
||
11 | |||
12 | public function __construct() |
||
13 | { |
||
14 | $this->timeZone = date_default_timezone_get(); |
||
15 | } |
||
16 | |||
17 | public function finish() |
||
18 | { |
||
19 | $this->timeFinish = $this->createCurrentTimeObject(); |
||
20 | $this->duration = $this->timeFinish->format("U.u") - $this->timeStart->format("U.u"); |
||
21 | $this->memoryPeakUsage = memory_get_peak_usage(true) / 1024; |
||
22 | } |
||
23 | |||
24 | public function getDuration() |
||
25 | { |
||
26 | return $this->duration; |
||
27 | } |
||
28 | |||
29 | public function getMemoryPeakUsage() |
||
32 | } |
||
33 | |||
34 | public function start() |
||
37 | } |
||
38 | |||
39 | protected function createCurrentTimeObject() |
||
49 | } |
||
50 | } |
||
51 |