- Profiling type
Profiling type defines what profiling method will be used and how profiling data will be collected. The following table will help you to choose a profiling type better suitable for your case.
Profiling Method Profiling Type Description Use Case Performance Profiling
Detailed timing information about function calls. Learn more
Sampling Accurate time measurement, inaccurate measurement of number of calls. Recommended for most cases. Ideal when you look for performance issues in your app for the first time. Tracing* Accurate calls number measurement, time measurement may be inaccurate due to profiler overhead. When sampling data is not enough. For example, for analyzing algorithm complexity (when info about exact number of calls is more valuable than exact call time values). Line-by-line* Each line of code is measured, call time values are inaccurate due to huge profiler overhead.
To lower the overhead, you can profile only particular methods using filters.
For advanced use cases only. For example, when you already know what function causes issues and want to analyze each line of it. Timeline Profiling
Detailed temporal data about application threads and events. Learn more
Timeline Collects temporal data about thread states, application events, and other multi-threading data. Based on Event Tracing for Windows (ETW). Recommended for most cases. Especially, for analyzing multithreaded apps. Use it, for example, to determine the cause of UI freezes, excessive garbage collections, uneven workload distribution, insufficient I/O, and so on.
If checked, dotTrace will start collecting profiling data right after the launch. Otherwise, dotTrace will start collecting this information only after you manually turn it on in the Performance Controller window.
- Time measurement
This option defines how dotTrace must calculate calls time. For more details, refer to Time Measurement Methods.
Typically, this is a choice between whether dotTrace should calculate time when a thread is not working or should not. More specifically, there are four options:
Real time (performance counter)
Recommended. dotTrace calculates the overall real time passed between method entry and exit. This time does not depend on app threads states. Time is calculated using system performance counter.
Real time (CPU instruction)
dotTrace calculates the overall real time passed between method entry and exit. This time does not depend on app threads states. Time is calculated using the CPU register.
- Thread time
dotTrace calculates only the time when a certain thread is running. The time when the thread is waiting or sleeping is not included in calculation.
- Thread cycle time
dotTrace calculates only the time when a certain thread is running. The time when the thread is waiting or sleeping is not included in calculation. Time is calculated using the CPU register.
- Real time (performance counter)
If checked, dotTrace will disable JIT-inlining in order to get call stacks that closely resemble the structure of application's source code.
If checked, dotTrace will take into account time spent in profiler itself by taking more time samples.
Merge threads with equal names
If checked, dotTrace will group the performance information for all threads with the same name under a single thread node in Call Tree and Threads Tree views.
Use profiler API
Enables you to control profiling directly from the code of the profiled application. For example, to take a snapshot in the exact point of your code. Learn more about using the API in Controlling Profiling Process Through API.
Optimizing Line-by-Line Profiling with Filters
Line-by-line profiling may be effective in particular cases but it is always time-consuming. To somehow minimize the profiling overhead, you can define some rules. According to them, not all functions are profiled line by line but only those that are really interesting for further investigation.
So you can create and set a filter or filters that match only the functions you need.
To create a new filter:
- Click Advanced to see advanced profiling options.
- Click the Edit Filters button.
Click Add Filter in the Profiling Filters dialog.
For more information about the dialog, see Dialogs: Profiling Filters.
- In the Add Filter dialog, choose the type of filter rule:
- If you have chosen one of the first two options, specify an assembly, a class, and/or a method to be included or excluded from profiling. Code items are filtered independently on one another. For example, if you specify a method and leave asterisks (*) for assembly and class to exclude methods with the specified name from all assemblies and all classes.
- If you have chosen the last option, specify the name of the attribute that will be used to exclude symbols from profiling. Optionally, specify the assembly name where this attribute is declared.
- Click OK to finish adding the filter.
- In the Profiling Filters dialog, click Save to save and apply your modifications.
At any time you can modify the pattern defined for a filter and vary what filters to apply from session to session.