{"id":250808,"date":"2024-09-30T03:00:37","date_gmt":"2024-09-30T10:00:37","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=250808"},"modified":"2024-09-29T20:43:32","modified_gmt":"2024-09-30T03:43:32","slug":"effortless-instrumentation-profiling-with-persistent-target-selection","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/effortless-instrumentation-profiling-with-persistent-target-selection\/","title":{"rendered":"Effortless Instrumentation profiling with Persistent Target Selection"},"content":{"rendered":"<p>Ever wished to assess your code&#8217;s performance without repeatedly choosing the target process or executable for each instrumentation profiling session? If so, you&#8217;re among many developers who find this task cumbersome and prone to errors, especially when profiling the same target repeatedly.<\/p>\n<p>We understand your frustration and have a solution: Visual Studio 2022 introduces a new feature that addresses this issue. The instrumentation tool now remembers your target selection across runs, providing a seamless experience and enhancing the continuity of your profiling sessions.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-250809 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image.jpeg\" alt=\"Image of a speedometer\" width=\"770\" height=\"433\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image.jpeg 1920w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image-300x169.jpeg 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image-1024x576.jpeg 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image-768x432.jpeg 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/decorative-image-1536x864.jpeg 1536w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/p>\n<p>With this improvement, you can maintain your specified target across multiple instrumentation runs, eliminating the need for repetitive selection tasks. This means you can focus more on analyzing the performance data and optimizing your code, rather than wasting time and effort on setting up the profiling session.<\/p>\n<h2>How does it work?<\/h2>\n<p>To use this feature, you need to have Visual Studio installed and the Performance Profiler (ALT+F2) enabled. Then, follow these simple steps:<\/p>\n<ol>\n<li>Launch the Performance Profiler and select <strong>Instrumentation <\/strong>as the profiling method.<\/li>\n<li>Click the <strong>Target <\/strong>button and choose the process or executable you want to profile.<\/li>\n<li>Click <strong>Start <\/strong>to begin the profiling session. Visual Studio will collect and display the performance data in the Diagnostic Tools window.<\/li>\n<li>When you&#8217;re done, click <strong>Stop <\/strong>to end the profiling session. Visual Studio will show you a summary of the results and allow you to drill down into the details.<\/li>\n<li>Click <strong>cancel <\/strong>in the dialog box to reset the persisted selection.<\/li>\n<\/ol>\n<p>If you want to run another instrumentation profiling session on the same target, you don&#8217;t need to select it again. Just click <strong>Start <\/strong>and Visual Studio will remember your last choice and use it as the default target. When you add a new method, class, or project, these new targets are automatically selected based on whether their parent was previously selected. This proactive approach ensures that no new additions are missed and helps maintain comprehensive profiling coverage.\nYou can still change the target if you want to, but you don&#8217;t have to.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-250810\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250808-2.png\" alt=\"Image showing items to instrument in Visual Studio\" width=\"955\" height=\"534\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250808-2.png 955w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250808-2-300x168.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2024\/09\/word-image-250808-2-768x429.png 768w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/p>\n<p>Enjoy the convenience and efficiency of persistent target selection!<\/p>\n<h2>Why should you use it?<\/h2>\n<p>This feature is designed to help you streamline your workflow and improve your productivity when using the instrumentation tool. By persisting the target selection between runs, you can:<\/p>\n<p><strong>Save time and avoid frustration<\/strong> by reducing the number of clicks and interactions needed to set up a profiling session.<\/p>\n<p><strong>Minimize the risk<\/strong> of selecting the wrong target or forgetting to select one, which could lead to inaccurate or missing performance data.<\/p>\n<p><strong>Maintain consistency<\/strong> and comparability of the performance data across multiple profiling sessions on the same target.<\/p>\n<p>Focus more on the performance <strong>analysis and optimization<\/strong> of your code, rather than the configuration and management of the profiling session.<\/p>\n<h2>Concluding thoughts<\/h2>\n<p>We hope you find this feature valuable for your development journey. Your feedback and suggestions are invaluable to us as we strive to enhance it further. Please share your thoughts through the <a href=\"https:\/\/developercommunity.visualstudio.com\/\">Visual Studio Developer Community<\/a> or the Report a Problem tool in Visual Studio.<\/p>\n<p>Thank you for choosing Visual Studio and for your continuous feedback that helps us make it better every day.<\/p>\n<p>Stay connected with the Visual Studio team by following us on <a href=\"https:\/\/twitter.com\/VS_Debugger\">Twitter @VS_Debugger<\/a>, <a href=\"https:\/\/twitter.com\/VisualStudio\">Twitter @VisualStudio<\/a>, <a href=\"https:\/\/www.youtube.com\/user\/VisualStudio\">YouTube<\/a>, and <a href=\"https:\/\/www.linkedin.com\/showcase\/microsoft-visual-studio\/\">LinkedIn.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever wished to assess your code&#8217;s performance without repeatedly choosing the target process or executable for each instrumentation profiling session? If so, you&#8217;re among many developers who find this task cumbersome and prone to errors, especially when profiling the same target repeatedly. We understand your frustration and have a solution: Visual Studio 2022 introduces a [&hellip;]<\/p>\n","protected":false},"author":26573,"featured_media":250809,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6962,6868,155],"tags":[6743,6803],"class_list":["post-250808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debug","category-performance","category-visual-studio","tag-profiling","tag-visual-studio-profiler"],"acf":[],"blog_post_summary":"<p>Ever wished to assess your code&#8217;s performance without repeatedly choosing the target process or executable for each instrumentation profiling session? If so, you&#8217;re among many developers who find this task cumbersome and prone to errors, especially when profiling the same target repeatedly. We understand your frustration and have a solution: Visual Studio 2022 introduces a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/250808","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\/26573"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=250808"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/250808\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/250809"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=250808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=250808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=250808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}