Skip to content

Commit f7a7ff2

Browse files
committed
Reword
1 parent bf76aba commit f7a7ff2

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

components/stopwatch.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ time of certain parts of code so that you don't constantly have to parse
2727
use Symfony\Component\Stopwatch\Stopwatch;
2828

2929
$stopwatch = new Stopwatch();
30+
3031
// starts event named 'eventName'
3132
$stopwatch->start('eventName');
32-
// ... some code goes here
33+
34+
// ... run your code here
35+
3336
$event = $stopwatch->stop('eventName');
37+
// you can convert $event into a string for a quick summary
38+
// e.g. (string) $event = '4.50 MiB - 26 ms'
3439

3540
The :class:`Symfony\\Component\\Stopwatch\\StopwatchEvent` object can be retrieved
3641
from the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::start`,
@@ -120,16 +125,3 @@ method and specifying the id of the section to be reopened::
120125
$stopwatch->openSection('routing');
121126
$stopwatch->start('building_config_tree');
122127
$stopwatch->stopSection('routing');
123-
124-
125-
Printing a Summary
126-
------------------
127-
128-
The event can easily be printed to display a summary::
129-
130-
$stopwatch = new Stopwatch();
131-
$stopwatch->start();
132-
// ... do some work here
133-
$output->writeln($stopwatch->stop()); // prints something like default: 14.00 MiB - 2056 ms
134-
135-
This gives you a brief summary of the used memory an elapsed time.

0 commit comments

Comments
 (0)