summaryrefslogtreecommitdiffstats
path: root/system/libraries/Benchmark.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-02 23:59:12 +0200
committeradmin <devnull@localhost>2006-10-02 23:59:12 +0200
commite26611f93bfb21f5e143cc91ce529f6db52cdd88 (patch)
tree575b6b71408d25e6f4067b2a1533e0255fac707e /system/libraries/Benchmark.php
parentb8afd045b9ed165bdae0d18b3e6f7483a4566e1c (diff)
Diffstat (limited to 'system/libraries/Benchmark.php')
-rw-r--r--system/libraries/Benchmark.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/system/libraries/Benchmark.php b/system/libraries/Benchmark.php
index d8dd903e7..feedbf570 100644
--- a/system/libraries/Benchmark.php
+++ b/system/libraries/Benchmark.php
@@ -86,6 +86,38 @@ class CI_Benchmark {
// --------------------------------------------------------------------
/**
+ * 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 public
+ * @return array
+ */
+ function auto_profiler()
+ {
+ $marker_keys = array_reverse(array_keys($this->marker));
+
+ $times = array();
+ foreach ($marker_keys as $val)
+ {
+ if (preg_match("/(.+?)_start/i", $val, $match))
+ {
+ if (isset($this->marker[$match[1].'_end']))
+ {
+ $times[$match[1]] = $this->elapsed_time($val, $match[1].'_end');
+ }
+ }
+ }
+
+ return $times;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Memory Usage
*
* This function returns the {memory_usage} pseudo-variable.