mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
fixed the profiler duration for the root node
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.22.0 (2015-XX-XX)
|
||||
|
||||
* fixed the profiler duration for the root node
|
||||
* deprecated Twig_Environment::clearCacheFiles(), Twig_Environment::getCacheFilename(),
|
||||
and Twig_Environment::writeCacheFile()
|
||||
* added a way to override the filesystem template cache system
|
||||
|
||||
@@ -86,6 +86,16 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user