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 and up.  Not supported on Adobe ColdFusion, etc.

cfstopwatch 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.


Fork me on GitHub