From ec5beb2f9d5539d60ff665c7137160a4fd429436 Mon Sep 17 00:00:00 2001 From: Simon Heimberg Date: Fri, 23 Feb 2018 15:28:20 +0100 Subject: [PATCH 1/2] write how to use the stopwatch in symfony profiler --- components/stopwatch.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index c3ebd41031d..fc700db467f 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -48,6 +48,18 @@ You can also provide a category name to an event:: You can consider categories as a way of tagging events. For example, the Symfony Profiler tool uses categories to nicely color-code different events. +Usage in symfony +---------------- + +In a Controller, do: + + $stopwatch = $this->get('debug.stopwatch'); + $stopwatch->start('anEvent'); + +Or inject `Symfony\Component\Stopwatch\Stopwatch` by autowiring. + +Thereafter this timing can be seen in the profiler. + Periods ------- From e34ce407771012fb36896b03ecfa76f6839ddee1 Mon Sep 17 00:00:00 2001 From: Simon Heimberg Date: Wed, 12 Sep 2018 09:33:41 +0200 Subject: [PATCH 2/2] improve formatting in stopwatch.rst --- components/stopwatch.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index fc700db467f..862b8808c84 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -51,13 +51,12 @@ Symfony Profiler tool uses categories to nicely color-code different events. Usage in symfony ---------------- -In a Controller, do: +In a Controller, do:: $stopwatch = $this->get('debug.stopwatch'); $stopwatch->start('anEvent'); -Or inject `Symfony\Component\Stopwatch\Stopwatch` by autowiring. - +Or inject :class:`Symfony\\Component\\Stopwatch\\Stopwatch` by autowiring. Thereafter this timing can be seen in the profiler. Periods