{"id":237403,"date":"2022-04-05T12:21:56","date_gmt":"2022-04-05T19:21:56","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=237403"},"modified":"2022-04-06T11:44:58","modified_gmt":"2022-04-06T18:44:58","slug":"cpu-usage-tool-improvements","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/cpu-usage-tool-improvements\/","title":{"rendered":"CPU Usage Tool Improvements"},"content":{"rendered":"<p>With Visual Studio 2022, we have converted the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/profiling\/cpu-usage?view=vs-2022\">CPU Usage tool<\/a> in the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/profiling\/?view=vs-2022\">Performance Profiler<\/a> to the profiler\u2019s 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.<\/p>\n<p>Note: This is only available in the Performance Profiler (<strong>Alt+F2<\/strong>) 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!<\/p>\n<h2>Flame Graph<\/h2>\n<p>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.<a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/FlameChart.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-237408\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/FlameChart.png\" alt=\"CPU Usage Tool Flame Chart\" width=\"780\" height=\"475\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/FlameChart.png 780w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/FlameChart-300x183.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/FlameChart-768x468.png 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><\/p>\n<h2>Show me the perf!<\/h2>\n<p>We have gotten a <strong>substantial <\/strong>perf boost with the new analysis engine. The CPU Usage tool&#8217;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 \u201cShow external code,\u201d \u201cSymbol loading,\u201d and \u201cShow native code.\u201d While not comprehensive, the table below shows the performance improvements in the default scenario of a .NET application with external and native code hidden.<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%;\">ASP.NET Scenarios App<\/td>\n<td style=\"width: 33.3333%;\">Visual Studio 2019 Update 11<\/td>\n<td style=\"width: 33.3333%;\">Visual Studio 2022 Update 2<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Small trace (10K samples)<\/td>\n<td style=\"width: 33.3333%;\">5.99s<\/td>\n<td style=\"width: 33.3333%;\">8.64s (1.4x slower)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Medium trace (280K samples) \u2013 Video below<\/td>\n<td style=\"width: 33.3333%;\">464.87s<\/td>\n<td style=\"width: 33.3333%;\">39.57s <strong>(11x faster)<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Large trace (725K samples)<\/td>\n<td style=\"width: 33.3333%;\">1234.81s<\/td>\n<td style=\"width: 33.3333%;\">159.02s <strong>(7x faster)<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><figure id=\"attachment_237406\" aria-labelledby=\"figcaption_attachment_237406\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/Merged.gif\"><img decoding=\"async\" class=\"size-full wp-image-237406\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/Merged.gif\" alt=\"Performance comparison of CPU Usage tool in 16.11 vs 17.2\" width=\"2052\" height=\"768\" \/><\/a><figcaption id=\"figcaption_attachment_237406\" class=\"wp-caption-text\">Performance comparison of CPU Usage tool file loading in 16.11 vs 17.2<\/figcaption><\/figure><\/p>\n<p>For large traces the performance improvement is considerably faster! Don\u2019t worry, we still have more ideas on how to make it even better and make up our losses on the smaller traces.<\/p>\n<h2>Auto Insights<\/h2>\n<p>Lastly, with Visual Studio 2022 Update 2, we are rolling out a new \u201cAuto Insights\u201d 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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/AutoInsights.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-237410\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/AutoInsights.png\" alt=\"CPU Usage Tool AutoInsights Feature\" width=\"547\" height=\"303\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/AutoInsights.png 547w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/03\/AutoInsights-300x166.png 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/a><\/p>\n<h2>Come talk with us<\/h2>\n<p>If you want to speak with our engineering team on how we can improve this tool, please let us know in our survey.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/www.surveymonkey.com\/r\/cpu-usage-blog\" target=\"_blank\">Survey<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>With Visual Studio 2022, we have converted the CPU Usage tool in the Performance Profiler to the profiler\u2019s 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.<\/p>\n","protected":false},"author":54885,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[],"class_list":["post-237403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio"],"acf":[],"blog_post_summary":"<p>With Visual Studio 2022, we have converted the CPU Usage tool in the Performance Profiler to the profiler\u2019s 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.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/237403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/54885"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=237403"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/237403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=237403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=237403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=237403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}