Skip to content

Instantly share code, notes, and snippets.

@romaricdrigon
Created March 15, 2019 15:23
Show Gist options
  • Save romaricdrigon/ad02f0021c4f29c2fff280186ceb0495 to your computer and use it in GitHub Desktop.
Save romaricdrigon/ad02f0021c4f29c2fff280186ceb0495 to your computer and use it in GitHub Desktop.
Exemple d'utilisation du Stopwatch
<?php
// L'astuce est bien de récupérer l'instance StopWatch du container,
// éventuellement via auto-injection (sous Symfony 4),
// mais pas d'en créer une nouvelle (ie, new Stopwatch()...).
$stopwatch = $this->container->get('debug.stopwatch');
$stopwatch->start('mon_temps', 'netinfluence');
// ...
usleep(100);
$stopwatch->stop('mon_temps');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment