| <?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 |
| ?> |