1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5
* An open source application development framework for PHP 5.1.6 or newer
8
* @author ExpressionEngine Dev Team
9
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10
* @license http://codeigniter.com/user_guide/license.html
11
* @link http://codeigniter.com
16
// ------------------------------------------------------------------------
19
* CodeIgniter Benchmark Class
21
* This class enables you to mark points and calculate the time difference
22
* between them. Memory consumption can also be displayed.
24
* @package CodeIgniter
25
* @subpackage Libraries
27
* @author ExpressionEngine Dev Team
28
* @link http://codeigniter.com/user_guide/libraries/benchmark.html
33
* List of all benchmark markers and when they were added
37
var $marker = array();
39
// --------------------------------------------------------------------
42
* Set a benchmark marker
44
* Multiple calls to this function can be made so that several
45
* execution points can be timed
48
* @param string $name name of the marker
53
$this->marker[$name] = microtime();
56
// --------------------------------------------------------------------
59
* Calculates the time difference between two marked points.
61
* If the first parameter is empty this function instead returns the
62
* {elapsed_time} pseudo-variable. This permits the full system
63
* execution time to be shown in a template. The output class will
64
* swap the real value for this variable.
67
* @param string a particular marked point
68
* @param string a particular marked point
69
* @param integer the number of decimal places
72
function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
76
return '{elapsed_time}';
79
if ( ! isset($this->marker[$point1]))
84
if ( ! isset($this->marker[$point2]))
86
$this->marker[$point2] = microtime();
89
list($sm, $ss) = explode(' ', $this->marker[$point1]);
90
list($em, $es) = explode(' ', $this->marker[$point2]);
92
return number_format(($em + $es) - ($sm + $ss), $decimals);
95
// --------------------------------------------------------------------
100
* This function returns the {memory_usage} pseudo-variable.
101
* This permits it to be put it anywhere in a template
102
* without the memory being calculated until the end.
103
* The output class will swap the real value for this variable.
108
function memory_usage()
110
return '{memory_usage}';
115
// END CI_Benchmark class
117
/* End of file Benchmark.php */
118
/* Location: ./system/core/Benchmark.php */
b'\\ No newline at end of file'