CPU Usage Tool Improvements
With Visual Studio 2022, we have converted the CPU Usage tool in the Performance Profiler to the profiler’s new analysis engine. This new change provides the tool with better source resolution, incremental/cancelable symbol loading, a performance boost, and a new flame graph.
Note: This is only available in the Performance Profiler (Alt+F2) version of the tool, but we are still working on supporting it in the Diagnostic Tools. Give it a shot and see what insights you can find!
We have finally shipped our most requested feature, a flame graph, to visualize a call tree. This new view is in the CPU tool details tool window, above the source line highlighting view. Using the graph, you can get a visual overview of where time is being spent in your application and click on specific nodes to dig into them further. Stay tuned for a follow-up blog where I walk through a recent investigation I did with the tool to double the performance.
Show me the perf!
We have gotten a substantial perf boost with the new analysis engine. The CPU Usage tool’s big analysis task is building up its call tree model, which provides data to various views such as the flame graph, caller callee, and call tree. Building the call tree involves walking through all the stack data and building a tree from it, which can be affected by various settings like “Show external code,” “Symbol loading,” and “Show native code.” While not comprehensive, the table below shows the performance improvements in the default scenario of a .NET application with external and native code hidden.
|ASP.NET Scenarios App||Visual Studio 2019 Update 11||Visual Studio 2022 Update 2|
|Small trace (10K samples)||5.99s||8.64s (1.4x slower)|
|Medium trace (280K samples) – Video below||464.87s||39.57s (11x faster)|
|Large trace (725K samples)||1234.81s||159.02s (7x faster)|
For large traces the performance improvement is considerably faster! Don’t worry, we still have more ideas on how to make it even better and make up our losses on the smaller traces.
Lastly, with Visual Studio 2022 Update 2, we are rolling out a new “Auto Insights” feature that helps find common issues in a trace and gives a starting point for your investigation. Currently, there are only a few rules such as overzealous string concatenation, but we are working with the .NET team to add more rules and tips for how to resolve issues.
Come talk with us
If you want to speak with our engineering team on how we can improve this tool, please let us know in our survey.