Code Profiler in Performance Monitoring Toolset

The new Performance Monitoring Toolset has an exciting feature called the Code Profiler. As the name suggests, the Code Profiler lets you profile your CFML templates until the lowest level of granularity. Once profiled, you will be able to see how much time a line of code took and the exact flow of code.

Code profiler

To profile a CFML template,

Step 1: Choose a server

Profiling can only be done on a single ColdFusion node at a time. Select the global filter to which the node you wish to profile belongs to. The drop-down list will be populated with a list of ColdFusion nodes for that global filter. From the drop-down list, the required ColdFusion node has to be selected.

Step 2: Choose a profiling mode

There are three different profiling modes that are provided:

  1. Server: Profiles all CFMs that are being served by the selected ColdFusion node
  1. Application: Profiles only the applications chosen by the user that are being served by the selected ColdFusion node
  1. URL: Profiles only the exact URLs provided by the user that are being served by the selected ColdFusion node.

Note: It is optional to enable memory profiling. It captures the different memory scopes like Application, Session, etc.

Step 3: Start profiling

Once profiling kicks off, one or more CFML templates on the CFML node are hit. All profiling information for a session are stored in the datastore and can be viewed later.

Step 4: View the results

Once profiling is stopped, the results of the profiling can be viewed. The results of past profiling actions can also be viewed for the same user. The results can also be exported and viewed in ColdFusion Builder. The results capture the different CFMs that have been hit with the average time taken for each one as well as the hit count. On selecting a particular URL, we are taken to the URL detail page in which you can compare multiple executions of the same URL.

Profiling results

You can also see a component called Code Flow. Code Flow provides a nested tree layout showing the actual flow of code a CFM follows based on the internal logic of your application. Apart from the flow, you also see the line number as well as how much time that particular sub-tree took to execute. This makes it easier to identify where the troublesome piece of code is. Since multiple executions of the same URL are also provided, it makes it easier for the user to compare and identify the areas of a bottleneck.

Leave a reply

Related