From e26611f93bfb21f5e143cc91ce529f6db52cdd88 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 2 Oct 2006 21:59:12 +0000 Subject: --- user_guide/general/changelog.html | 1 + user_guide/libraries/benchmark.html | 54 ++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'user_guide') diff --git a/user_guide/general/changelog.html b/user_guide/general/changelog.html index 1cac05dca..df4d0f1b8 100644 --- a/user_guide/general/changelog.html +++ b/user_guide/general/changelog.html @@ -73,6 +73,7 @@ Change Log
  • Added relationship capability to the database active record class
  • Added Zip Encoding Library permitting files to be Zip compressed.
  • Added the ability to extend libraries and extend core classes, in addition to being able to replace them.
  • +
  • Added Auto Profiler to the Benchmark Class, enabling you to generate a report of execution times.
  • Added support for storing models within sub-folders.
  • Added Download Helper.
  • Added simple_query() function to the database classes
  • diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html index 7f3e28bf5..b8b0bfd32 100644 --- a/user_guide/libraries/benchmark.html +++ b/user_guide/libraries/benchmark.html @@ -73,7 +73,20 @@ two marked points to be calculated.

    invoked, and ended by the output class right before sending the final view to the browser, enabling a very accurate timing of the entire system execution to be shown.

    -

    Using the Benchmark

    + +

    Table of Contents

    + + + + + + +

    Using the Benchmark Class

    The Benchmark class can be used within your controllers, views, or your Models. The process for usage is this: @@ -111,6 +124,7 @@ echo $this->benchmark->elapsed_time('cat', 'bird');
    echo $this->benchmark->elapsed_time('dog', 'bird'); +

    Displaying Total Execution Time

    If you would like to display the total elapsed time from the moment Code Igniter starts to the moment the final output @@ -128,6 +142,7 @@ output is sent to the browser. It doesn't matter where you use the function cal

    Note: If you want to benchmark anything within your controller functions you must set your own start/end points.

    +

    Displaying Memory Consumption

    If your PHP installation is configured with --enable-memory-limit, you can display the amount of memory consumed by the entire @@ -140,6 +155,43 @@ 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