Code Timing

Another challenge in solving problems with ColdFusion code entails understanding how long some piece or section of code takes to execute. Fortunately, ColdFusion offers several tools to help identify code timing:

  • GetTickCount()

  • <cftrace>

  • <cftimer>

  • cfquery.executiontime

  • Result attribute

  • Server monitor profiling feature

One of the oldest ways to identify code timing is to use the getTickcount() function, which returns a number of milliseconds since a point in the past. This function can be used to compare the count of milliseconds at one point to the count at a later point.

However, it can be simpler to use a similar, built-in feature of the <cftrace> tag. When this tag executes, it displays the elapsed time since a previous <cftrace>

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.