Elgg  Version 4.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Debug\Profiler Class Reference

Analyzes duration of functions, queries, and processes. More...

Public Member Functions

 __invoke (\Elgg\Hook $hook)
 Append a SCRIPT element to the page output. More...
 

Protected Member Functions

 buildTree (Timer $timer)
 Return a tree of time periods from a Timer. More...
 
 flattenTree (array &$list=[], array $tree=[], $prefix= '')
 Turn the tree of times into a sorted list. More...
 
 formatTree (array $tree)
 Nicely format the elapsed time values. More...
 
 analyzePeriod ($name, array $times)
 Analyze a time period. More...
 
 findBeginTime (array $times)
 Get the microtime start time. More...
 
 findEndTime (array $times)
 Get the microtime end time. More...
 
 diffMicrotime ($start, $end)
 Calculate a precise time difference. More...
 

Protected Attributes

 $percentage_format = "%01.2f"
 
 $duration_format = "%01.6f"
 
 $minimum_percentage = 0.2
 
 $total
 

Detailed Description

Analyzes duration of functions, queries, and processes.

Definition at line 13 of file Profiler.php.

Member Function Documentation

Elgg\Debug\Profiler::__invoke ( \Elgg\Hook  $hook)

Append a SCRIPT element to the page output.

Parameters
\Elgg\Hook$hook'output', 'page'
Returns
string

Definition at line 31 of file Profiler.php.

Elgg\Debug\Profiler::analyzePeriod (   $name,
array  $times 
)
protected

Analyze a time period.

Parameters
string$namePeriod name
array$timesTimes
Returns
false|array False if missing begin/end time

Definition at line 142 of file Profiler.php.

Elgg\Debug\Profiler::buildTree ( Timer  $timer)
protected

Return a tree of time periods from a Timer.

Parameters
Timer$timerTimer object
Returns
false|array

Definition at line 73 of file Profiler.php.

Elgg\Debug\Profiler::diffMicrotime (   $start,
  $end 
)
protected

Calculate a precise time difference.

Parameters
float$startresult of microtime(true)
float$endresult of microtime(true)
Returns
float difference in seconds, calculated with minimum precision loss

Definition at line 236 of file Profiler.php.

Elgg\Debug\Profiler::findBeginTime ( array  $times)
protected

Get the microtime start time.

Parameters
array$timesTime periods
Returns
float|false

Definition at line 197 of file Profiler.php.

Elgg\Debug\Profiler::findEndTime ( array  $times)
protected

Get the microtime end time.

Parameters
array$timesTime periods
Returns
float|false

Definition at line 216 of file Profiler.php.

Elgg\Debug\Profiler::flattenTree ( array &  $list = [],
array  $tree = [],
  $prefix = '' 
)
protected

Turn the tree of times into a sorted list.

Parameters
array$listOutput list of times to populate
array$treeResult of buildTree()
string$prefixPrefix of period string. Leave empty.
Returns
void

Definition at line 95 of file Profiler.php.

Elgg\Debug\Profiler::formatTree ( array  $tree)
protected

Nicely format the elapsed time values.

Parameters
array$treeResult of buildTree()
Returns
array

Definition at line 123 of file Profiler.php.

Member Data Documentation

Elgg\Debug\Profiler::$duration_format = "%01.6f"
protected

Definition at line 16 of file Profiler.php.

Elgg\Debug\Profiler::$minimum_percentage = 0.2
protected

Definition at line 17 of file Profiler.php.

Elgg\Debug\Profiler::$percentage_format = "%01.2f"
protected

Definition at line 15 of file Profiler.php.

Elgg\Debug\Profiler::$total
protected

Definition at line 22 of file Profiler.php.


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