diff options
author | Derek Jones <derek.jones@ellislab.com> | 2013-07-21 22:34:18 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2013-07-21 22:34:18 +0200 |
commit | da671680202c030a3347ab77f4fe0ead23c8886a (patch) | |
tree | 8011cae88748d4feaec9ff9ac52ca4016ccc2433 | |
parent | 220358aed00110bdefdfbcfde40d820a2b684b8b (diff) |
Updating Benchmark lib docs
-rw-r--r-- | user_guide_src/source/libraries/benchmark.rst | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/user_guide_src/source/libraries/benchmark.rst b/user_guide_src/source/libraries/benchmark.rst index 5b86142dd..7a0313f43 100644 --- a/user_guide_src/source/libraries/benchmark.rst +++ b/user_guide_src/source/libraries/benchmark.rst @@ -13,10 +13,16 @@ 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. -.. contents:: Table of Contents +.. contents:: + :local: +.. raw:: html + + <div class="custom-index container"></div> + +************************* Using the Benchmark Class -========================= +************************* The Benchmark class can be used within your :doc:`controllers </general/controllers>`, @@ -68,7 +74,7 @@ _end. Each pair of points must otherwise be named identically. Example:: // Some code happens here... - $this->benchmark->mark('my_mark_end'); + $this->benchmark->mark('my_mark_end'); $this->benchmark->mark('another_mark_start'); @@ -120,3 +126,42 @@ this pseudo-variable, if you prefer not to use the pure PHP:: {memory_usage} + +*************** +Class Reference +*************** + +.. class:: CI_Benchmark + + .. method:: mark($name) + + :param string $name: the name you wish to assign to your marker + :returns: void + + Sets a benchmark marker. + + + .. method:: elapsed_time([$point1 = ''[, $point2 = ''[, $decimals = 4]]]) + + :param string $point1: a particular marked point + :param string $point2: a particular marked point + :param int $decimals: number of decimal places for precision + :returns: string + + Calculates and returns the time difference between two marked points. + + If the first parameter is empty this function instead returns the + ``{elapsed_time}`` pseudo-variable. This permits the full system + execution time to be shown in a template. The output class will + swap the real value for this variable. + + + .. method:: memory_usage() + + :returns: string + + Simply returns the ``{memory_usage}`` marker. + + This permits it to be put it anywhere in a template without the memory + being calculated until the end. The :doc:`Output Class <output>` will + swap the real value for this variable.
\ No newline at end of file |