The sections below describe how you can measure the total time spent on methods in your applications (except for time spent on child methods):
General Approach
To get the time spent executing a method (excluding the time spent executing all of its child methods) in your application, do the following:
-
Profile your application using the Performance profiler with the Elapsed Time, User Time or User+Kernel Time counter and get profiling results.
-
Select the Routines category in the Explorer panel.
-
Find the desired routine in the Report panel.
-
Check the Time column. To see this as a percentage of the time spent on executing all of the profiled routines, check % Time.
To get more statistics on methods that called the one selected in the Report panel as well as on methods that were called by this one, refer to the Details panel.
Estimating Time in Unmanaged Applications
You can quickly estimate the time spent on executing methods by using the Sampling profiler. It works much faster than the Performance profiler, however, it collects less accurate data. To get the approximate time spent on executing a method, do the following:
-
Profile your unmanaged application using the Sampling profiler and get profiling results.
-
Select the Routines category in the Explorer panel and find the desired routine in the Report panel.
-
Sort out the results by the Time column and check its values to estimate what methods may need optimizing. This column displays approximate values. To get more detailed and accurate information, add problematic methods to the routine-level area and continue analyzing the application with the Performance profiler as described in the General Approach section above.
See Also
Performance Profiling
Best Practices and How to Tutorials
Measure the Total Time Spent Executing a Method (Including Child Methods)
Performance Profiler - Overview
Sampling Profiler - Overview