PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.85
WindPress – Tailwind CSS integration for WordPress v3.2.85
3.2.90 3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 All 144 releases
windpress / vendor / symfony / stopwatch / StopwatchPeriod.php

StopwatchPeriod.php in WindPress – Tailwind CSS integration for WordPress 3.2.85, at vendor/symfony/stopwatch/StopwatchPeriod.php

75 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace WindPressDeps\Symfony\Component\Stopwatch;
12
13 /**
14 * Represents an Period for an Event.
15 *
16 * @author Fabien Potencier <fabien@symfony.com>
17 */
18 class StopwatchPeriod
19 {
20 private $start;
21 private $end;
22 private $memory;
23 /**
24 * @param int|float $start The relative time of the start of the period (in milliseconds)
25 * @param int|float $end The relative time of the end of the period (in milliseconds)
26 * @param bool $morePrecision If true, time is stored as float to keep the original microsecond precision
27 */
28 public function __construct($start, $end, bool $morePrecision = \false)
29 {
30 $this->start = $morePrecision ? (float) $start : (int) $start;
31 $this->end = $morePrecision ? (float) $end : (int) $end;
32 $this->memory = memory_get_usage(\true);
33 }
34 /**
35 * Gets the relative time of the start of the period in milliseconds.
36 *
37 * @return int|float
38 */
39 public function getStartTime()
40 {
41 return $this->start;
42 }
43 /**
44 * Gets the relative time of the end of the period in milliseconds.
45 *
46 * @return int|float
47 */
48 public function getEndTime()
49 {
50 return $this->end;
51 }
52 /**
53 * Gets the time spent in this period in milliseconds.
54 *
55 * @return int|float
56 */
57 public function getDuration()
58 {
59 return $this->end - $this->start;
60 }
61 /**
62 * Gets the memory usage in bytes.
63 *
64 * @return int
65 */
66 public function getMemory()
67 {
68 return $this->memory;
69 }
70 public function __toString(): string
71 {
72 return sprintf('%.2F MiB - %d ms', $this->getMemory() / 1024 / 1024, $this->getDuration());
73 }
74 }
75