Skip to content

Commit ec5beb2

Browse files
write how to use the stopwatch in symfony profiler
1 parent 0d079be commit ec5beb2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/stopwatch.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ You can also provide a category name to an event::
4848
You can consider categories as a way of tagging events. For example, the
4949
Symfony Profiler tool uses categories to nicely color-code different events.
5050

51+
Usage in symfony
52+
----------------
53+
54+
In a Controller, do:
55+
56+
$stopwatch = $this->get('debug.stopwatch');
57+
$stopwatch->start('anEvent');
58+
59+
Or inject `Symfony\Component\Stopwatch\Stopwatch` by autowiring.
60+
61+
Thereafter this timing can be seen in the profiler.
62+
5163
Periods
5264
-------
5365

0 commit comments

Comments
 (0)