#readwise
# Profiling Types | dotTrace

## Metadata
- Author: [[jetbrains.com]]
- Full Title: Profiling Types | dotTrace
- URL: https://www.jetbrains.com/help/profiler/Profiling_Guidelines__Choosing_the_Right_Profiling_Mode.html
- See also: [[Profiling Types dotTrace-2]]
## Highlights
- dotTrace provides three different types of performance profiling: SamplingTracingLine-by-line The Profiling type is selected in Profiler Options when configuring a profiling session.
### Sampling
- All in all, this profiling method provides time data that helps reveal problem call stacks, but it fails to provide numbers of function calls. Still this method is the fastest and can be a solid first step to localize performance problems.
### Tracing
- Unlike sampling, **tracing revolves around a function, or more precisely, around function entry and exit. dotTrace receives notifications from CLR when a function is entered and then when it is left, even if it is left because of an exception. The time between these two notifications is considered as the execution time of the function.**
- On the whole, you always get the correct number of function calls, but the total function time may be inaccurate. Because tracing takes more time than sampling and may also slow down your application significantly, it is better to profile individual parts of an application or certain scenarios.
### Line-by-Line
- This method is similar to tracing, but here the target of investigation is a statement, not a function. In order to profile a function line by line, dotTrace requires PDB files. If you do not have the corresponding PDB files, the method works as tracing.dotTrace measures the time required to execute a statement and how many times it is executed. As you can likely imagine, this method is even slower than tracing because dotTrace performs time-counting work for each statement.Line-by-line is an effective method after you have narrowed the scope of investigation and want to focus on certain functions.
- MethodProsConsSamplingTime required to run an application under profiler does not change significantlySmall snapshotLow memory usageNumber of calls for a function is undefinedNot all call stacks and functions are capturedTracingAll call stacks and functions are captured, except inlined functionsNumber of calls is defined correctlyMore time required to run an application under profilerSnapshot may be quite largeDependencies between time distortions and number of function callsHigher memory usageLine-by-linePossibility to study function in detail, statement levelMore time required to run an application under profiler, compared to tracingSnapshot may be quite largeHigher memory usage compared to tracingPDB files are required
- SamplingTime required to run an application under profiler does not change significantlySmall snapshotLow memory usageNumber of calls for a function is undefinedNot all call stacks and functions are captured
- TracingAll call stacks and functions are captured, except inlined functionsNumber of calls is defined correctlyMore time required to run an application under profilerSnapshot may be quite largeDependencies between time distortions and number of function callsHigher memory usage