blob: 026bfac602c778e266b47c9bb4e6e1a73302810d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Code Igniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
* @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* Code Igniter Profiler Class
*
* This class enables you to display benchmark, query, and other data
* in order to help with debugging and optimization
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author Rick Ellis
* @link http://www.codeigniter.com/user_guide/libraries/benchmark.html
*/
class CI_Profiler {
// --------------------------------------------------------------------
/**
* Auto Profiler
*
* This function cycles through the entire array of mark points and
* matches any two points that are named identially (ending in "_start"
* and "_end" respectively). It then compiles the execution times for
* all points and returns it as an array
*
* @access private
* @return array
*/
function _compile_benchmarks()
{
$obj =& get_instance();
$times = array();
foreach ($obj->benchmark->marker as $key => $val)
{
// We match the "end" marker so that the list ends
// up in the order that it was defined
if (preg_match("/(.+?)_end/i", $key, $match))
{
if (isset($obj->benchmark->marker[$match[1].'_end']))
{
$times[$match[1]] = $obj->benchmark->elapsed_time($match[1].'_start', $key);
}
}
}
return $times;
}
// --------------------------------------------------------------------
}
// END CI_Profiler class
?>
|