Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions profiler/stopwatch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. index::
single: Profiling; Stopwatch

How to show custom timing
=========================

Inject :class:`Symfony\\Component\\Stopwatch\\Stopwatch` by autowiring. Or do ``$stopwatch = $this->get('debug.stopwatch');`` in a Controller.

All timing mesurements done by this stopwatch are shown in the profiler on the page performance.

short example::

$stopwatch->start('anEvent', 'customCategory');
$stopwatch->lapse('anEvent');
$stopwatch->stop('anEvent');

:doc:`/component/stopwatch` explains the methods in more details.