{"id":993,"date":"2014-07-03T11:00:00","date_gmt":"2014-07-03T11:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2014\/07\/03\/view-source-in-the-cpu-usage-tool\/"},"modified":"2022-07-13T07:11:34","modified_gmt":"2022-07-13T15:11:34","slug":"view-source-in-the-cpu-usage-tool","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/view-source-in-the-cpu-usage-tool\/","title":{"rendered":"View Source in the CPU Usage tool"},"content":{"rendered":"<p>In Update 2 of Visual Studio 2013, we added the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2014\/02\/28\/new-cpu-usage-tool-in-the-performance-and-diagnostics-hub-in-visual-studio-2013.aspx\">CPU Usage tool<\/a> into the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2014\/02\/28\/new-cpu-usage-tool-in-the-performance-and-diagnostics-hub-in-visual-studio-2013.aspx\">Performance and Diagnostics hub<\/a> which allows you to see where the CPU is spending time executing your code. In <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=397827\">Update 3 of Visual Studio 2013<\/a>, we have made a small but important improvement to this tool: the ability to navigate from a function in the call tree to the source code where that function was defined.<\/p>\n<p>When you have found an interesting function to look at in the call tree, you can right-click on it and select \u201cView Source\u201d or select the line and press Ctrl+G:<\/p>\n<p><img decoding=\"async\" title=\"ContextMenu\" style=\"border-top: 0px;border-right: 0px;border-bottom: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;border-left: 0px;padding-right: 0px;margin-right: auto\" border=\"0\" alt=\"ContextMenu\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/07\/2388.ContextMenu_thumb_1B4AD2E3.png\" width=\"612\" height=\"146\" \/><\/p>\n<p>After you do that, the editor will open the corresponding source file with the cursor in the function that you selected:<\/p>\n<p><img decoding=\"async\" title=\"Editor\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto\" border=\"0\" alt=\"Editor\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/07\/7181.Editor_thumb_5B14B968.png\" width=\"578\" height=\"214\" \/><\/p>\n<p>This works for C#\/VB, C++, and JavaScript code, and saves you from having to search through your solution and manually navigate to the function (the exact line within the function can vary in Release mode due to optimizations).<\/p>\n<p>Sometimes clicking \u201cView Source\u201d will take you to the top of a file instead of a specific function. If this happens it usually means the selected function is code that was generated by the compiler or the runtime. The code was generated on behalf of a function in the file you were taken to, but we take you to the top of the file since there is no actual code to show you.<\/p>\n<p>The \u201cView Source\u201d option will be disabled if we could not find symbol files (PDBs) for the module or if the matching source file no longer exists at the path embedded in the PDBs. This is usually the case when looking at External Code. In the example below, I clicked \u201cFilter view\u201d and checked the \u201cShow External Code\u201d option, which reveals code in Newtonsoft\u2019s Json.NET library, but I cannot click \u201cView Source\u201d on functions in this library because I do not have the source code or the symbol files for this library on my machine.<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-top: 0px;border-right: 0px;border-bottom: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;border-left: 0px;padding-right: 0px;margin-right: auto\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/07\/6136.image_thumb_48CBF2A6.png\" width=\"619\" height=\"163\" \/><\/p>\n<p>It will also be disabled if the available PDBs don\u2019t have line-level information. For example, line-level information usually missing for managed code when profiling <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/6t9t5wcf(v=vs.110).aspx\">NGen modules<\/a> (indicated by the module name ending with .ni.dll) unless you <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2012\/12\/10\/creating-ngen-pdbs-for-profiling-reports.aspx\">manually generate NGen PDBs with line information<\/a>, and for framework code where the PDBs were retrieved from Microsoft\u2019s public symbol servers.<\/p>\n<p>If you try out this feature and have feedback for us, be sure to use <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/zzszcehe.aspx\">Send-a-Smile<\/a> or <a href=\"http:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio\/category\/68065-diagnostics\">UserVoice<\/a> for feature requests and let us know on the <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/vstudio\/en-US\/home?forum=vsdebug\">Forums<\/a> if you run into issues. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Update 2 of Visual Studio 2013, we added the CPU Usage tool into the Performance and Diagnostics hub which allows you to see where the CPU is spending time executing your code. In Update 3 of Visual Studio 2013, we have made a small but important improvement to this tool: the ability to navigate [&hellip;]<\/p>\n","protected":false},"author":83,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,225],"tags":[],"class_list":["post-993","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-git"],"acf":[],"blog_post_summary":"<p>In Update 2 of Visual Studio 2013, we added the CPU Usage tool into the Performance and Diagnostics hub which allows you to see where the CPU is spending time executing your code. In Update 3 of Visual Studio 2013, we have made a small but important improvement to this tool: the ability to navigate [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/83"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=993"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/993\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}