{"id":5464,"date":"2021-04-22T13:46:16","date_gmt":"2021-04-22T20:46:16","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/pix\/?p=5464"},"modified":"2021-04-22T14:41:13","modified_gmt":"2021-04-22T21:41:13","slug":"cpu-sampling-profiler-c-source-code-view","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/pix\/cpu-sampling-profiler-c-source-code-view\/","title":{"rendered":"New CPU Sampling Profiler C++ Source Code View"},"content":{"rendered":"<p>Starting with the <a href=\"https:\/\/devblogs.microsoft.com\/pix\/download\/\">2104.20 release of PIX on Windows<\/a>, the <a href=\"https:\/\/devblogs.microsoft.com\/pix\/analyzing-cpu-samples-in-timing-captures\/\">Sampling Profiler<\/a> that is built into <a href=\"https:\/\/devblogs.microsoft.com\/pix\/timing-captures-new\/\">Timing Captures<\/a> includes a C++ source code view. The source view uses coloring to attribute the collected CPU samples with source lines, thereby identifying the hot spots within a function.<\/p>\n<p>The source view is available when viewing <strong>Sampled Functions<\/strong> in the <strong>Range Details<\/strong> view.\u00a0 To view the annotated source for a function, select the function in the <strong>Range Details<\/strong> view and toggle the <strong>Element Details<\/strong> view from <strong>Details<\/strong> to <strong>Source Analysis<\/strong> as shown in the following figure.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5465\" src=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1.png\" alt=\"Image sampling profiler source view\" width=\"1430\" height=\"560\" srcset=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1.png 1430w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1-300x117.png 300w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1-1024x401.png 1024w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view-1-768x301.png 768w\" sizes=\"(max-width: 1430px) 100vw, 1430px\" \/><\/a><\/p>\n<p>The boldness of the highlight on a given source line is relative the percentage of samples that occurred while that line was executed. The bolder the line the more frequently that line was executed. By default, the source view shows sample frequency in terms of percentages. Use the <strong>Display Options<\/strong> panel on the view to switch the display to sample counts, if desired.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_counts.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5468\" src=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_counts.png\" alt=\"Image sampling profiler source view counts\" width=\"662\" height=\"558\" srcset=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_counts.png 662w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_counts-300x253.png 300w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><\/a><\/p>\n<p>The sampling profiler uses the source file paths stored in your title\u2019s PDBs to locate the matching source file. If that file can\u2019t be found, the source analysis view will contain text stating:<\/p>\n<p><em>Could not find \u201cfilename\u201d.cpp with a matching checksum<\/em><\/p>\n<p>Use the <strong>Source Paths<\/strong> control in either the <strong>Display Options<\/strong> panel or the main <strong>Settings<\/strong> page to specify one or more directories that PIX should search for source files if they can\u2019t be found at the default location.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5469\" src=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths.png\" alt=\"Image sampling profiler source view source paths\" width=\"1433\" height=\"630\" srcset=\"https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths.png 1433w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths-300x132.png 300w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths-1024x450.png 1024w, https:\/\/devblogs.microsoft.com\/pix\/wp-content\/uploads\/sites\/41\/2021\/04\/sampling_profiler_source_view_source_paths-768x338.png 768w\" sizes=\"(max-width: 1433px) 100vw, 1433px\" \/><\/a><\/p>\n<p>As always, use the Feedback button in the upper right corner of the PIX UI to reach us with questions or feedback.<\/p>\n<p>Steven.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Starting with the 2104.20 release of PIX on Windows, the Sampling Profiler that is built into Timing Captures includes a C++ source code view. The source view uses coloring to attribute the collected CPU samples with source lines, thereby identifying the hot spots within a function. The source view is available when viewing Sampled Functions [&hellip;]<\/p>\n","protected":false},"author":1915,"featured_media":5465,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5464","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pix"],"acf":[],"blog_post_summary":"<p>Starting with the 2104.20 release of PIX on Windows, the Sampling Profiler that is built into Timing Captures includes a C++ source code view. The source view uses coloring to attribute the collected CPU samples with source lines, thereby identifying the hot spots within a function. The source view is available when viewing Sampled Functions [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/posts\/5464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/users\/1915"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/comments?post=5464"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/posts\/5464\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/media\/5465"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/media?parent=5464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/categories?post=5464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/pix\/wp-json\/wp\/v2\/tags?post=5464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}