summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/language/english/profiler_lang.php6
-rw-r--r--system/libraries/Profiler.php119
-rw-r--r--user_guide/changelog.html1
3 files changed, 124 insertions, 2 deletions
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php
index d82fdbdee..b3a0dd3ba 100644
--- a/system/language/english/profiler_lang.php
+++ b/system/language/english/profiler_lang.php
@@ -2,9 +2,15 @@
$lang['profiler_benchmarks'] = 'BENCHMARKS';
$lang['profiler_queries'] = 'QUERIES';
+$lang['profiler_get_data'] = 'GET DATA';
$lang['profiler_post_data'] = 'POST DATA';
+$lang['profiler_uri_string'] = 'URI STRING';
+$lang['profiler_memory_usage'] = 'MEMORY USAGE';
$lang['profiler_no_db'] = 'Database driver is not currently loaded';
$lang['profiler_no_queries'] = 'No queries were run';
$lang['profiler_no_post'] = 'No POST data exists';
+$lang['profiler_no_get'] = 'No GET data exists';
+$lang['profiler_no_uri'] = 'No URI data exists';
+$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
?> \ No newline at end of file
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
@@ -137,6 +137,56 @@ class CI_Profiler {
// --------------------------------------------------------------------
/**
+ * Compile $_GET Data
+ *
+ * @access private
+ * @return string
+ */
+ function _compile_get()
+ {
+ $output = "\n\n";
+ $output .= '<fieldset style="border:1px solid #cd6e00;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
+ $output .= "\n";
+ $output .= '<legend style="color:#cd6e00;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_get_data').'&nbsp;&nbsp;</legend>';
+ $output .= "\n";
+
+ if (count($_GET) == 0)
+ {
+ $output .= "<div style='color:#cd6e00;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_get')."</div>";
+ }
+ else
+ {
+ $output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
+
+ foreach ($_GET as $key => $val)
+ {
+ if ( ! is_numeric($key))
+ {
+ $key = "'".$key."'";
+ }
+
+ $output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>&#36;_GET[".$key."]&nbsp;&nbsp; </td><td width='50%' style='color:#cd6e00;font-weight:normal;background-color:#ddd;'>";
+ if (is_array($val))
+ {
+ $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>";
+ }
+ else
+ {
+ $output .= htmlspecialchars(stripslashes($val));
+ }
+ $output .= "</td></tr>\n";
+ }
+
+ $output .= "</table>\n";
+ }
+ $output .= "</fieldset>";
+
+ return $output;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Compile $_POST Data
*
* @access private
@@ -188,6 +238,68 @@ class CI_Profiler {
// --------------------------------------------------------------------
/**
+ * Show query string
+ *
+ * @access private
+ * @return string
+ */
+ function _compile_uri_string()
+ {
+ $output = "\n\n";
+ $output .= '<fieldset style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
+ $output .= "\n";
+ $output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_uri_string').'&nbsp;&nbsp;</legend>';
+ $output .= "\n";
+
+ if ($this->CI->uri->uri_string == '')
+ {
+ $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_uri')."</div>";
+ }
+ else
+ {
+ $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->uri->uri_string."</div>";
+ }
+
+ $output .= "</fieldset>";
+
+ return $output;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Compile memory usage
+ *
+ * Display total used memory
+ *
+ * @access public
+ * @return string
+ */
+ function _compile_memory_usage()
+ {
+ $output = "\n\n";
+ $output .= '<fieldset style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
+ $output .= "\n";
+ $output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_memory_usage').'&nbsp;&nbsp;</legend>';
+ $output .= "\n";
+
+ if (function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '')
+ {
+ $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".number_format($usage).' bytes</div>';
+ }
+ else
+ {
+ $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory_usage')."</div>";
+ }
+
+ $output .= "</fieldset>";
+
+ return $output;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Run the Profiler
*
* @access private
@@ -197,8 +309,11 @@ class CI_Profiler {
{
$output = '<br clear="all" />';
$output .= "<div style='background-color:#fff;padding:10px;'>";
-
- $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();
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index a102cc96a..66a1cffd3 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -91,6 +91,7 @@ Change Log
<li>Added titles to all user manual pages.</li>
<li>Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries</li>
<li>Added <a href="http://codeigniter.com/user_guide/libraries/zip.html">Zip Encoding Class</a> to the table of contents of the userguide.</li>
+ <li>Added memory usage, GET, and URI string data to Profiler output.</li>
<li>Moved the safe mode and auth checks for the Email library into the constructor. </li>
<li>Moved part of the userguide menu javascript to an external file.</li>
<li>Modified variable names in _ci_load() method of Loader class to avoid conflicts with view variables.</li>