From 08f6020b0085842d4ae81949a0f4886c94158a55 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 3 Oct 2006 05:28:00 +0000 Subject: --- user_guide/libraries/benchmark.html | 72 ++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 41 deletions(-) (limited to 'user_guide/libraries/benchmark.html') diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html index b8b0bfd32..8c1dc2c44 100644 --- a/user_guide/libraries/benchmark.html +++ b/user_guide/libraries/benchmark.html @@ -78,9 +78,9 @@ timing of the entire system execution to be shown.

@@ -98,15 +98,15 @@ timing of the entire system execution to be shown.

Here's an example using real code:

-$this->benchmark->mark('start');
+$this->benchmark->mark('code_start');

// Some code happens here

-$this->benchmark->mark('end');
+$this->benchmark->mark('code_end');

-echo $this->benchmark->elapsed_time('start', 'end');
+echo $this->benchmark->elapsed_time('code_start', 'code_end');
-

Note: The words "start" and "end" are arbitrary. They are simply words used to set two markers. You can +

Note: The words "code_start" and "code_end" are arbitrary. They are simply words used to set two markers. You can use any words you want, and you can set multiple sets of markers. Consider this example:

$this->benchmark->mark('dog');
@@ -124,6 +124,32 @@ echo $this->benchmark->elapsed_time('cat', 'bird');
echo $this->benchmark->elapsed_time('dog', 'bird');
+ +

Profiling Your Benchmark Points

+ +

If you want your benchmark data to be available to the +Profiler all of your marked points must be set up in pairs, and +each mark point name must end with _start and _end. +Each pair of points must otherwise be named identically. Example:

+ + +$this->benchmark->mark('my_mark_start');
+
+// Some code happens here...
+
+$this->benchmark->mark('my_mark_end'); +

+ +$this->benchmark->mark('another_mark_start');
+
+// Some more code happens here...
+
+$this->benchmark->mark('another_mark_end'); + +

Please read the Profiler page for more information.

+ + +

Displaying Total Execution Time

@@ -155,42 +181,6 @@ system using the following code in one of your view file:

{memory_usage} - -

Auto Profiler

- -

When the "auto profiler" is enabled, you'll see a report printed at the bottom of your pages containing a list of -execution times for all benchmarks you have set throughout your application. This information can help you optimize your program.

- -

Note: Even though this is a feature of the Benchmark class you will enable it from the Output class as indicated below.

- -

To enable the profiler place the the following function anywhere within your Controllers:

-$this->output->enable_profiler(TRUE); - -

When enabled you'll see a table of execution times at the bottom of your pages.

- -

To disable the profiler you will use:

-$this->output->enable_profiler(FALSE); - -

Important: In order to use this feature all of your marked points must end with _start and _end, and -each pair of points must otherwise be named identically. Example:

- - -$this->benchmark->mark('my_mark_start');
-
-// Some code happens here...
-
-$this->benchmark->mark('my_mark_end'); -

- -$this->benchmark->mark('another_mark_start');
-
-// Some more code happens here...
-
-$this->benchmark->mark('another_mark_end'); - -
- - -- cgit v1.2.3-24-g4f1b