From da671680202c030a3347ab77f4fe0ead23c8886a Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Sun, 21 Jul 2013 13:34:18 -0700 Subject: Updating Benchmark lib docs --- user_guide_src/source/libraries/benchmark.rst | 51 +++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'user_guide_src/source/libraries/benchmark.rst') 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 + +
+ +************************* Using the Benchmark Class -========================= +************************* The Benchmark class can be used within your :doc:`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 ` will + swap the real value for this variable. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 28c2c975b118016d07212ed8e7c22ff280309f82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 8 Feb 2014 04:27:48 +0200 Subject: [ci skip] Add return types to library docs --- user_guide_src/source/libraries/benchmark.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'user_guide_src/source/libraries/benchmark.rst') diff --git a/user_guide_src/source/libraries/benchmark.rst b/user_guide_src/source/libraries/benchmark.rst index 7a0313f43..ddbe04869 100644 --- a/user_guide_src/source/libraries/benchmark.rst +++ b/user_guide_src/source/libraries/benchmark.rst @@ -135,18 +135,18 @@ Class Reference .. method:: mark($name) - :param string $name: the name you wish to assign to your marker - :returns: void + :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: string + :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. @@ -158,7 +158,8 @@ Class Reference .. method:: memory_usage() - :returns: string + :returns: Memory usage info + :rtype: string Simply returns the ``{memory_usage}`` marker. -- cgit v1.2.3-24-g4f1b