Name

GetTickCount

Synopsis

GetTickCount(  )

Returns a counter in milliseconds. GetTickCount( ) is useful for reporting the amount of time it takes to process specific parts of CFML code. The following example counts the time (in milliseconds) it takes to process a loop with 10,000 iterations:

<CFSET Start = GetTickCount(  )>

<CFOUTPUT><B>Start TickCount:</B> #Start#</CFOUTPUT>

<P>Looping from 1 to 10000

<CFSET Timer="0">
<CFLOOP INDEX="counter" FROM="1" TO="10000">
  <CFSET Timer=Timer+1>
</CFLOOP>
<CFSET End = GetTickCount(  )>

<P>
<CFOUTPUT><B>End TickCount:</B> #End#</CFOUTPUT>

<CFSET TotalTime = (Evaluate(End - Start))>
<P>
<CFOUTPUT><B>Total processing time:</B> #TotalTime# milliseconds</CFOUTPUT>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.