Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions _build/redirection_map
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
/cookbook/profiler/matchers /profiler/matchers
/cookbook/profiler/profiling_data /profiler/profiling_data
/cookbook/profiler/storage /profiler/storage
/cookbook/profiler/stopwatch /profiler/stopwatch
/cookbook/psr7 /components/psr7
/cookbook/request/index /request
/cookbook/request/load_balancer_reverse_proxy /deployment/proxies
Expand Down
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:`/components/stopwatch` explains the methods in more details.