cfstopwatch

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

  <cfstopwatch variable="time" label="timer"></cfstopwatch>

 cfstopwatch( variable="time" label="timer" ) {}

This tag requires Lucee.  Not supported on Adobe ColdFusion, etc.

Attribute Reference

variable string
Required

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

label string

The label for the stopwatch, used in debugging output.

Examples
Sample code using the cfstopwatch tag

<cfstopwatch variable="stopwatchVar" label="Nap time">
Begin some long running process ...
<cfset sleep(2000)>
done.
</cfstopwatch><cfdump var="stopwatchVar">

Expected Result: The time elapsed while executing the code inside the <cfstopwatch> block is returned as a variable then displayed below.

cfstopwatch( variable="stopwatchVar", label = "Nap time" ){
writeoutput("Begin some long running process ... ");
sleep(2000);
}
writeDump( stopwatchVar );

Expected Result: The time elapsed while executing the code inside the <cfstopwatch> block is returned as a variable then displayed below.

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub