Barryvdh\Debugbar\LaravelDebugbar::measure PHP Method

measure() public method

Utility function to measure the execution of a Closure
public measure ( string $label, Closure $closure )
$label string
$closure Closure
    public function measure($label, \Closure $closure)
    {
        if ($this->hasCollector('time')) {
            /** @var \DebugBar\DataCollector\TimeDataCollector $collector */
            $collector = $this->getCollector('time');
            $collector->measure($label, $closure);
        } else {
            $closure();
        }
    }

Usage Example

 /**
  * Utility function to measure the execution of a Closure
  *
  * @param string $label
  * @param \Closure $closure
  * @static 
  */
 public static function measure($label, $closure)
 {
     return \Barryvdh\Debugbar\LaravelDebugbar::measure($label, $closure);
 }