docs/wiki/Performance-Investigations.md
⚠️ This is an early draft / work-in-progress.
:memo: This page is intended to help investigate performance issues submitted through Developer Community, where performance data is only accessible to Microsoft employees working on the performance investigations. However, the practices apply to other applications and even to local investigations as long as developers are willing to record their own performance data using PerfView.
Cause: UI thread is not waiting for messages in the main message pump
devenv!WinMain)Intended outcome: Want to attribute the majority ("as much as reasonably possible") of the non-message pump time to an underlying cause, and for cases where "too much time is spent", file bugs to reduce the UI thread workload.
Common causes:
Long-running operations are typically asynchronous operations which produce a result over time, often providing a cancellable progress report as a natural part of the operation.
TODO
High CPU usage reports typically fall into one of two categories:
Sometimes a user feedback report contains enough detail to classify the report into one of these categories, but most of the time a guess must be made. The intended outcome depends on what the user meant by the report.
Intended outcome:
When investigating a performance scenario, be aware that many pitfalls exist. This section lists a few that are known and relatively frequently encountered.
Sometimes a performance trace is taken during a period of time in which the stated complaint is not actively a problem. For example, in extreme instances users have submitted performance traces of a completely idle Visual Studio instance that did not have any solution open, while reporting a problem related to typing performance with a large solution. While this case was easy to identify (Visual Studio was completely inactive and not hung), other cases can be quite difficult.
:bulb: If the conclusions drawn from the performance trace do not seem obviously related to the stated complaint, it may indicate a measurement window mismatch.
The performance measurement infrastructure (PerfView) uses a circular buffer which only keeps the most recent data up to some fixed size. Depending on the type and amount of activity on the system during measurement, it is possible for a performance trace to exceed the size limit, and only retain "more recent" information in the trace. The time supported for a trace widely varies by measurement conditions, so only loose guidance is provided in the recommended steps for measuring and reporting performance problems.
💡 If you open a view in PerfView and observe a lack of data for a substantial portion of the beginning of a measurement window (see the When column), the measurement may have hit the end of the buffer and discarded the oldest data. Note that the GC data and the Thread Time data are recorded separately, so the buffers will not discard the same duration of data.
Red flags that GC may be a problem:
clr!??WKS::gc_heap::gc1clr!WKS::GCHeap::WaitUntilGCCompleteGC problems are typically caused by one of the following: