ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_Profiler_Profile Class Reference
+ Inheritance diagram for Twig_Profiler_Profile:
+ Collaboration diagram for Twig_Profiler_Profile:

Public Member Functions

 __construct ($template='main', $type=self::ROOT, $name='main')
 
 getTemplate ()
 
 getType ()
 
 getName ()
 
 isRoot ()
 
 isTemplate ()
 
 isBlock ()
 
 isMacro ()
 
 getProfiles ()
 
 addProfile (Twig_Profiler_Profile $profile)
 
 getDuration ()
 Returns the duration in microseconds. More...
 
 getMemoryUsage ()
 Returns the memory usage in bytes. More...
 
 getPeakMemoryUsage ()
 Returns the peak memory usage in bytes. More...
 
 enter ()
 Starts the profiling. More...
 
 leave ()
 Stops the profiling. More...
 
 reset ()
 
 getIterator ()
 
 serialize ()
 
 unserialize ($data)
 

Data Fields

const ROOT = 'ROOT'
 
const BLOCK = 'block'
 
const TEMPLATE = 'template'
 
const MACRO = 'macro'
 

Private Attributes

 $template
 
 $name
 
 $type
 
 $starts = array()
 
 $ends = array()
 
 $profiles = array()
 

Detailed Description

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 17 of file Profile.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Profiler_Profile::__construct (   $template = 'main',
  $type = self::ROOT,
  $name = 'main' 
)

Definition at line 31 of file Profile.php.

References $name, $template, $type, and enter().

32  {
33  $this->template = $template;
34  $this->type = $type;
35  $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name;
36  $this->enter();
37  }
enter()
Starts the profiling.
Definition: Profile.php:127
+ Here is the call graph for this function:

Member Function Documentation

◆ addProfile()

Twig_Profiler_Profile::addProfile ( Twig_Profiler_Profile  $profile)

Definition at line 79 of file Profile.php.

80  {
81  $this->profiles[] = $profile;
82  }

◆ enter()

Twig_Profiler_Profile::enter ( )

Starts the profiling.

Definition at line 127 of file Profile.php.

References array.

Referenced by __construct(), and reset().

128  {
129  $this->starts = array(
130  'wt' => microtime(true),
131  'mu' => memory_get_usage(),
132  'pmu' => memory_get_peak_usage(),
133  );
134  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getDuration()

Twig_Profiler_Profile::getDuration ( )

Returns the duration in microseconds.

Returns
int

Definition at line 89 of file Profile.php.

References isRoot().

Referenced by Twig_Profiler_Dumper_Base\dumpProfile(), Twig_Profiler_Dumper_Blackfire\dumpProfile(), Twig_Profiler_Dumper_Text\formatTime(), and Twig_Profiler_Dumper_Html\formatTime().

90  {
91  if ($this->isRoot() && $this->profiles) {
92  // for the root node with children, duration is the sum of all child durations
93  $duration = 0;
94  foreach ($this->profiles as $profile) {
95  $duration += $profile->getDuration();
96  }
97 
98  return $duration;
99  }
100 
101  return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0;
102  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIterator()

Twig_Profiler_Profile::getIterator ( )

Definition at line 154 of file Profile.php.

155  {
156  return new ArrayIterator($this->profiles);
157  }

◆ getMemoryUsage()

Twig_Profiler_Profile::getMemoryUsage ( )

Returns the memory usage in bytes.

Returns
int

Definition at line 109 of file Profile.php.

Referenced by Twig_Profiler_Dumper_Blackfire\dumpProfile().

110  {
111  return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0;
112  }
+ Here is the caller graph for this function:

◆ getName()

Twig_Profiler_Profile::getName ( )

Definition at line 49 of file Profile.php.

References $name.

Referenced by Twig_Profiler_Dumper_Base\dumpProfile(), Twig_Profiler_Dumper_Text\formatNonTemplate(), and Twig_Profiler_Dumper_Html\formatNonTemplate().

50  {
51  return $this->name;
52  }
+ Here is the caller graph for this function:

◆ getPeakMemoryUsage()

Twig_Profiler_Profile::getPeakMemoryUsage ( )

Returns the peak memory usage in bytes.

Returns
int

Definition at line 119 of file Profile.php.

Referenced by Twig_Profiler_Dumper_Blackfire\dumpProfile().

120  {
121  return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0;
122  }
+ Here is the caller graph for this function:

◆ getProfiles()

Twig_Profiler_Profile::getProfiles ( )

Definition at line 74 of file Profile.php.

References $profiles.

Referenced by Twig_Profiler_Dumper_Base\dumpProfile().

75  {
76  return $this->profiles;
77  }
+ Here is the caller graph for this function:

◆ getTemplate()

Twig_Profiler_Profile::getTemplate ( )

◆ getType()

Twig_Profiler_Profile::getType ( )

Definition at line 44 of file Profile.php.

References $type.

Referenced by Twig_Profiler_Dumper_Text\formatNonTemplate(), and Twig_Profiler_Dumper_Html\formatNonTemplate().

45  {
46  return $this->type;
47  }
+ Here is the caller graph for this function:

◆ isBlock()

Twig_Profiler_Profile::isBlock ( )

Definition at line 64 of file Profile.php.

References $type.

65  {
66  return self::BLOCK === $this->type;
67  }

◆ isMacro()

Twig_Profiler_Profile::isMacro ( )

Definition at line 69 of file Profile.php.

References $type.

70  {
71  return self::MACRO === $this->type;
72  }

◆ isRoot()

Twig_Profiler_Profile::isRoot ( )

Definition at line 54 of file Profile.php.

References $type.

Referenced by Twig_Profiler_Dumper_Base\dumpProfile(), and getDuration().

55  {
56  return self::ROOT === $this->type;
57  }
+ Here is the caller graph for this function:

◆ isTemplate()

Twig_Profiler_Profile::isTemplate ( )

Definition at line 59 of file Profile.php.

References $type.

Referenced by Twig_Profiler_Dumper_Base\dumpProfile().

60  {
61  return self::TEMPLATE === $this->type;
62  }
+ Here is the caller graph for this function:

◆ leave()

Twig_Profiler_Profile::leave ( )

Stops the profiling.

Definition at line 139 of file Profile.php.

References array.

Referenced by Twig_Extension_Profiler\leave().

140  {
141  $this->ends = array(
142  'wt' => microtime(true),
143  'mu' => memory_get_usage(),
144  'pmu' => memory_get_peak_usage(),
145  );
146  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ reset()

Twig_Profiler_Profile::reset ( )

Definition at line 148 of file Profile.php.

References array, and enter().

149  {
150  $this->starts = $this->ends = $this->profiles = array();
151  $this->enter();
152  }
Create styles array
The data for the language used.
enter()
Starts the profiling.
Definition: Profile.php:127
+ Here is the call graph for this function:

◆ serialize()

Twig_Profiler_Profile::serialize ( )

Definition at line 159 of file Profile.php.

References array.

160  {
161  return serialize(array($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles));
162  }
Create styles array
The data for the language used.

◆ unserialize()

Twig_Profiler_Profile::unserialize (   $data)

Definition at line 164 of file Profile.php.

References $data.

165  {
166  list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data);
167  }

Field Documentation

◆ $ends

Twig_Profiler_Profile::$ends = array()
private

Definition at line 28 of file Profile.php.

◆ $name

Twig_Profiler_Profile::$name
private

Definition at line 25 of file Profile.php.

Referenced by __construct(), and getName().

◆ $profiles

Twig_Profiler_Profile::$profiles = array()
private

Definition at line 29 of file Profile.php.

Referenced by getProfiles().

◆ $starts

Twig_Profiler_Profile::$starts = array()
private

Definition at line 27 of file Profile.php.

◆ $template

Twig_Profiler_Profile::$template
private

Definition at line 24 of file Profile.php.

Referenced by __construct(), and getTemplate().

◆ $type

Twig_Profiler_Profile::$type
private

Definition at line 26 of file Profile.php.

Referenced by __construct(), getType(), isBlock(), isMacro(), isRoot(), and isTemplate().

◆ BLOCK

const Twig_Profiler_Profile::BLOCK = 'block'

◆ MACRO

const Twig_Profiler_Profile::MACRO = 'macro'

◆ ROOT

◆ TEMPLATE


The documentation for this class was generated from the following file: