Skip to content

Commit 973eab5

Browse files
committed
extend profiler article about how to use the stopwatch
1 parent 01db1c4 commit 973eab5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

profiler/stopwatch.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. index::
2+
single: Profiling; Stopwatch
3+
4+
How to show custom timing
5+
=========================
6+
7+
Inject :class:`Symfony\\Component\\Stopwatch\\Stopwatch` by autowiring. Or do ``$stopwatch = $this->get('debug.stopwatch');`` in a Controller.
8+
9+
All timing mesurements done by this stopwatch are shown in the profiler on the page performance.
10+
11+
short example::
12+
13+
$stopwatch->start('anEvent', 'customCategory');
14+
$stopwatch->lapse('anEvent');
15+
$stopwatch->stop('anEvent');
16+
17+
:doc:`/component/stopwatch` explains the methods in more details.

0 commit comments

Comments
 (0)