From 0b607252b1f3bcabfb8150120e683795ec3a0890 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 13 Feb 2013 10:34:16 +0200 Subject: Added small feature to profiler: total execution time count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adds additional information to profiler like: DATABASE:  test   QUERIES: 3 (0.0016s)  (Hide) --- system/libraries/Profiler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index e93239901..67922d51c 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -238,6 +238,8 @@ class CI_Profiler { foreach ($dbs as $name => $db) { $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; + + $total_time = number_format(array_sum($db->query_times), 4) . 's'; $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; @@ -250,7 +252,7 @@ class CI_Profiler { ."\n" .'  '.$this->CI->lang->line('profiler_database') .':  '.$db->database.' ('.$name.')   '.$this->CI->lang->line('profiler_queries') - .': '.count($db->queries).'  '.$show_hide_js."\n\n\n" + .': '.count($db->queries).'('.$total_time.')'.'  '.$show_hide_js."\n\n\n" .'\n"; if (count($db->queries) === 0) @@ -553,4 +555,4 @@ class CI_Profiler { } /* End of file Profiler.php */ -/* Location: ./system/libraries/Profiler.php */ \ No newline at end of file +/* Location: ./system/libraries/Profiler.php */ -- cgit v1.2.3-24-g4f1b From 554d5dc6c1b9c6880a2fba150018c21ded8675c6 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 13 Feb 2013 22:37:31 +0200 Subject: changes according to narfbg's request --- system/language/english/profiler_lang.php | 1 + system/libraries/Profiler.php | 6 +++--- user_guide_src/source/changelog.rst | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php index dfe034e79..68e794e79 100644 --- a/system/language/english/profiler_lang.php +++ b/system/language/english/profiler_lang.php @@ -46,6 +46,7 @@ $lang['profiler_no_memory'] = 'Memory Usage Unavailable'; $lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.'; $lang['profiler_section_hide'] = 'Hide'; $lang['profiler_section_show'] = 'Show'; +$lang['profiler_seconds'] = 'seconds'; /* End of file profiler_lang.php */ /* Location: ./system/language/english/profiler_lang.php */ \ No newline at end of file diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 67922d51c..a3fa61c7c 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -238,8 +238,8 @@ class CI_Profiler { foreach ($dbs as $name => $db) { $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; - - $total_time = number_format(array_sum($db->query_times), 4) . 's'; + + $total_time = number_format(array_sum($db->query_times), 4).$this->CI->lang->line('profiler_seconds'); $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; @@ -555,4 +555,4 @@ class CI_Profiler { } /* End of file Profiler.php */ -/* Location: ./system/libraries/Profiler.php */ +/* Location: ./system/libraries/Profiler.php */ \ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 893c3db61..3969943f6 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -271,7 +271,9 @@ Release Date: Not Released - :doc:`Encryption Library ` changes include: - Added support for hashing algorithms other than SHA1 and MD5. - Removed previously deprecated ``sha1()`` method. - - :doc:`Profiler Library ` now also displays database object names. + - :doc:`Profiler Library ` changes include: + - Database object names displayed. + - The sum of all queries running times in seconds displayed. - :doc:`Migration Library ` changes include: - Added support for timestamp-based migrations (enabled by default). - Added ``$config['migration_type']`` to allow switching between *sequential* and *timestamp* migrations. -- cgit v1.2.3-24-g4f1b From 3224f077c37a054ea1995c07fe54bbe8b00e058a Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 14 Feb 2013 09:26:24 +0200 Subject: changes according to narfbg's request --- system/language/english/profiler_lang.php | 2 +- system/libraries/Profiler.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php index 68e794e79..0ed5f4cb0 100644 --- a/system/language/english/profiler_lang.php +++ b/system/language/english/profiler_lang.php @@ -46,7 +46,7 @@ $lang['profiler_no_memory'] = 'Memory Usage Unavailable'; $lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.'; $lang['profiler_section_hide'] = 'Hide'; $lang['profiler_section_show'] = 'Show'; -$lang['profiler_seconds'] = 'seconds'; +$lang['profiler_seconds'] = 'seconds'; /* End of file profiler_lang.php */ /* Location: ./system/language/english/profiler_lang.php */ \ No newline at end of file diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index a3fa61c7c..ac8f6ba71 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -238,8 +238,8 @@ class CI_Profiler { foreach ($dbs as $name => $db) { $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; - - $total_time = number_format(array_sum($db->query_times), 4).$this->CI->lang->line('profiler_seconds'); + + $total_time = number_format(array_sum($db->query_times), 4).' '.$this->CI->lang->line('profiler_seconds'); $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; -- cgit v1.2.3-24-g4f1b