<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Hazim Shafi's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/hshafi/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/hshafi/feed.xml</link>
    <description>Concurrency Visualizer: Parallel Performance Tools for Windows</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:23:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Case Study: Parallelism and Memory Usage, VS2010 Tools to the Rescue!</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/case-study-parallelism-and-memory-usage-vs2010-tools-to-the-rescue</link>
      <pubDate>Thu, 17 Jun 2010 11:07:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/06/17/case-study-parallelism-and-memory-usage-vs2010-tools-to-the-rescue/</guid>
      <description><![CDATA[I was approached recently by a request to help a Microsoft customer improve his application&rsquo;s...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;">I was approached recently by a request to help a Microsoft customer improve his application&rsquo;s performance.<span style="mso-spacerun: yes;">&nbsp; </span>He had a managed application that exhibited a fair amount of data level parallelism in a long-running for_each loop.<span style="mso-spacerun: yes;">&nbsp; </span>When that loop was parallelized using the </span></span><a href="https://msdn.microsoft.com/en-us/library/dd460720.aspx"><span style="color: #0000ff; font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">Parallel.ForEach()</span></span></span></a><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"> construct in TPL (Task Parallel Library) on a quad core system, our customer was not happy with the resulting performance improvement.<span style="mso-spacerun: yes;">&nbsp; </span>He expected linear speedup since there wasn&rsquo;t much sharing and synchronization in the implementation.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">Actually, what I just said was true after my friend Stephen Toub helped the customer resolve a race condition on a data structure.<span style="mso-spacerun: yes;">&nbsp; </span>The solution that was used was considerably better than using a lock.<span style="mso-spacerun: yes;">&nbsp; </span>It involved using a concurrent data structure also provided by TPL (a </span></span></span><a href="https://msdn.microsoft.com/en-us/library/dd381779.aspx"><span style="color: #0000ff; font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">ConcurrentBag</span></span></span></a><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">).<span style="mso-spacerun: yes;">&nbsp; </span>Our customer was using the Concurrency Visualizer, but needed our help to figure out how to use it to identify the root cause of his scalability problem.<span style="mso-spacerun: yes;">&nbsp; </span>So, we took a look at his trace together and within a couple of minutes, it was clear that we were dealing with a classic workstation GC overhead pattern.<span style="mso-spacerun: yes;">&nbsp;</span></span></span></span> </p>
<p class="MsoNormal"><o:p><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></o:p></p>
<p><o:p><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></o:p></p>
<p><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/12/58/6433.GC_Case_Study1v2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-58/6433.GC_5F00_Case_5F00_Study1v2.png" border="0" /></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">As you see in the above screenshot, when the garbage collector kicks in, all threads but one are blocked, as shown in the highlighted area above.<span style="mso-spacerun: yes;">&nbsp; </span>This pattern repeats itself multiple times in the parallel loop, indicating that garbage collection occurs often.<span style="mso-spacerun: yes;">&nbsp; </span>If you click on one of the red synchronization regions for the blocked threads, you will see a callstack (be sure to add the Microsoft Symbol Server to your symbols path under Tools-&gt;Options-&gt;Debugger-&gt;Symbols to get good symbols in the runtime) containing the following at the tail end (top of the callstack view):<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!CLREvent::Wait<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!WKS::gc_heap::wait_for_gc_done<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!WKS::gc_heap::try_allocate_more_space<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!WKS::gc_heap::allocate_more_space<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!WKS::GCHeap::Alloc<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">clr.dll!Alloc<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><o:p>&nbsp;</o:p>&nbsp;</span></span></p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">This indicates that the thread is waiting on GC to complete.<span style="mso-spacerun: yes;">&nbsp; </span>The only thread executing during the time will be running GC code (click on a green segment for a sample callstack).<span style="mso-spacerun: yes;">&nbsp; </span>One option to improve the performance of GC is to use the Server GC; an implementation that creates a heap per core and does not block all threads if a GC event is triggered.<span style="mso-spacerun: yes;">&nbsp; </span>This change resulted in a 40%+ improvement in performance exhibited by significantly less blocking during execution (see screenshot below showing that most of the time, many threads are executing on this quad core hyperthreaded system).<span style="mso-spacerun: yes;">&nbsp; </span>But, we still needed to get to the underlying root of excessive garbage collections. In case you&rsquo;re interested in how to switch to the server GC implementation in Visual Studio, here are the steps:<o:p></o:p></span></span></span> </p>
<p class="MsoListParagraphCxSpFirst"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore"><span style="font-family: Calibri; font-size: small;">1.</span><span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Create an application config file.<span style="mso-spacerun: yes">&nbsp; </span>This can be done by right clicking on the project file and selecting Add-&gt;New Item-&gt;General-&gt;Application Configuration File.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore"><span style="font-family: Calibri; font-size: small;">2.</span><span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Edit the config file to add the runtime option shown below.<span style="mso-spacerun: yes">&nbsp; </span>Beware, this is case-sensitive!<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&lt;?</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">xml</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"> </span><span style="FONT-FAMILY: Consolas; COLOR: red; FONT-SIZE: 9.5pt">version</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">=</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">"<span style="COLOR: blue">1.0</span>"<span style="COLOR: blue"> </span><span style="COLOR: red">encoding</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">utf-8</span>"<span style="COLOR: blue"> ?&gt;</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">configuration</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp; </span>&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">runtime</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">gcServer</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"> </span><span style="FONT-FAMILY: Consolas; COLOR: red; FONT-SIZE: 9.5pt">enabled</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">=</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">"<span style="COLOR: blue">true</span>"<span style="COLOR: blue">/&gt;</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp; </span>&lt;/</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">runtime</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&lt;/</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">configuration</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;<o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span>&nbsp;&nbsp;</p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/12/58/7026.GC_Case_Study2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-58/7026.GC_5F00_Case_5F00_Study2.png" border="0" /></span></span></span></p>
<p>&nbsp;<span style="font-family: Calibri;">Before explaining how we solved that mystery, let&rsquo;s consider an interesting reality about parallelism.<span style="mso-spacerun: yes;">&nbsp; </span>If you start out with a loop that creates temporary objects, even though that&rsquo;s bad if it can be avoided, the rate at which your program will create those objects is limited by the speed of that single thread.<span style="mso-spacerun: yes;">&nbsp; </span>Now imagine when you increase the number of threads running that code at a given point in time.<span style="mso-spacerun: yes;">&nbsp; </span>You&rsquo;ve just increased the rate at which objects are created and discarded!<span style="mso-spacerun: yes;">&nbsp; </span>So, excessive object creation issues get exacerbated and GC&rsquo;s happen more frequently, making even more important to do a good job with memory usage.<span style="mso-spacerun: yes;">&nbsp; </span>The more threads/cores thrown at the problem, the higher the rate of memory churn.&nbsp;</span>&nbsp;</p>
<p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></p>
<p class="MsoNormal"><span style="line-height: 115%; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/12/58/2656.GC_Case_Study3.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-58/2656.GC_5F00_Case_5F00_Study3.png" border="0" /></span></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">&nbsp;</span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">There&rsquo;s a nice profiling tool in VS2010 dedicated to analyzing CLR memory usage.<span style="mso-spacerun: yes;">&nbsp; </span>It&rsquo;s the &ldquo;.NET Memory Allocation (Sampling)&rdquo; option that you see in the Performance Wizard Window.<span style="mso-spacerun: yes;">&nbsp; </span>This tool samples object allocations in your application and reports many useful statistics.<span style="mso-spacerun: yes;">&nbsp; </span>The most important one in our investigation was a list of most frequently allocated objects.<span style="mso-spacerun: yes;">&nbsp; </span>Between that list and looking at the source code, we were able to identify an object type that we noticed was being frequently created inside the loop.<span style="mso-spacerun: yes;">&nbsp; </span>It turned out that the object was a pretty simple structure containing two doubles.<span style="mso-spacerun: yes;">&nbsp; </span>So, we decided that it&rsquo;s worth allocating two local doubles on the stack instead of creating temporary objects.<span style="mso-spacerun: yes;">&nbsp; </span>And, voila!<span style="mso-spacerun: yes;">&nbsp; </span>A very happy customer sent an email back a few hours later, reporting that his test scenario that was running at 1.1 seconds was now taking .25 seconds on a quad core (hyperthreaded) system.<span style="mso-spacerun: yes;">&nbsp; </span>See the screenshot of a profile of this run below.</span></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;"></span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">&nbsp;</span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;"><o:p></o:p></span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">&nbsp;</span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/12/58/8551.GC_Case_Study4.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-58/8551.GC_5F00_Case_5F00_Study4.png" border="0" /></span></span></p>
<p class="MsoNormal"><o:p><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></o:p></p>
<p class="MsoNormal"><o:p><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></o:p></p>
<p class="MsoNormal"><o:p><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></span></o:p></p>
<p>&nbsp;</p>
<p><o:p></o:p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p>&nbsp;</p>
</p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">I thought that I&rsquo;d share this with you not only because it&rsquo;s really cool to see a customer using our technologies successfully, but because there are some important lessons here:<o:p></o:p></span></span></span></p>
<p class="MsoListParagraphCxSpFirst"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-size: small;">1.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: small;">Poor memory usage can be exacerbated by parallelism.<o:p></o:p></span></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-size: small;">2.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: small;">Excessive garbage collections can ruin your application&rsquo;s performance.<o:p></o:p></span></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-size: small;">3.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: small;">For parallel applications, you might see benefit from using the Server GC.<o:p></o:p></span></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-size: small;">4.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: small;">The .NET Memory Allocation profiling tool can help you find the root cause of your excessive memory usage patterns.<o:p></o:p></span></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-size: small;">5.</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: small;">The Concurrency Visualizer was very effective at exposing the problem and helping us address it.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">I hope you found this helpful.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">-Hazim<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;"></span></span></p>
</p>
<p class="MsoNormal"><span style="font-family: Calibri;"><o:p></o:p></span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Come Join Us at the International Supercomputing Conference (ISC '10) in Hamburg</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/come-join-us-at-the-international-supercomputing-conference-isc-10-in-hamburg</link>
      <pubDate>Sun, 30 May 2010 03:24:33 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/05/30/come-join-us-at-the-international-supercomputing-conference-isc-10-in-hamburg/</guid>
      <description><![CDATA[Hi,
I hope that some of you can join us at the International Supercomputing Conference (ISC) at...]]></description>
      <content:encoded><![CDATA[<p>Hi,</p>
<p>I hope that some of you can join us at the International Supercomputing Conference (ISC) at Hamburg this week.&nbsp; Keith Yedlin and I will be giving a tutorial today about the Parallel Computing Platform team's technologies in Visual Studio 2010 (<a href="https://www.supercomp.de/isc10/Tutorials/Tutorial-Program/Parallel-Computing-for-the-Manycore-Paradigm-Shift-Principles-Practice" title="link">link</a>).&nbsp; As part of the tutorial, I will be giving a 75 minute talk and demo about the parallel debugging and profiling capabilities in the product, including the Concurrency Visualizer of course.&nbsp; We will have laptops for you to try out the product hands-on as well as short lab exercises.&nbsp; I hope to see some of you there!&nbsp; We will also have a booth on the show floor where you can stop by and get some hands-on demos and chat about your needs and experiences.</p>
<p>Take care!</p>
<p>-Hazim</p>]]></content:encoded>
    </item>
    <item>
      <title>MSDN Magazine Article on VS2010 with Concurrency Visualizer</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/msdn-magazine-article-on-vs2010-with-concurrency-visualizer</link>
      <pubDate>Thu, 08 Apr 2010 10:33:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/04/08/msdn-magazine-article-on-vs2010-with-concurrency-visualizer/</guid>
      <description><![CDATA[Hi,
The April issue of MSDN magazine is out, and we were happy to see an article entitled "Better...]]></description>
      <content:encoded><![CDATA[<P>Hi,</P>
<P>The April issue of MSDN magazine is out, and we were happy to see an article entitled "Better Coding with Visual Studio 2010" by Doug Turnure that also briefly covers the Concurrency Visualizer.&nbsp; I encourage you all to read it <A href="https://msdn.microsoft.com/en-us/magazine/ee336135.aspx" mce_href="https://msdn.microsoft.com/en-us/magazine/ee336135.aspx">here</A>&nbsp;because it contains other information about parallel programming and other cool features in VS2010.&nbsp; The April issue in general brings a lot of great information about features that have been developed by the Parallel Computing Platform team at Microsoft.&nbsp; It is always gratifying when other teams and individuals get excited about your technologies.</P>
<P>Enjoy.</P>
<P>-Hazim</P>]]></content:encoded>
    </item>
    <item>
      <title>Concurrency Visualizer Interactions with Hyper-V Systems</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/concurrency-visualizer-interactions-with-hyper-v-systems</link>
      <pubDate>Thu, 01 Apr 2010 16:01:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/04/01/concurrency-visualizer-interactions-with-hyper-v-systems/</guid>
      <description><![CDATA[Hi folks,
&nbsp;I'd like you all to be aware of an issue that can affect the quality or...]]></description>
      <content:encoded><![CDATA[<P>Hi folks,</P>
<P>&nbsp;I'd like you all to be aware of an issue that can affect the quality or functionality of the Concurrency Visualizer.&nbsp; Our tool relies heavily on gathering timestamps in order to correlate events across cores and threads.&nbsp; When running on a virtualized processor, depending on many variables, the fidelity of this information can be affected when running on a Hyper-V system.&nbsp; The Concurrency Visualizer can even fail when it detects inconsistent timing information.&nbsp; We are working on addressing this in future versions, but for now, <STRONG>we recommend that you do your performance analysis running on native operating systems</STRONG>.&nbsp; Some purists in the performance engineering community might even claim that doing performance analysis on a hyper-V is fundamentally wrong, just like doing performance analysis with a lot of interference on a system from external applications or sources.&nbsp; I'm not such a purist on the former because VM environments will continue to increase in popularity and we need a good solution; however, for now you should be warned against it.</P>
<P>We apologize for any inconvenience that this may cause you.&nbsp; If you have any experiences that you'd like to share in this regard, please don't hesitate to do so here.</P>
<P>&nbsp;Cheers,</P>
<P>-Hazim</P>]]></content:encoded>
    </item>
    <item>
      <title>March 2010 MSDN Magazine Article on the Concurrency Visualizer in VS2010</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/march-2010-msdn-magazine-article-on-the-concurrency-visualizer-in-vs2010</link>
      <pubDate>Tue, 02 Mar 2010 19:47:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/03/02/march-2010-msdn-magazine-article-on-the-concurrency-visualizer-in-vs2010/</guid>
      <description><![CDATA[Hi,
I've received many requests for a more in-depth article on the features of the Concurrency...]]></description>
      <content:encoded><![CDATA[<P>Hi,</P>
<P>I've received many requests for a more in-depth article on the features of the Concurrency Visualizer in VS2010.&nbsp; Well, I'm happy to report that I've come through with an article entitled "Performance Tuning with the Concurrency Visualizer in Visual Studio 2010" that appeared in the current (March 2010) issue of MSDN Magazine.&nbsp; The article and a screenshot of the tool even made it to the front&nbsp;cover.&nbsp; I highly recommend reading that article if you want to make the most out of this parallel performance analysis tool.&nbsp; The article may be viewed at <A href="https://msdn.microsoft.com/en-us/magazine/ee336027.aspx">https://msdn.microsoft.com/en-us/magazine/ee336027.aspx</A>.</P>
<P>Enjoy and feel free to ask your questions and give feedback here.</P>
<P>-Hazim</P>]]></content:encoded>
    </item>
    <item>
      <title>Concurrency Visualizer for MPI Applications and Gamefest 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/concurrency-visualizer-for-mpi-applications-and-gamefest-2010</link>
      <pubDate>Mon, 08 Feb 2010 11:02:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2010/02/08/concurrency-visualizer-for-mpi-applications-and-gamefest-2010/</guid>
      <description><![CDATA[Hi,
&nbsp;I've recently posted a short article on how you can use the Concurrency Visualizer to...]]></description>
      <content:encoded><![CDATA[<P>Hi,</P>
<P>&nbsp;I've recently posted a short article on how you can use the Concurrency Visualizer to understand the performance of MPI (Message Passing Interface) applications.&nbsp; You can find it at our <A href="https://blogs.msdn.com/visualizeparallel/archive/2010/02/01/xx.aspx" mce_href="https://blogs.msdn.com/visualizeparallel/archive/2010/02/01/xx.aspx">team's blog</A>.&nbsp; Also, this week I'm giving a talk at <A href="https://www.microsoftgamefest.com/" mce_href="https://www.microsoftgamefest.com">Gamefest 2010</A> entitled "Visualization Tools for Multicore Performance Analysis".&nbsp; Stop by and chat if you're attending.</P>
<P>&nbsp;-Hazim</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Concurrency Visualizer: Avoiding Interference During Profile Collection</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/concurrency-visualizer-avoiding-interference-during-profile-collection</link>
      <pubDate>Tue, 29 Dec 2009 10:43:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2009/12/29/concurrency-visualizer-avoiding-interference-during-profile-collection/</guid>
      <description><![CDATA[Those of you who are used to doing performance analysis can appreciate the value of reducing...]]></description>
      <content:encoded><![CDATA[<P>Those of you who are used to doing performance analysis can appreciate the value of reducing interference between your application and other applications and services running on the system under study.&nbsp; So far, I've been using the Visual Studio IDE to show you how you can collect and analyze a profile.&nbsp; Since Visual Studio itself can be a resource intensive application, it is sometimes desirable to collect a profile without the IDE's assistance.&nbsp; Further, it is sometimes desirable to collect a profile on a system that does not have Visual Studio installed.&nbsp; For these purposes, the Concurrency Visualizer comes with support in the Visual Studio profiler command-line tools.&nbsp; The command-line tools allow both launch and attach profile collection.&nbsp; Here's how you can accomplish this:</P>
<P><U>Lanunch Scenario:</U></P>
<P>1. Open a Visual Studio Command Prompt window as an Admininstrator (remember, ETW-based collection requires high privileges).&nbsp; The tool is usually found at Start-&gt;All Programs-&gt;Microsoft Visual Studio 2010-&gt;Visual Studio Tools-&gt;Visual Studio Command Prompt (2010).&nbsp; The console will have the appropriate paths set up for the tools that we'll be using.</P>
<P>2. Start profiling and launch the application of interest using the following command (I usually do this from the directory containing the program of interest):</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; vsperfcmd /start:CONCURRENCY,THREADONLY /launch:fullpathtoprogram.exe /output:profilefilename</P>
<P>3. Now the application should be launched and you can perform your test.&nbsp; When finished, if you terminated the application, you can just run the following command to complete the profile collection:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; vsperfcmd /shutdown</P>
<P>4. When the above command completes, you will find the profile file "profilefilename.vsp" in the current directory.&nbsp; All you need to do now is to open this .vsp file in Visual Studio (Ultimate or Premium) using the File-&gt;Open-&gt;File menu option.&nbsp; Just so that you know, there are two other files containing profile data: profilefilename.app.ctl and profilefilename.krn.ctl</P>
<P mce_keep="true"><U>Attach Scenario:</U></P>
<P mce_keep="true">1. Find the process id (PID) of the application that you're interest in.&nbsp; You can use Task Manager to do that by enabling the PID column in Processes tab using the View-&gt;Select Columns option.</P>
<P mce_keep="true">2. Attach to the process for analysis using the following command:</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp; vsperfcmd /start:CONCURRENCY,THREADONLY /attach:&lt;pid of the process&gt; /output:profilefilename </P>
<P mce_keep="true">3. When you're done profiling the usage pattern that you're interested in, run the following commands:</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp; vsperfcmd /detach</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp; vsperfcmd /shutdown</P>
<P mce_keep="true">4. When the above command completes, you will find the profile file "profilefilename.vsp" in the current directory.&nbsp; All you need to do now is to open this .vsp file in Visual Studio (Ultimate or Premium) using the File-&gt;Open-&gt;File menu option.</P>
<P mce_keep="true">If you'd like to collect on a system that does not have Visual Studio installed, you will need to install the Standalone Profiler tools.&nbsp; There's a directory on the Visual Studio DVD containing the installer for these tools.&nbsp; You will need to run this as an admin because it installs a driver.&nbsp; In addition, the command-line tools require .NET 4.</P>
<P mce_keep="true">That's all you need to collect profiles without the overhead of Visual Studio.&nbsp; Now go give these a try!</P>
<P mce_keep="true">-Hazim</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Concurrency Visualizer: Linking Visualizations to Application Phases</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/concurrency-visualizer-linking-visualizations-to-application-phases</link>
      <pubDate>Fri, 13 Nov 2009 08:13:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2009/11/13/concurrency-visualizer-linking-visualizations-to-application-phases/</guid>
      <description><![CDATA[In my PDC 2008 presentation, I showed how the Concurrency Visualizer in Visual Studio 2010 allows...]]></description>
      <content:encoded><![CDATA[<P>In my PDC 2008 presentation, I showed how the Concurrency Visualizer in Visual Studio 2010 allows users the option of instrumenting their code in order to link the visualizations with application constructs or phases of execution.&nbsp; The Concurrency Visualizer does not require any instrumentation to function, but for some complex application scenarios, it is often difficult to identify the regions of execution that are of interest to us.&nbsp; This is because a common performance investigation is usually focused on a certain "problem" that manifests itself during a portion of an application's execution.&nbsp; </P>
<P>For VS2010 Beta 2, we have released a simple API that can be used for this purpose.&nbsp; This API is called the Scenario and is available for download for free from <A href="https://code.msdn.microsoft.com/Scenario" mce_href="https://code.msdn.microsoft.com/Scenario">https://code.msdn.microsoft.com/Scenario</A>.&nbsp; There are both native and managed implementations of this API, depending on the application that you are dealing with.&nbsp; The Scenario API includes many features that may be of interest to the user, so I urge you to read the documentation to learn about it.&nbsp; For our purposes, the Scenario API encapsulates the work necessary to generate ETW events that are consumed by the Concurrency Visualizer.&nbsp; In order to use it, you need to instantiate a Scenario object, and then mark the phases that are important to you by invoking the Begin and End APIs.&nbsp; When you do so, the Concurrency Visualizer will mark these regions with vertical markers in the CPU Utilization view, or rectangular regions in the Threads and Cores views.&nbsp; Each Scenario has an associated string describing it and these strings are shown in tooltips in the views.&nbsp; In the CPU Utilization view, the strings are shown when you hover on the vertical markers.&nbsp; In the other views, they show up when you hover on the horizontal connectors of the Scenario rectangles.&nbsp; If you're interested in analyzing work that happens in one of these regions, you can just zoom in on it and then switch among the various view and examine reports or interact with the UI to get your work done.&nbsp; You can also use the measurement tool in the Threads view toolbar to measure the time it takes to execute the various phases/scenarios.&nbsp; Here's a simple example that you can use to try out this functionality in VS2010 Beta 2 after downloading the appropriate bits from the above website.&nbsp; </P>
<P mce_keep="true">#include "stdafx.h"<BR>#include "Scenario.h"</P>
<P mce_keep="true">int _tmain(int argc, _TCHAR* argv[])<BR>{<BR>&nbsp;double *testarray = (double *) malloc(100000000*sizeof(double));<BR>&nbsp;// Initialize the Scenario object that we will use to mark phases<BR>&nbsp;Scenario *myScenario = new Scenario(0, L"Scenario Example", (LONG) 0);<BR>&nbsp;// Mark the start of initialization phase<BR>&nbsp;myScenario-&gt;Begin(0, TEXT("Initialization"));</P>
<P mce_keep="true">&nbsp;// Initialization<BR>&nbsp;for (int i=0; i&lt;100000000; i++)<BR>&nbsp;&nbsp;testarray[i] = 0.0;</P>
<P mce_keep="true">&nbsp;// Mark end of initialization<BR>&nbsp;myScenario-&gt;End(0, TEXT("Initialization"));<BR>&nbsp;// Mark start of work phase<BR>&nbsp;myScenario-&gt;Begin(0, TEXT("Work Phase"));</P>
<P mce_keep="true">&nbsp;// Work<BR>&nbsp;srand(31);<BR>&nbsp;for (int i=0; i&lt;100000000; i++)<BR>&nbsp;&nbsp;testarray[i] = rand()/RAND_MAX * 10000.0;</P>
<P mce_keep="true">&nbsp;// Mark end of work phase<BR>&nbsp;myScenario-&gt;End(0, TEXT("Work Phase"));<BR>&nbsp;exit(0);<BR>}</P>
<P>When you&nbsp;profile this&nbsp;app, you'll notice rectangular regions such as the ones depicted below that correspond to each Scenario Begin/End pair in the application.&nbsp; If you hover the mouse on the horizontal bars, you'll get a tooltip containing the text string that you associated with the Scenario phases.&nbsp; You can now&nbsp;zoom in on a phase that interests you, make timing measurements with the measurement tool etc.&nbsp; The Cores view has a similar UI as shown, but the CPU Utilization view shows vertical bars for the begin and end markers instead of rectangular regions.&nbsp; Unfortunately, in Beta 2 the bars use a shade of grey that's hard to see.&nbsp; You can also hover on those vertical markers to get the Scenario text.&nbsp; </P>
<P>Now go give this a try!&nbsp;</P></SPAN>
<P mce_keep="true"><IMG style="WIDTH: 476px; HEIGHT: 234px" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/93/53/60/ScenarioMarkers.png" original-url="https://blogs.msdn.com/photos/hshafi/images/9935360/original.aspx" width=610 height=277 mce_src="https://blogs.msdn.com/photos/hshafi/images/9935360/original.aspx"></P>]]></content:encoded>
    </item>
    <item>
      <title>VS2010 Concurrency Visualizer: Parallel Performance Demystified!</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/vs2010-concurrency-visualizer-parallel-performance-demystified</link>
      <pubDate>Thu, 22 Oct 2009 10:54:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2009/10/22/vs2010-concurrency-visualizer-parallel-performance-demystified/</guid>
      <description><![CDATA[Hi,
In my previous post, I mentioned the "Demystify" feature of our tool that isn't quite working...]]></description>
      <content:encoded><![CDATA[<P>Hi,</P>
<P>In my previous post, I mentioned the "Demystify" feature of our tool that isn't quite working in the VS2010 Beta 2 release (Premium and Ultimate versions).&nbsp; Our team has now placed a web-based preview of this feature on our <A href="https://blogs.msdn.com/visualizeparallel/" mce_href="https://blogs.msdn.com/visualizeparallel/">Team Blog</A>.&nbsp; Demystify is a great way of learning about our tool's features and it will be in the final release.&nbsp; Give it a go and use it as a valuable resource while you're trying out our tool.&nbsp; Please keep an eye on both blogs for more information about our tool.</P>
<P>&nbsp;Enjoy!</P>
<P>&nbsp;-Hazim</P>]]></content:encoded>
    </item>
    <item>
      <title>VS2010 Beta 2 Concurrency Visualizer Parallel Performance Tool Improvements</title>
      <link>https://docs.microsoft.com/archive/blogs/hshafi/vs2010-beta-2-concurrency-visualizer-parallel-performance-tool-improvements</link>
      <pubDate>Sat, 17 Oct 2009 09:57:00 GMT</pubDate>
      <dc:creator><![CDATA[_HShafi_]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hshafi/2009/10/17/vs2010-beta-2-concurrency-visualizer-parallel-performance-tool-improvements/</guid>
      <description><![CDATA[Hi,
I'm very excited about&nbsp;the release of Visual Studio 2010 Beta 2&nbsp;that is going to be...]]></description>
      <content:encoded><![CDATA[<P>Hi,</P>
<P>I'm very excited about&nbsp;the release of <A title="Visual Studio 2010 Beta 2" href="https://go.microsoft.com/fwlink/?LinkID=151797" mce_href="https://go.microsoft.com/fwlink/?LinkID=151797">Visual Studio 2010 Beta 2</A>&nbsp;that is going to be available to MSDN subscribers today and to the general public on 10/21.&nbsp; This release includes significant improvements in many areas that I'm sure you'll love.&nbsp; But, as the Architect of the Concurrency&nbsp;Visualizer tool in the VS2010 profiler, I'm extremely thrilled to share with you the huge improvements in the user interface and usability of our tool.&nbsp; Our team has done an outstanding job in listening to feedback and&nbsp;making innovative enhancements that I'm sure will please you,&nbsp;our customers.&nbsp; Here is a brief overview of some of the improvements that we've made:</P>
<P mce_keep="true">Before we start, I'll remind you again that the tool that I'm describing here is the "visualize the behavior of a multithreaded application" option under the concurrency option in the Performance Wizard accessible through the Analyze Menu.&nbsp; I've described how the tool can be run in a previous post.&nbsp; Here's a screenshot of the performance wizard with the proper selection to use our tool:</P>
<P mce_keep="true"><IMG style="WIDTH: 384px; HEIGHT: 330px" title="Beta 2 Performance Wizard" alt="Beta 2 Performance Wizard" align=left src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/90/85/83/beta2perfwizard.PNG" original-url="https://blogs.msdn.com/photos/hshafi/images/9908583/original.aspx" width=384 height=330 mce_src="https://blogs.msdn.com/photos/hshafi/images/9908583/original.aspx"></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">Ok, now let's start going over the changes.&nbsp; First, we've slightly changed the names of the views for our tool.&nbsp; We now have "CPU Utilization", "Threads", and "Cores" views.&nbsp; These views can be accessed either through the profiler toolbar's <STRONG>Current View</STRONG> pull-down menu,&nbsp;through bitmap buttons at the top of the summary page, or through links in our views as you'll see in the top left of the next screenshot.</P>
<P mce_keep="true"><IMG style="WIDTH: 600px; HEIGHT: 450px" title=bets2threadsview alt=bets2threadsview src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/90/86/16/beta2threadsview.PNG" original-url="https://blogs.msdn.com/photos/hshafi/images/9908616/original.aspx" width=600 height=450 mce_src="https://blogs.msdn.com/photos/hshafi/images/9908616/original.aspx"></P>
<P mce_keep="true">You'll notice that the user interface has gone through some refinement since Beta 1 (see&nbsp;my earlier posts for a comparison)&nbsp;Let's go over the features quickly:</P>
<P mce_keep="true">1. We've added an active legend in the lower left.&nbsp; The active legend has multiple features.&nbsp; First, for every thread&nbsp;state category, you can click on the legend entry to get a callstack based report in the&nbsp;<STRONG>Profile Report</STRONG> tab&nbsp;summarizing where blocking events occured in your application.&nbsp; For the execution category, you get a sample profile that tells you what work your application performed.&nbsp; As usual, all of the reports are filtered by the time range that you're viewing and the threads that are enabled in the view.&nbsp; You can change this by zooming in or out and by disabling threads in the view to focus your attention on certain areas.&nbsp; The legend also provides a summary of where time was spent as percentages shown next to the categories.</P>
<P mce_keep="true">2. When you select an area in a thread's state, the "<STRONG>Current Stack</STRONG>" tab shows where your thread's execution stopped for blocking categories, or the nearest execution sample callstack within +/- 1ms of&nbsp;where you clicked for&nbsp;green segments.</P>
<P mce_keep="true">3.&nbsp;When you select a blocking category, we also try to draw a link (dark line shown in the screenshot) to the thread that resulted in unblocking your thread whenever we are able to make that determination.&nbsp; In addition, the <STRONG>Unblocking Stack</STRONG> tab shows you what the unblocking thread was doing by displaying its callstack when it unblocked your thread.&nbsp; This is a great mechanism to understand thread-to-thread dependencies.</P>
<P mce_keep="true">4. We've also improvement the <STRONG>File Operations</STRONG> summary report that is accessible from the active legend by also listing file operations performed by the System process.&nbsp; Some of those accesses are actually triggered on behalf of your application, so we list them but clearly mark them as System accesses.&nbsp; Some of those accesses may not be related to your application.</P>
<P mce_keep="true">5. The <STRONG>Per Thread Summary</STRONG> report is the same bar graph breakdown of where each thread's time was spent that used to show up by default in Beta 1, but can now be accessed from the active legend.&nbsp; This report is a guide that helps you understand improvements/regressions from one run to another and serves as a guide to help focus your attention on the threads and types of delay that are most important in your run.&nbsp; This is valuable for filtering threads/time and prioritizing your tuning effort.</P>
<P mce_keep="true">6. The profile reports now have two additional features.&nbsp; By default, we now filter out the callstacks that contribute &lt; 2% of blocking time (or samples for execution reports) to minimize noise.&nbsp; You can change the noise reduction percentage yourself.&nbsp; We also allow you to remove stack frames that are outside your application from the profile reports.&nbsp; This can be valuable in certain cases, but it is left off by default because blocking events usually do not occur in your code, so filtering that stuff out may not help you figure out what's going on.</P>
<P mce_keep="true">7. We added significant help content to the tool.&nbsp; You'll notice the <STRONG>Hints</STRONG> tab that was added and it includes instructions about features of the view as well as links to two important help items.&nbsp; One is a link to our <STRONG>Demystify</STRONG> feature, which is a graphical way to get contextual help.&nbsp; This is also accessible through the button on the top right hand side of the view.&nbsp; Unfortunately, the link isn't working in Beta 2, but we are working on hosting an equivalent web-based feature on the web to assist you and get feedback before the release is finalized.&nbsp; I'll communicate this information in a subsequent post.&nbsp; The other link is to a repository of graphical signatures for common performance problems.&nbsp; This can be an awesome way of building a community of users and leveraging the experiences of other users and our team to help you identify potential problems.&nbsp; </P>
<P mce_keep="true">8. The UI has been improved to preserve details when you zoom out by allowing multiple colors to reside within a thread execution region when the same pixel in the view corresponds to multiple thread states.&nbsp; This was the mechanism that we chose to always report the truth and give the users a hint that they need to zoom in to get more accurate information.</P>
<P mce_keep="true">The next screenshot shows you a significantly overhauled "Cores" view:</P>
<P mce_keep="true"><IMG style="WIDTH: 600px; HEIGHT: 450px" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/90/88/18/beta2coresview.PNG" original-url="https://blogs.msdn.com/photos/hshafi/images/9908818/original.aspx" width=600 height=450 mce_src="https://blogs.msdn.com/photos/hshafi/images/9908818/original.aspx"></P>
<P mce_keep="true">The Cores view has the same functionality;&nbsp;namely, understanding how your application threads were scheduled on the logical cores in your systems.&nbsp; The view leverages a new compression scheme to avoid loss of data when the view is zoomed out.&nbsp; It has a legend that was missing in Beta 1.&nbsp; It also has clearer statistics for each thread:&nbsp; the total number of context switches, the number of context switches resulting in core migration, and the percentage of total context switches resulting in migration.&nbsp; This can be very valuable when tuning&nbsp;to reduce context switches or&nbsp;cache/NUMA memory latency effects.&nbsp; In addition, the visualization can easily illustrate thread serialization on cores that may result from inappropriate use of thread affinity.&nbsp;</P>
<P mce_keep="true">This is just a short list of the improvements that we've made.&nbsp; I will be returning soon with another post about new Beta 2 features, so please visit again and don't be shy&nbsp;to give me your feedback and ask any questions that you may have.</P>
<P mce_keep="true">Cheers!</P>
<P mce_keep="true">-Hazim</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
  </channel>
</rss>