View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > GetTickCount PreviousNext

GetTickCount

Returns the current value of an internal millisecond timer.

A string representation of the system time, in milliseconds.

Date and time functions

GetTickCount()

This function is useful for timing CFML code segments or other page processing elements. The value of the counter has no meaning. To generate useful timing values, take the difference between the results of two GetTickCount calls.

<!--- Setup timing test --->
<cfset iterationCount = 1000>
<!--- Time an empty loop with this many iterations --->
<cfset tickBegin = GetTickCount()>
<cfloop Index = i From = 1 To = #iterationCount#></cfloop>
<cfset tickEnd = GetTickCount()>
<cfset loopTime = tickEnd - tickBegin>

<!--- Report --->
<cfoutput>Loop time (#iterationCount# iterations) was: #loopTime#
    milliseconds</cfoutput>

Contents > CFML Reference > ColdFusion Functions > GetTickCount PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


rvoosten said on Sep 5, 2003 at 3:06 AM :
This function used to return an integer (in CFMX 6.0) - now it returns bigger numbers.
halL said on Sep 5, 2003 at 7:14 AM :
In 6.1, in response to a bug (tick counts would be returned as negative numbers. due to integer overflow), the underlying return type was changed from integer to string, which can represent numbers greater than maxint and will get converted to a real number if necessary.
This change was made because gettickcount returns system time in milliseconds, which can exceed the maximum integer value.
No screen name said on Sep 26, 2004 at 7:47 PM :
My question regards to the GetTickCount function in Cold Fusion 5 and 6.1.

For the windows 2000 operating system, where is this internal millisecond timer? Is this a OS timer, hardware clock or Cold Fusion's own timer. What is the accuracy of this timer?

Dayang
TomGru said on Feb 8, 2005 at 12:57 AM :
<cfset TimeIN=GetTickCount()>

<!--- Page content --->

<cfset TimeOUT=GetTickCount()>
<cfset TimeShow=(TimeOUT-TimeIN)>

<cfoutput>Page processing Time:#TimeShow# ms.</cfoutput>

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funct110.htm