During performance profiling, dotTrace collects call stack data and data about call timings. In other words, performance profiling allows you to see how much time is required to execute a particular method, how often it is called, and trace the method call path.
When to use performance profiling
Performance profiling is useful in the following cases:
Evaluation of overall application performance.
Finding application bottlenecks - slowest parts of the code.
Investigating performance issues in a particular method.
How performance data is collected
To collect performance data, dotTrace interrupts application execution and retrieves call stack data. It is obvious that results of such profiling will vary depending on how often the profiler collects data. If this is done rarely, you may miss a number of short calls (made between data collection). At the same time, due to low profiler overhead, call time values calculated by the profiler will be very accurate. On the contrary, if call stack data is collected too often (e.g., on each call entry and exit), you will get inaccurate time values (profiler overhead is huge) but pretty accurate data on a number of performed calls. To somehow solve this contradiction and allow you to balance between accurate time and calls number measurements, dotTrace offers three different performance profiling types. Learn more about the types in Profiling Types.
The next important question is how dotTrace should calculate call time values. Is it necessary to take into account time when a certain thread is not actually working? What time source to use?
To give you more flexibility, dotTrace offers a number of different time measurement methods. Learn more about them in Time Measurement Methods.