During timeline profiling, dotTrace records application events and writes data about how application state changed during the profiling session. These includes not only temporal call stack and thread state data but also temporal data about memory allocation, garbage collections, and I/O operations.
After the session is finished, profiling results can be analyzed in Timeline Viewer which displays recorded events on a timeline diagram.
Timeline profiling is based on Event Tracing for Windows (ETW).
When to use timeline profiling
Timeline profiling is useful in the following cases:
- Finding application bottlenecks.
- Identifying the cause of user interface freezes.
- Identifying excessive garbage collections and I/O operations.
- Determining issues in multithreaded applications like irregular work distribution, lock contention, serialized execution, and other.
Differences between timeline and performance profiling
In the majority of cases, both profiling methods are interchangeable. Both collect call stack data and allow determining performance bottlenecks.
The main benefit of the timeline profiling is that it allows you to see not only what calls were made by your application but also how these calls were distributed in time. This can be extremely helpful when analyzing behavior of multi-threaded applications where the chronological order of events does matter: for example, in determining sync delays, the cause of UI freezes, and so on.
Another benefit is that timeline profiling collects a wider range of data. In addition to call stack data, it records memory allocation, garbage collection, and I/O events.
So, what are the cons? First of all, unlike the Tracing performance profiling type, Timeline profiling is unable to determine the exact number of performed calls. Therefore, it could be hardly used to analyze algorithms complexity.
One more concern is that timeline profiling implies absolutely different data representation - it uses Timeline Viewer which is a set of filters and diagrams tailored to work with the event timeline. Thus, performance profiling and its Performance Viewer interface are better suited for the more straightforward "What is the slowest method?" scenarios.