Find Methods That Take Up the Most or the Least Execution Time

Applies to AQTime 8.81, last modified on January 18, 2022

To find out execution of which methods in your managed and unmanaged applications takes up the most (or the least) time use the Performance profiler:

  1. Profile your application with the Performance profiler using the Elapsed Time, User Time or User+Kernel Time counter and get the results.

  2. Examine the Summary panel to find the top ten routines whose execution time was maximal during the profiler run. Routines with the maximal execution time are listed under the Worst performance (body only) and Worst Performance (with children) nodes.

  3. To analyze profiling results more thoroughly, select the Routines category in the Explorer panel and sort performance metrics in the Report panel.

    • If you are interested in the time taken up by the method’s own code (excluding child calls), sort the tests by the Time column.

    • If you are interested in the total method call time (entry to exit), sort results in the Report panel by the Time with Children column.

    • If you are interested in the individual time cost of each call, sort the results by the Average Time with Children or Average Time column.

    • To know the time of the first call to each profiled routine (the time spent on the first call to a routine can be significantly different from the time spent on subsequent calls), sort the profiling results by the First Time or First Time With Children column.

    Descending will place the most expensive methods on top, ascending will place the least expensive ones on top.

    Note: Both the total time code and time taken without children reflect the total time cost of a method in the application which depends on how often the method is called rather than how slow it runs.

To display only those functions that take the most time to execute their own code or their own code along with the code of all other functions they call, you can use the More than 3% (body only) or More than 3% (with children) result views. You can select any of these views from the Result Views drop-down list on the Standard toolbar or from the View > Result Views menu from the Result Views dialog. To call it, select AQTime > Result Views from Visual Studio’s main menu from the Result Views dialog. To call it, click the Result Views button in Embarcadero RAD Studio. Note that this button does not reside on any toolbar by default. However, you can add the button to any RAD Studio’s toolbar via the Toolbar Customization dialog. In this dialog, switch to the Commands page, select the View.AQTime category in the Categories list, drag the Result Views command from the Commands list and drop it on the needed toolbar. For more information, see Result Views.

See Also

Performance Profiling
Best Practices and How to Tutorials
Find What Source Code Lines Take Up the Most or the Least Execution Time
Performance Profiler
Sampling Profiler

Highlight search results