There can be lots of reasons that cause bottlenecks during the application execution. This topic gives you several examples of how to use the Performance profiler to find out what causes bottlenecks.
Suppose, you profiled your application with the Elapsed Time counter (for more information on the Performance profiler counters and application characteristics they measure, see Counters Overview) and found out that FuncA
was too slow. The following table gives a few examples of how to figure out what caused the bottleneck:
Reason | How to Check |
---|---|
FuncA called several child routines and the bottleneck exists in one of these child routines. |
Compare values of the Time and Time with Children columns in the Report panel. If Time With Children is much greater than Time, then the cause is in one of the child routines. In the Details panel you can easily find how much time each of the child routines contributed to the FuncA execution time. |
FuncA called functions from system libraries and the bottleneck exists in one of these functions. |
Profile your application with the User Time counter and then compare results of the two runs. |
FuncA worked with memory inefficiently. |
Profile your application with the CPU Cache Misses, Soft Memory Page Faults or Blocked Store Forwards Replays counters. High values in profiler results will give evidence that the algorithm for working with memory can be improved. |
Most of FuncA ’s execution time was spent on JIT compilation or garbage collection. |
The Performance profiler can time the JIT compilation and garbage collection. To check the time spent on them, view results of the <JIT compiler> and <Garbage collector> pseudo-routines in the Details panel (The Performance profiler includes these routines in results if the Profiler .NET runtime option is enabled). |
FuncA contains delayed-initialization code, so most of the time was spent executing the first call to FuncA . |
The Performance profiler displays profiling results for the first function call separately from the other routine results. To find the cause of the bottleneck, check the First Time and First Time With Children columns in the Report panel (These columns are available if you used the Elapsed Time, User Time or User+Kernel Time counter). |
See Also
Performance Profiling
Best Practices and How to Tutorials
Performance Profiler - Overview
Searching for Performance Bottlenecks Tutorial