Public Member Functions | |
| mark ($name) | |
| Set a benchmark marker. | |
| elapsed_time ($point1= '', $point2= '', $decimals=4) | |
| Calculates the time difference between two marked points. | |
| memory_usage () | |
| Memory Usage. | |
Public Attributes | |
| $marker = array() | |
Definition at line 30 of file Benchmark.php.
| CI_Benchmark::elapsed_time | ( | $ | point1 = '', |
|
| $ | point2 = '', |
|||
| $ | decimals = 4 | |||
| ) |
Calculates the time difference between two marked points.
If the first parameter is empty this function instead returns the {elapsed_time} pseudo-variable. This permits the full system execution time to be shown in a template. The output class will swap the real value for this variable.
public
| string | a particular marked point | |
| string | a particular marked point | |
| integer | the number of decimal places |
Definition at line 67 of file Benchmark.php.
00068 { 00069 if ($point1 == '') 00070 { 00071 return '{elapsed_time}'; 00072 } 00073 00074 if ( ! isset($this->marker[$point1])) 00075 { 00076 return ''; 00077 } 00078 00079 if ( ! isset($this->marker[$point2])) 00080 { 00081 $this->marker[$point2] = microtime(); 00082 } 00083 00084 list($sm, $ss) = explode(' ', $this->marker[$point1]); 00085 list($em, $es) = explode(' ', $this->marker[$point2]); 00086 00087 return number_format(($em + $es) - ($sm + $ss), $decimals); 00088 }
| CI_Benchmark::mark | ( | $ | name | ) |
Set a benchmark marker.
Multiple calls to this function can be made so that several execution points can be timed
public
| string | $name name of the marker |
Definition at line 46 of file Benchmark.php.
| CI_Benchmark::memory_usage | ( | ) |
Memory Usage.
This function returns the {memory_usage} pseudo-variable. This permits it to be put it anywhere in a template without the memory being calculated until the end. The output class will swap the real value for this variable.
public
Definition at line 103 of file Benchmark.php.
| CI_Benchmark::$marker = array() |
Definition at line 32 of file Benchmark.php.