diff options
author | Andrew <browner12@gmail.com> | 2014-02-11 09:55:48 +0100 |
---|---|---|
committer | Andrew <browner12@gmail.com> | 2014-02-11 09:55:48 +0100 |
commit | b6d8b962e44202a74c9b9321a4a53f61a753fccf (patch) | |
tree | 2d3c533a55964a0d124f7cd6bb1d3d98c7b84056 /user_guide_src/source/libraries/benchmark.rst | |
parent | 41713aaa665189dd0a191c333c73c4a7b9f37c78 (diff) | |
parent | 29e12641a1bb952f493462db6757ae12c7da1f2c (diff) |
Merge branch 'develop' into patch-1
Conflicts:
system/libraries/Calendar.php
Diffstat (limited to 'user_guide_src/source/libraries/benchmark.rst')
-rw-r--r-- | user_guide_src/source/libraries/benchmark.rst | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/user_guide_src/source/libraries/benchmark.rst b/user_guide_src/source/libraries/benchmark.rst index 5b86142dd..ddbe04869 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,43 @@ 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 + :rtype: 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: Elapsed time + :rtype: 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: Memory usage info + :rtype: 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 |