From d087ef8d248878c64162f6556f6bef320c92c73c Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 18 Jan 2008 21:41:23 +0000 Subject: added GET, URI string, and memory usage to Profiler output --- system/libraries/Profiler.php | 119 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index c4707c377..65d62f2ae 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -136,6 +136,56 @@ class CI_Profiler { // -------------------------------------------------------------------- + /** + * Compile $_GET Data + * + * @access private + * @return string + */ + function _compile_get() + { + $output = "\n\n"; + $output .= '
'; + $output .= "\n"; + $output .= '  '.$this->CI->lang->line('profiler_get_data').'  '; + $output .= "\n"; + + if (count($_GET) == 0) + { + $output .= "
".$this->CI->lang->line('profiler_no_get')."
"; + } + else + { + $output .= "\n\n\n"; + + foreach ($_GET as $key => $val) + { + if ( ! is_numeric($key)) + { + $key = "'".$key."'"; + } + + $output .= "\n"; + } + + $output .= "
$_GET[".$key."]   "; + if (is_array($val)) + { + $output .= "
" . htmlspecialchars(stripslashes(print_r($val, true))) . "
"; + } + else + { + $output .= htmlspecialchars(stripslashes($val)); + } + $output .= "
\n"; + } + $output .= "
"; + + return $output; + } + + // -------------------------------------------------------------------- + /** * Compile $_POST Data * @@ -187,6 +237,68 @@ class CI_Profiler { // -------------------------------------------------------------------- + /** + * Show query string + * + * @access private + * @return string + */ + function _compile_uri_string() + { + $output = "\n\n"; + $output .= '
'; + $output .= "\n"; + $output .= '  '.$this->CI->lang->line('profiler_uri_string').'  '; + $output .= "\n"; + + if ($this->CI->uri->uri_string == '') + { + $output .= "
".$this->CI->lang->line('profiler_no_uri')."
"; + } + else + { + $output .= "
".$this->CI->uri->uri_string."
"; + } + + $output .= "
"; + + return $output; + } + + // -------------------------------------------------------------------- + + /** + * Compile memory usage + * + * Display total used memory + * + * @access public + * @return string + */ + function _compile_memory_usage() + { + $output = "\n\n"; + $output .= '
'; + $output .= "\n"; + $output .= '  '.$this->CI->lang->line('profiler_memory_usage').'  '; + $output .= "\n"; + + if (function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '') + { + $output .= "
".number_format($usage).' bytes
'; + } + else + { + $output .= "
".$this->CI->lang->line('profiler_no_memory_usage')."
"; + } + + $output .= "
"; + + return $output; + } + + // -------------------------------------------------------------------- + /** * Run the Profiler * @@ -197,8 +309,11 @@ class CI_Profiler { { $output = '
'; $output .= "
"; - - $output .= $this->_compile_benchmarks(); + + $output .= $this->_compile_memory_usage(); + $output .= $this->_compile_benchmarks(); + $output .= $this->_compile_uri_string(); + $output .= $this->_compile_get(); $output .= $this->_compile_post(); $output .= $this->_compile_queries(); -- cgit v1.2.3-24-g4f1b