35 $this->name = 0 === strpos(
$name,
'__internal_') ?
'INTERNAL' :
$name;
81 $this->profiles[] = $profile;
91 if ($this->
isRoot() && $this->profiles) {
94 foreach ($this->profiles as $profile) {
95 $duration += $profile->getDuration();
101 return isset($this->ends[
'wt']) && isset($this->starts[
'wt']) ? $this->ends[
'wt'] - $this->starts[
'wt'] : 0;
111 return isset($this->ends[
'mu']) && isset($this->starts[
'mu']) ? $this->ends[
'mu'] - $this->starts[
'mu'] : 0;
121 return isset($this->ends[
'pmu']) && isset($this->starts[
'pmu']) ? $this->ends[
'pmu'] - $this->starts[
'pmu'] : 0;
129 $this->starts = array(
130 'wt' => microtime(
true),
131 'mu' => memory_get_usage(),
132 'pmu' => memory_get_peak_usage(),
142 'wt' => microtime(
true),
143 'mu' => memory_get_usage(),
144 'pmu' => memory_get_peak_usage(),
150 $this->starts = $this->ends = $this->profiles = array();
161 return serialize(array($this->
template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles));
166 list($this->
template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) =
unserialize(
$data);
170 class_alias(
'Twig_Profiler_Profile',
'Twig\Profiler\Profile',
false);
getPeakMemoryUsage()
Returns the peak memory usage in bytes.
getMemoryUsage()
Returns the memory usage in bytes.
__construct($template='main', $type=self::ROOT, $name='main')
enter()
Starts the profiling.
getDuration()
Returns the duration in microseconds.
leave()
Stops the profiling.
addProfile(Twig_Profiler_Profile $profile)