<cfstopwatch>

Measures the time taken, in milliseconds, for the code between the start tag and end tag to execute.

Usage

<cfstopwatch
    [variable=string]
    [label=string]
><!--- body ---></cfstopwatch>

This tag must have a body.

This tag is also supported within cfscript

Attributes

Attribute Description
variable
(string, optional)

The name of the variable which will contain the value of the time taken.

label
(string, optional)

The label for the stopwatch, used in debugging output.

Examples

Tags

<cfstopwatch variable="stopwatchVar">
    <cfset i = 0>
    <cfloop from="1" to="10000" index="j">
        <cfset i++>
    </cfloop>
</cfstopwatch>

<cfdump var="#stopwatchVar#">

Script

stopwatch variable="stopwatchVar" {
    i = 0;
    loop from="1" to="10000" index="j" {
        i++;
    }
}
dump(stopwatchVar);