Skip to content
5.3
Switch branches/tags
Code

Latest commit

* 5.2:
  Fix CS in README files
  Fix markdown
  [HttpKernel] Fixes tests for PHP7.4+
  [Filesystem] fix readlink for Windows
313d02f

Git stats

Files

Permalink
Failed to load latest commit information.

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