You are here

public function Twig_Profiler_Profile::getDuration in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Profiler/Profile.php \Twig_Profiler_Profile::getDuration()

Returns the duration in microseconds.

Return value

int

File

vendor/twig/twig/lib/Twig/Profiler/Profile.php, line 87

Class

Twig_Profiler_Profile
@author Fabien Potencier <fabien@symfony.com>

Code

public function getDuration() {
  if ($this
    ->isRoot() && $this->profiles) {

    // for the root node with children, duration is the sum of all child durations
    $duration = 0;
    foreach ($this->profiles as $profile) {
      $duration += $profile
        ->getDuration();
    }
    return $duration;
  }
  return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0;
}