@@ -34,13 +34,24 @@ microtime by yourself. Instead, use the simple
34
34
$event = $stopwatch->stop('eventName');
35
35
36
36
The :class: `Symfony\\ Component\\ Stopwatch\\ StopwatchEvent ` object can be retrieved
37
- from the :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::start `,
38
- :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::stop `,
39
- :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::lap ` and
40
- :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::getEvent ` methods.
37
+ from the :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::start `,
38
+ :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::stop `,
39
+ :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::lap ` and
40
+ :method: `Symfony\\ Component\\ Stopwatch\\ Stopwatch::getEvent ` methods.
41
41
The latter should be used when you need to retrieve the duration of an event
42
42
while it is still running.
43
43
44
+ .. tip ::
45
+
46
+ By default, the stopwatch truncates any sub-millisecond time measure to ``0 ``,
47
+ so you can't measure microseconds or nanoseconds. If you need more precision,
48
+ pass ``true `` to the ``Stopwatch `` class constructor to enable full precision::
49
+
50
+ $stopwatch = new Stopwatch(true);
51
+
52
+ .. versionadded :: 3.4
53
+ The full precision feature was introduced in Symfony 3.4.
54
+
44
55
You can also provide a category name to an event::
45
56
46
57
$stopwatch->start('eventName', 'categoryName');
0 commit comments