Basic Usage

In a nutshell, this plugin allows you to set different “benchmark points” and then return the elapsed time between any two points.

How to Mark Points

To mark a point, simply call the plugin and give the point a name via the mark= parameter, like so:

{exp:ce_benchmark mark="the_first_point"}

How to Get the Elapsed Time

To get the elapsed time between two points, call the elapsed method of the plugin and pass in the first and second benchmark points via the mark1= and mark2= parameters respectively, like so:

{exp:ce_benchmark:elapsed mark1="the_first_point" mark2="another_point"}<p>'{mark1}' to '{mark2}': {time} seconds{/exp:ce_benchmark:elapsed}

Usage Examples

The below is a simple (and typical) usage example:

{!-- The below code marks the first point --}
{ exp:ce_benchmark mark="ce_image_start"}

{!-- Now we run the plugin we want to benchmark --}
{exp:ce_img:single src="/images/example/cow.jpg" max="100"}

{!-- Here we mark the second point --}
{exp:ce_benchmark mark="ce_image_end"}

{!-- Now that we have two benchmark points, we can get the time that elapsed between them --}
{exp:ce_benchmark:elapsed mark1="ce_image_start" mark2="ce_image_end"}'{mark1}' to '{mark2}': {time} seconds{/exp:ce_benchmark:elapsed}

The result of the elapsed method above would return something like:

'ce_image_start' to 'ce_image_end': 0.0026 seconds