Skip to content


Repository files navigation

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)

// starts event named 'eventName'

// ... run your code here

// optionally, start a new "lap" time

// ... run your code here

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