The sections below describe how you can find the methods that are called the most or the least often:
General Approach
To determine what methods in your application are called the most or the least often, do the following:
-
Profile your application with the Performance profiler and get results.
-
In the Summary panel, expand the Routines with max Hit Count node. It displays the top ten routines that were actually called most often.
-
Select the Routines category in the Explorer panel.
-
In the Report panel, sort results by the Hit Count column in the descending order and check which methods are on top (most frequently called) and in the bottom (least frequently called).
To know what source code lines are executed most (or least) often, see Find Source Code Lines That are Called Most or Least Often.
To know what routines are potentially (rather than actually) called most or least often as coded in the source, use the Static Analysis profiler. See Find the Number of Potential Method Calls.
Quick Analysis of Unmanaged Applications
You can quickly determine what methods of your unmanaged applications take up the most or the least execution time by using the Sampling profiler. It works much faster than the Performance profiler, however, it collects less accurate data. To find the methods that tend to take up the most or the least time, do the following:
-
Profile your application with the Sampling profiler and get results.
-
Examine the Summary panel to find the top ten routines that take the maximum number of samples during profiling. The routines with the maximal execution time are listed under the Routine with maximum Samples node.
-
To analyze the profiling results more thoroughly, select the Routines category in the Explorer panel and sort the results by the Time column. Descending will place the most time-consuming methods on top, ascending will place the least time-consuming methods on top.
-
After you have pinpointed some methods, add them to the routine-level area and continue analyzing them with the Performance profiler.
See Also
Performance Profiling
Best Practices and How to Tutorials
Find Source Code Lines That are Called Most or Least Often
Find the Number of Potential Method Calls
Performance Profiler - Overview