This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Stopwatch
Nicolas Grekas 854de3cc2e Merge branch '5.1' into 5.2
* 5.1:
  Use createMock() and use import instead of FQCN
2021-01-27 11:15:41 +01:00
..
Tests Merge branch '5.1' into 5.2 2021-01-27 11:15:41 +01:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [Stopwatch] fix wrong nullable type 2019-07-29 18:24:06 +02:00
composer.json Merge branch '4.4' into 5.1 2021-01-10 17:29:19 +01:00
LICENSE Bump license year 2021-01-01 10:24:35 +01:00
phpunit.xml.dist Bump phpunit XSD version to 5.2 2018-11-11 12:18:13 +01:00
README.md Added Stopwatch example to the README 2020-10-04 14:01:13 +02:00
Section.php Merge branch '3.4' into 4.4 2020-09-02 18:08:58 +02:00
Stopwatch.php Merge branch '4.4' into 5.0 2020-03-18 09:00:37 +01:00
StopwatchEvent.php Add name property to the stopwatchEvent 2020-08-11 11:41:23 +02:00
StopwatchPeriod.php Update StopwatchPeriod.php 2020-07-31 08:22:04 +02:00

Stopwatch Component

The Stopwatch component provides a way to profile code.

Getting Started

$ composer require symfony/stopwatch
use Symfony\Component\Stopwatch\Stopwatch;

$stopwatch = new Stopwatch();

// optionally group events into sections (e.g. phases of the execution)
$stopwatch->openSection();

// starts event named 'eventName'
$stopwatch->start('eventName');

// ... run your code here

// optionally, start a new "lap" time
$stopwatch->lap('foo');

// ... run your code here

$event = $stopwatch->stop('eventName');

$stopwatch->stopSection('phase_1');

Resources