CFTIMER | |||
Description
Displays execution time for a specified section of CFML code. ColdFusion MX displays the timing information along with any output produced by the timed code.
|
|||
Category
Debugging tags | |||
Syntax<cftimer label= "text" type = "inline" or "outline" or "comment" or "debug" > CFML statement(s) </cftimer> |
|||
See also
cfdump, cftrace; Chapter 18, "Debugging and Troubleshooting Applications" in ColdFusion MX Developer's Guide |
|||
History
ColdFusion MX 7: Added this tag.
|
|||
Usage
Use this tag to determine how long it takes for a block of code to execute. You can nest cftimer tags. This tag is useful for debugging CFML code during application development. In production, you can leave cftimer tags in your code as long as you have disabled the debugging option in the ColdFusion MX Administrator. |
|||
Example... <!--- type="inline"> ---> <cftimer label="Query and Loop Time Inline" type="inline"> <cfquery name="empquery" datasource="cfdocexamples"> select * from Employees </cfquery> <cfloop query="empquery"> <cfoutput>#lastname#, #firstname#</cfoutput><br> </cfloop> </cftimer> <hr><br> <!--- type="outline" ---> <cftimer label="Query and CFOUTPUT Time with Outline" type="outline"> <cfquery name="coursequery" datasource="cfdocexamples"> select * from CourseList </cfquery> <table border="1" width="100%"> <cfoutput query="coursequery"> <tr> <td>#Course_ID#</td> <td>#CorName#</td> <td>#CorLevel#</td> </tr> </cfoutput> </table> </cftimer> <hr><br> <!--- type="comment" ---> <cftimer label="Query and CFOUTPUT Time in Comment" type="comment"> <cfquery name="parkquery" datasource="cfdocexamples"> select * from Parks </cfquery> <p>Select View > Source to see timing information</p> <table border="1" width="100%"> <cfoutput query="parkquery"> <tr> <td>#Parkname#</td> </tr> </cfoutput> </table> </cftimer> <hr><br> <!--- type="debug" ---> <cftimer label="Query and CFOUTPUT Time in Debug Output" type="debug"> <cfquery name="deptquery" datasource="cfdocexamples"> select * from Departments </cfquery> <p>Scroll down to CFTimer Times heading to see timing information</p> <table border="1" width="100%"> <cfoutput query="deptquery"> <tr> <td>#Dept_ID#</td> <td>#Dept_Name#</td> </tr> </cfoutput> </table> </cftimer> ... |
LABEL | |
Optional | |
Default value: "" ""
Label to display with timing information. |
TYPE | |
Optional | |
Default value: "debug"
|