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),
142 'wt' => microtime(
true),
150 $this->starts = $this->ends = $this->profiles = array();
156 return new ArrayIterator($this->profiles);
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);
170class_alias(
'Twig_Profiler_Profile',
'Twig\Profiler\Profile',
false);
memory_get_peak_usage(true)/1024/1024)
memory_get_usage(true)/1024/1024)
An exception for terminatinating execution or to throw for unit testing.
leave()
Stops the profiling.
enter()
Starts the profiling.
getPeakMemoryUsage()
Returns the peak memory usage in bytes.
getDuration()
Returns the duration in microseconds.
__construct($template='main', $type=self::ROOT, $name='main')
addProfile(Twig_Profiler_Profile $profile)
getMemoryUsage()
Returns the memory usage in bytes.