<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Visual Studio Profiler Team Blog</title><link>http://blogs.msdn.com/b/profiler/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>The Visual Studio Profiler on Windows 8</title><link>http://blogs.msdn.com/b/profiler/archive/2012/12/10/the-visual-studio-profiler-on-windows-8.aspx</link><pubDate>Mon, 10 Dec 2012 17:39:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10376119</guid><dc:creator>Andrew B Hall - MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10376119</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2012/12/10/the-visual-studio-profiler-on-windows-8.aspx#comments</comments><description>&lt;p&gt;Windows 8 brought a lot of great changes to Windows including a stronger security model and new capabilities for performance tools. I am excited about how the new capabilities allow us to deliver new performance tooling not previously possible, e.g. the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/jj819177.aspx"&gt;JavaScript Memory Analyzer for Windows Store apps&lt;/a&gt;. However because of the stronger security model there was also some impact to the existing profiling tools on Windows 8. In this post I will discuss the change to Windows that required us to redesign the way the Visual Studio Profiler works and the resulting impact to profiling features on Windows 8. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;Note: The changes discussed in this post are only applicable when running Visual Studio on Windows 8, there are no changes to functionality on Windows 7.&lt;/i&gt;&lt;/p&gt;  &lt;h4&gt;Background&lt;/h4&gt;  &lt;p&gt;In order to understand why profiling functionality is different on Windows 8, I need to start with a brief overview of the profiler’s implementation. Once you understand how the profiler was implemented in Visual Studio 2010, the behavior differences on Windows 8 should make more sense.&lt;/p&gt;  &lt;p&gt;All versions of Visual Studio through 2010 rely on a kernel mode driver to collect data. The driver was originally developed for CPU sampling so it can register for a callback based on CPU clock cycles (the default is 10 million cycles) in order to sample at a regular interval. Data collection for &lt;a href="http://msdn.microsoft.com/en-us/library/dd264966.aspx"&gt;.NET Memory Allocation&lt;/a&gt;, and &lt;a href="http://blogs.msdn.com/b/profiler/archive/2010/04/23/resource-contention-concurrency-profiling-in-visual-studio-2010-performance-investigation-flows.aspx"&gt;Concurrency profiling&lt;/a&gt; were then also integrated into the driver. &lt;a href="http://msdn.microsoft.com/en-us/library/ms182369.aspx"&gt;Instrumentation profiling&lt;/a&gt; is a bit different because it does not rely on the driver for the instrumentation data, but it does use the driver to calculate &lt;a href="http://blogs.msdn.com/b/profiler/archive/2004/08/04/208286.aspx"&gt;application time&lt;/a&gt; (you’ll see why this is relevant below).&lt;/p&gt;  &lt;h4&gt;The changes&lt;/h4&gt;  &lt;p&gt;The profiling driver was registering for the callback in a way that interfered with a Windows kernel operation; and Windows 8 added a security feature that detects when non-operating system code registers for a callback in this. When this condition is detected, Windows does a &lt;a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff547224(v=vs.85).aspx"&gt;bug check&lt;/a&gt; that results in a blue screen since the operating system can no longer trust the integrity of the kernel. However the supported way to register for the CPU cycle callback does not allow the callback handler to inspect information about user processes due to security concerns.&lt;/p&gt;  &lt;p&gt;Since the driver was now at odds with the enhanced security model we needed to move away from the driver to the new capabilities of Windows added since the driver was first created for Visual Studio 2005.&lt;/p&gt;  &lt;h4&gt;Impact on Visual Studio 2010 and prior versions&lt;/h4&gt;  &lt;p&gt;Unfortunately, given the need to rewrite the collection and analysis components we were not able to release an update to Visual Studio 2010 to fix the issue. Since customers don’t want to blue screen their operating system, Windows 8 added logic to prevent all incompatible versions of the profiling driver from starting (2010, 2008, and 2005).&lt;/p&gt;  &lt;p&gt;This means that when you try to start profiling with an incompatible version you will receive the message “&lt;i&gt;Error VSP1398: The monitor was unable to start the VS performance driver. Access is denied. Consider using the /Admin:Driver,Start and /Admin:Security options of VSPerfCmd from an elevated environment.&lt;/i&gt;”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/0250.image_5F00_16BF06DE.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/8272.image_5F00_thumb_5F00_7AAE47F2.png" width="868" height="152" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Which will result in the following behavior when running Visual Studio 2010 (or earlier) on Windows 8.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;CPU Sampling, .NET Memory Allocation, and Concurrency profiling will fail to start on Windows 8. The only workaround on Windows 8 is to use Visual Studio 2012 Professional or higher, or to profile on Windows 7.&lt;/li&gt;    &lt;li&gt;Instrumentation profiling can be launched, but the &lt;a href="http://blogs.msdn.com/b/profiler/archive/2004/08/04/208286.aspx"&gt;application and elapsed times&lt;/a&gt; will be exactly the same (this should have little impact on your ability to analyze the report, just note the elapsed time on the title bar of the summary page may not match the length of your profiling trace).&lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Impact on Visual Studio 2012&lt;/h4&gt;  &lt;p&gt;In Visual Studio 2012, we had to stop using the now incompatible driver for CPU sampling and instead use &lt;a href="http://blogs.msdn.com/b/ntdebugging/archive/2009/08/27/etw-introduction-and-overview.aspx"&gt;ETW (Event Tracing for Windows)&lt;/a&gt;. However the move to ETW required a complete rewrite of the collection and analysis components for sampling, which unfortunately due to resource constraints meant we did not have time to add all of the existing sampling functionality to the new implementation. This has the following impact when profiling on Windows 8:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/habibh/archive/2009/06/30/walkthrough-using-the-tier-interaction-profiler-in-visual-studio-team-system-2010.aspx"&gt;Tier Interaction Profiling (TIP) data&lt;/a&gt; cannot be collected in conjunction with CPU sampling data (this continues to work with instrumentation profiling, and on Windows 7).&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/profiler/archive/2010/06/22/cpu-performance-counters-in-visual-studio-2010-profiler.aspx"&gt;The “Sampling” performance session properties&lt;/a&gt; cannot be configured, instead you will see the message “These settings are not supported for CPU sampling on this version of Windows” on the property page. It is important to note that CPU sampling works as expected with the default settings, it just does not allow for changing the advanced settings. The workaround to be able to use the advanced settings is to profile on Windows 7.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/subscriptions/bb763113(v=vs.90).aspx"&gt;Windows performance counters&lt;/a&gt; cannot be collected while CPU sampling. The workaround is to use Windows 7 if you need to collect this information while sampling.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/6138.image_5F00_366DE0A6.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/7608.image_5F00_thumb_5F00_1652D3E9.png" width="686" height="552" /&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;CPU samples for all functions executing inside NGEN’d modules will appear in the report as [NI module name], instead of the actual function name showing due to the way ETW reports the data (to resolve this &lt;a href="http://blogs.msdn.com/b/visualstudioalm/archive/2012/12/10/creating-ngen-pdbs-for-profiling-reports.aspx"&gt;see my blog post on Creating NGEN PDBs for Profiling Reports&lt;/a&gt;).&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms182403.aspx"&gt;vsperfcmd.exe&lt;/a&gt; cannot be used to collect CPU sampling data from the command line and will fail with either the error code “&lt;i&gt;VSP1535” or “VSP1336” and the message “To collect sampling data on this version of Windows, use vsperf.exe&lt;/i&gt;”). The correct way to collect CPU sampling data from the command line is to use &lt;a href="http://msdn.microsoft.com/en-us/library/hh977161.aspx"&gt;vsperf.exe&lt;/a&gt; instead.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Hope this information is useful to some of you and please let me know if you have any questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10376119" width="1" height="1"&gt;</description></item><item><title>VS2010: Just My Code</title><link>http://blogs.msdn.com/b/profiler/archive/2011/05/13/vs2010-just-my-code.aspx</link><pubDate>Fri, 13 May 2011 16:46:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10164281</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10164281</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2011/05/13/vs2010-just-my-code.aspx#comments</comments><description>&lt;p&gt;The ‘Just My Code’ feature in the profiler has a few differences to the ‘Just My Code’ feature in the debugger so this post should provide a useful introduction.&lt;/p&gt;  &lt;h2&gt;Example Program&lt;/h2&gt;  &lt;p&gt;Here’s a very simple program I’ll use in this post.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="400"&gt;         &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; ConsoleApplication1
{
    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program
    {
        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
        {
            Foo();
        }

        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Foo()
        {
            &lt;span class="kwrd"&gt;double&lt;/span&gt; d = 0;
            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 100000000; ++i)
            {
                d += Math.Sqrt(i);
            }
            Console.WriteLine(d);
        }
    }
}&lt;/pre&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Why ‘Just My Code’?&lt;/h2&gt;

&lt;p&gt;Typically when profiling you are most interested in optimizing code that you either wrote or you have control over. Sure, sometimes there will be issues in the frameworks that you are using or in other binaries, but even then you often control the calls into those frameworks.&amp;#160; Just My Code or JMC is intended to filter the data that is displayed in profiler reports so that more of the code you control shows up in the reports and the reports are more manageable.&lt;/p&gt;

&lt;p&gt;For example, the Call Tree after collecting sampling data for the simple program above, with JMC off, is shown below: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/8182.jmc_5F00_off_5F00_calltree_5F00_1_5F00_7AF191AC.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jmc_off_calltree_1" border="0" alt="jmc_off_calltree_1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/4885.jmc_5F00_off_5F00_calltree_5F00_1_5F00_thumb_5F00_6CB318BC.png" width="640" height="328" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the default JMC options, this reduces down to: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/7522.jmc_5F00_on_5F00_calltree_5F00_1_5F00_2C7CFF42.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jmc_on_calltree_1" border="0" alt="jmc_on_calltree_1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/0268.jmc_5F00_on_5F00_calltree_5F00_1_5F00_thumb_5F00_534B1582.png" width="640" height="96" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What is ‘My Code’?&lt;/h2&gt;

&lt;p&gt;There are two conditions for code being considered ‘My Code’ by the profiler and they are both at the Module level (Module Name column in the screenshots above). In the example above, this means the checks are made against the clr.dll, mscoreee.dll, mscoreei.dll and ConsoleApplication1.exe binaries. &lt;/p&gt;

&lt;p&gt;Modules considered ‘My Code’:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;the copyright string for the module does not contain ‘Microsoft’, OR: &lt;/li&gt;

  &lt;li&gt;the module name is the same as the module name generated by building any project in the currently open Solution in Visual Studio. 
    &lt;br /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;How do I turn JMC on or off?&lt;/h2&gt;

&lt;p&gt;You can temporarily toggle JMC on or off on the profiler Summary Page in the Notifications area using ‘Show All Code’ or ‘Hide All Code’ (shown in red below): 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/4382.jmc_5F00_on1_5F00_7A192BC2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jmc_on1" border="0" alt="jmc_on1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/3326.jmc_5F00_on1_5F00_thumb_5F00_24F18FD5.png" width="640" height="391" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The default setting may be configured as discussed in the following section.&lt;/p&gt;

&lt;h2&gt;How do I configure JMC?&lt;/h2&gt;

&lt;p&gt;Use Tools –&amp;gt; Options –&amp;gt; Performance Tools –&amp;gt; General and set options in the ‘Just My Code’ section: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/3302.jmc_5F00_options_5F00_44A0699D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jmc_options" border="0" alt="jmc_options" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/8105.jmc_5F00_options_5F00_thumb_5F00_046A5023.png" width="559" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The default has JMC on, showing one level of non-user callee functions. In the example above with JMC on, this is why we see the call to COMDouble::Sqrt(dobule) showing up in the call tree.&lt;/p&gt;

&lt;p&gt;It is also possible to show one-level of non-user code calling user code, which in the example above would add one level of the non-user code that calls main, as shown below: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/2742.jmc_5F00_on_5F00_calltree_5F00_callers_5F00_1_5F00_5925B91B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jmc_on_calltree_callers_1" border="0" alt="jmc_on_calltree_callers_1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-36-42-metablogapi/4478.jmc_5F00_on_5F00_calltree_5F00_callers_5F00_1_5F00_thumb_5F00_7FF3CF5B.png" width="640" height="117" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Why is ‘Just My Code’ only available for sampling?&lt;/h2&gt;

&lt;p&gt;When you instrument binaries for profiling, you have already performed some level of JMC. Only binaries that you instrument and first-level calls into other binaries will show up in the instrumentation report, so JMC is not really necessary.&lt;/p&gt;

&lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/colinth/"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10164281" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>How to Profile IIS Express with Visual Studio 2010 SP1</title><link>http://blogs.msdn.com/b/profiler/archive/2011/05/02/how-to-profile-iis-express-with-visual-studio-2010-sp1.aspx</link><pubDate>Mon, 02 May 2011 20:20:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10160133</guid><dc:creator>Andrew B Hall - MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10160133</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2011/05/02/how-to-profile-iis-express-with-visual-studio-2010-sp1.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;While IIS Express support shipped in Visual Studio 2010 SP1, unfortunately profiling code running in IIS Express does not just work out of the box.&amp;#160; The issue is that the profiler does not “know” how to setup and launch the IIS Express process to enable the various profiling methods.&amp;#160; If this is a blocking issue for you, fortunately this can be manually worked around to profile IIS Express.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The instructions for how to do this, vary depending on the method of profiling you would like to use, and the target framework&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;b&gt;CPU Sampling&lt;/b&gt;:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;If you’re profiling .NET 4.0 after you’ve launched your site in IIS Express, manually attach to the IISExpress.exe process (Analyze -&amp;gt; Profiler -&amp;gt; Attach/Detach…) and you will be collecting CPU sampling data&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;· If you’re profiling .NET &amp;lt;= 3.5:&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;From a Visual Studio command prompt, type:&lt;/font&gt;           &lt;ul&gt;           &lt;li&gt;&lt;font size="2"&gt;vsperfclrenv /sampleon&lt;/font&gt; &lt;/li&gt;            &lt;li&gt;&lt;font size="2"&gt;devenv&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;From the instance of Visual Studio that launches, launch your site in IIS Express and manually attach as in the step for profiling .NET 4.0&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;&lt;font size="2"&gt;.NET Memory Profiling (Sampling)&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;From a Visual Studio command prompt, type:&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;vsperfclrenv /&amp;lt;memory option you want—see &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb385759.aspx"&gt;&lt;font size="2"&gt;vsperfclrenv documentation&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; for options&amp;gt; &lt;/font&gt;&lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;devenv&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;From the instance of Visual Studio that launches, launch your site in IIS Express and manually attach as in the CPU sampling scenarios&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;&lt;font size="2"&gt;Instrumentation (including .NET memory instrumentation)&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;From a Visual Studio command prompt, type:&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;For method timing: vsperfclrenv /traceon            &lt;br /&gt;&lt;i&gt;if you want memory, see &lt;a href="http://msdn.microsoft.com/en-us/library/bb385759.aspx"&gt;vsperfclrenv documentation&lt;/a&gt; for options&lt;/i&gt;&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;devenv&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms182402(v=VS.100).aspx"&gt;&lt;font size="2"&gt;vsinstr&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; &amp;lt;your binaries that will run inside IIS Express&amp;gt;&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms182403(v=VS.100).aspx"&gt;&lt;font size="2"&gt;vsperfcmd&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; /start:trace /output:&amp;lt;report name&amp;gt;&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;From the instance of Visual Studio that launches, launch your website in IIS Express and run your scenario&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;From the command prompt type: vsperfcmd /shutdown&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Close IIS Express&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Open the resulting .vsp file in Visual Studio&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;&lt;font size="2"&gt;Resource Contention Profiling&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Launch your website in IIS Express&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;From a Visual Studio Command Prompt:&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;vsperfcmd /start:concurrency,resourceonly /output:&amp;lt;report.vsp&amp;gt;&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;vsperfcmd /attach:&amp;lt;IISExpress.exe’s PID&amp;gt;&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;Run your scenario&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;vsperfcmd /shutdown&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font size="2"&gt;close IIS Express&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Open the resulting .vsp file in Visual Studio&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10160133" width="1" height="1"&gt;</description></item><item><title>“Performance reports must be created on a local drive”</title><link>http://blogs.msdn.com/b/profiler/archive/2011/04/25/performance-reports-must-be-created-on-a-local-drive.aspx</link><pubDate>Mon, 25 Apr 2011 22:26:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10157890</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10157890</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2011/04/25/performance-reports-must-be-created-on-a-local-drive.aspx#comments</comments><description>&lt;p&gt;For better performance, VS Profiler requires the report to be on a local drive. If you change the report file location through Performance Session properties page (right click on performance session in Performance Explorer –&amp;gt; Properties –&amp;gt; General):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/0216.image_5F00_09055E8B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4010.image_5F00_thumb_5F00_16A7F4C6.png" width="671" height="96" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;then you end up with an error like that:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/6866.image_5F00_28848893.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/8055.image_5F00_thumb_5F00_7D3FF18B.png" width="478" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The rationale behind usage of local drives is that VS Profiler attempts to make logging to the file fast, while usage of network drives might introduce logging delays (up to blocking your application execution in some cases).&lt;/p&gt;  &lt;p&gt;However, if you absolutely have to use your network drives for that purpose, you can achieve that through usage of &lt;a href="http://msdn.microsoft.com/en-us/library/aa365680(VS.85).aspx"&gt;Symbolic Links&lt;/a&gt;. A symbolic link can be easily created with &lt;strong&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc753194(WS.10).aspx"&gt;mklink&lt;/a&gt; &lt;/strong&gt;utility. For example, &lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;mklink /D C:\Foo &lt;/font&gt;&lt;a href="file://\\MyNetwork\MyValut"&gt;&lt;font face="Courier New"&gt;\\MyNetwork\MyValut&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After that you can use C:\Foo as a location for profiling reports. Keep in mind, though, that your network access can be slower than a local drive access, and it can impact your profiling session.&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10157890" width="1" height="1"&gt;</description></item><item><title>How to profile ASP.NET and Silverlight at the same time</title><link>http://blogs.msdn.com/b/profiler/archive/2011/02/10/how-to-profile-asp-net-and-silverlight-at-the-same-time.aspx</link><pubDate>Thu, 10 Feb 2011 03:40:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10127142</guid><dc:creator>Andrew B Hall - MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10127142</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2011/02/10/how-to-profile-asp-net-and-silverlight-at-the-same-time.aspx#comments</comments><description>&lt;p&gt;&lt;font size="2"&gt;In Visual Studio 2010 SP1 we enabled the ability to profile Silverlight applications from the Visual Studio UI.&amp;#160; Unfortunately there is a limitation where we cannot automatically attach to multiple processes on launch from inside Visual Studio, so you are still unable to profile ASP.NET and Silverlight at the same time without manually attaching to Internet Explorer after launch.&amp;#160; Fortunately, this is relatively simple.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;To profile both Silverlight and ASP.NET at the same time:&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="2"&gt;Launch your CPU sampling session against your ASP.NET application from Visual Studio&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;In the Performance Explorer window click “Attach/Detach”        &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4212.image_5F00_7FD4D388.png"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7848.image_5F00_2C695396.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5466.image_5F00_thumb_5F00_533769D6.png" width="373" height="232" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Select the Internet Explorer process that is running your Silverlight application—if you only have one instance of Internet Explorer open with a single tab, the process will be the “iexplore” process &lt;strong&gt;without&lt;/strong&gt; a Window Title.&amp;#160; &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7455.image_5F00_1301505C.png"&gt;&lt;font size="2"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7853.image_5F00_thumb_5F00_24DDE429.png" width="571" height="330" /&gt;&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;If you have multiple instances of Internet Explorer open, or multiple tabs inside internet explorer, you can either:&lt;/font&gt;           &lt;ul&gt;           &lt;li&gt;&lt;font size="2"&gt;Try looking at the CPU consumption of your iexplore.exe processes in Task Manager&lt;/font&gt; to see which one is most active&lt;/li&gt;            &lt;li&gt;&lt;font size="2"&gt;Use &lt;/font&gt;&lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx"&gt;&lt;font size="2"&gt;Process Explorer&lt;/font&gt;&lt;/a&gt;               &lt;ul&gt;               &lt;li&gt;&lt;font size="2"&gt;Find –&amp;gt;&amp;#160; “Find Handle or DLL…” (ctrl + F)&lt;/font&gt; &lt;/li&gt;                &lt;li&gt;&lt;font size="2"&gt;Search for “coreclr.dll”&lt;/font&gt; &lt;/li&gt;                &lt;li&gt;&lt;font size="2"&gt;The “iexplore.exe” process with this dll loaded is the PID you want to attach to                    &lt;br /&gt;                    &lt;br /&gt;&lt;/font&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7838.image_5F00_12951D67.png"&gt;&lt;font size="2"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5707.image_5F00_thumb_5F00_2471B134.png" width="644" height="332" /&gt;&lt;/font&gt;&lt;/a&gt;                   &lt;br /&gt;&lt;/li&gt;             &lt;/ul&gt;           &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;You are now profiling ASP.NET and Silverlight at the same time&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10127142" width="1" height="1"&gt;</description></item><item><title>VS2010 SP1: Silverlight 4 profiling from Visual Studio UI</title><link>http://blogs.msdn.com/b/profiler/archive/2010/12/21/vs2010-sp1-silverlight-4-profiling-from-visual-studio-ui.aspx</link><pubDate>Tue, 21 Dec 2010 18:13:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10107761</guid><dc:creator>profiler1</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10107761</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/12/21/vs2010-sp1-silverlight-4-profiling-from-visual-studio-ui.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you install recently published &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=11ea69cb-cf12-4842-a3d7-b32a1e5642e2&amp;amp;displaylang=en"&gt;&lt;font color="#0066dd"&gt;&lt;u&gt;VS2010 SP1 Beta&lt;/u&gt;&lt;/font&gt;&lt;/a&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=11ea69cb-cf12-4842-a3d7-b32a1e5642e2&amp;amp;displaylang=en"&gt;&lt;font style="background-color: #ffff00"&gt;&lt;/font&gt;&lt;/a&gt;, you can discover that VS Profiler team enriched Silverlight profiling user experience. Previously I published few posts about VS2010 usage for those purposes, either through VS Profiler &lt;a href="http://blogs.msdn.com/b/mgoldin/archive/2010/04/26/vs2010-silverlight-4-profiling.aspx"&gt;command line tools&lt;/a&gt; or &lt;a href="http://blogs.msdn.com/b/mgoldin/archive/2010/06/01/vs2010-sliverlight-4-profiling-from-visual-studio-ui.aspx"&gt;VS2010 UI&lt;/a&gt;. Both approaches led you to the final results or figuring out the bottlenecks of your Silverlight application, but they require number of manual steps to be done.&lt;/p&gt;  &lt;p&gt;In VS2010 SP1 however Silverlight projects are fully recognized by VS Profiler, and you can conduct your performance investigations much easier. &lt;/p&gt;  &lt;p&gt;For example, you might use the &lt;a href="http://msdn.microsoft.com/en-us/library/ff426926(v=VS.95).aspx"&gt;Silverlight Text Editor Sample&lt;/a&gt;, and open this project in VS2010 SP1:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5001.image_5F00_74B74505.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/1778.image_5F00_thumb_5F00_05BB72E9.png" width="324" height="373" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, if you wish to create a performance session for this project, you can do it in a usual way through Performance Wizard:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/2867.image_5F00_054F3FF4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/1385.image_5F00_thumb_5F00_2C1D5634.png" width="338" height="199" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You will see your project in the list of possible targets (it was not there before the final integration of Silverlight projects and VS Profiler), and you can select it there and proceed with the Wizard that creates and starts a performance session for you:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/8712.image_5F00_56F5BA46.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4428.image_5F00_thumb_5F00_44ACF384.png" width="521" height="448" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When you close your application – the session is over and profiling results are presented so you can analyze the data:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/3426.image_5F00_2425B3D2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/6175.image_5F00_thumb_5F00_71C1E052.png" width="523" height="404" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/2364.image_5F00_7C7F37A7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/6562.image_5F00_thumb_5F00_5544EE72.png" width="523" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10107761" width="1" height="1"&gt;</description></item><item><title>Tip: Fixing VSPerfASPNetCmd metabase errors</title><link>http://blogs.msdn.com/b/profiler/archive/2010/07/23/tip-fixing-vsperfaspnetcmd-metabase-errors.aspx</link><pubDate>Fri, 23 Jul 2010 20:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10042023</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10042023</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/07/23/tip-fixing-vsperfaspnetcmd-metabase-errors.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee308442.aspx"&gt;VSPerfASPNetCmd&lt;/a&gt; is a new Visual Studio 2010 tool that helps you profile ASP.Net websites from the command-line. Recently I noticed an error message which didn&amp;rsquo;t cover one common situation so I thought I&amp;rsquo;d write about it. Here&amp;rsquo;s an example:&lt;/p&gt;
&lt;p&gt;&amp;gt; VSPerfASPNetCmd.exe &lt;a href="http://localhost"&gt;http://localhost&lt;/a&gt; &lt;br /&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;Microsoft (R) VSPerf ASP.NET Command, Version 10.0.0.0 &lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;Error &lt;br /&gt;VSP 7008: ASP.net exception: "The website metabase contains unexpected information or you do not have permission to access the metabase.&amp;nbsp; You must be a member of the Administrators group on the local computer to access the IIS metabase. Therefore, you cannot create or open a local IIS Web site.&amp;nbsp; If you have Read, Write, and Modify Permissions for the folder where the files are located, you can create a file system web site that points to the folder in order to proceed."&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The information in the error is correct and it is worth checking to make sure that you are running from an elevated command prompt, but it does miss a common configuration issue. In order to query for information from the IIS metabase, certain IIS components need to be installed.&lt;/p&gt;
&lt;p&gt;To check this in Windows 7:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open &amp;lsquo;Control Panel\Programs\Programs and Features&amp;rsquo; (or run &amp;lsquo;appwiz.cpl&amp;rsquo;). &lt;/li&gt;
&lt;li&gt;Choose &amp;lsquo;Turn Windows features on or off&amp;rsquo;. &lt;/li&gt;
&lt;li&gt;In the &amp;lsquo;Internet Information Services&amp;rsquo; section, make sure that the following options are selected. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7282.iis_5F00_config_5F00_2.png"&gt;&lt;img height="781" width="455" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/0842.iis_5F00_config_5F00_thumb.png" alt="IIS Configuration Options" border="0" title="IIS Configuration Options" style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The non-default options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IIS 6 Scripting Tools &lt;/li&gt;
&lt;li&gt;IIS 6 WMI Compatibility &lt;/li&gt;
&lt;li&gt;IIS Metabase and IIS 6 configuration compatibility &lt;/li&gt;
&lt;li&gt;ASP.NET, &lt;/li&gt;
&lt;li&gt;Windows Authentication &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/colinth" title="Colin Thomsen"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10042023" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/profiler/">profiler</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/visual+studio/">visual studio</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>CPU Performance Counters in Visual Studio 2010 Profiler</title><link>http://blogs.msdn.com/b/profiler/archive/2010/06/22/cpu-performance-counters-in-visual-studio-2010-profiler.aspx</link><pubDate>Tue, 22 Jun 2010 16:05:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10028559</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10028559</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/06/22/cpu-performance-counters-in-visual-studio-2010-profiler.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;While using Visual Studio Profiler either from Visual Studio UI or through command line tools, you may wish to collect more/different information using specific CPU Performance Counters. The collected data depends on the profiling mode. As usage of CPU Performance Counters considered an advanced technique, let me explain what is the proper way to use them and how to interpret the results.&lt;/p&gt;  &lt;p&gt;First of all, CPU Performance Counters are &lt;strong&gt;&lt;u&gt;not&lt;/u&gt; &lt;/strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa373083(v=VS.85).aspx"&gt;operating system performance counters&lt;/a&gt;, as they are implemented by CPU vendors inside of a CPU die.&lt;/p&gt;  &lt;p&gt;If you run inside of a Virtual Machine or on a Hyper-V enabled machine – you have no access to CPU Performance Counters (as I mentioned in my previous &lt;a href="http://blogs.msdn.com/b/mgoldin/archive/2010/01/09/visual-studio-profiler-in-virtual-environment.aspx"&gt;post&lt;/a&gt;). This is the current limitation of virtualization technologies.&lt;/p&gt;  &lt;p&gt;Let’s review 2 basic modes of VS Profiler – Sampling and Instrumentation – and discuss how the counters are used in each one of them.&lt;/p&gt;  &lt;h1&gt;Sampling&lt;/h1&gt;  &lt;p&gt;In Sampling mode, the profiler periodically interrupts an execution of your application in order to take a sample of it. The regularity of interrupts is achieved through usage of one of the CPU Performance Counters. By default – it is 10,000,000 Non Halted CPU Cycles. You can change the predefined sampling interval or the counter itself. When you change the counter, that means that you switch to a different event as a trigger of your samples. If the default Non Halted Cycles event causes your samples being collected when your application is actively using CPU, then switching to Last Level Cache Misses event, for example,&amp;#160; will cause samples being generated on cache misses (so, if there are no cache misses – no data is collected).&lt;/p&gt;  &lt;p&gt;VS Profiler supports sampling on only one counter at a time. Therefore, you can use only one counter when you configure your sampling session. &lt;/p&gt;  &lt;p&gt;When you look through results of sampling, you will &lt;strong&gt;&lt;em&gt;not &lt;/em&gt;&lt;/strong&gt;see separate data columns with the counter name. Remember, that usage of specific counter in this scenario means that your samples were triggered by the counter event. So interpret your samples (inclusive, exclusive, function samples, module samples, call trees etc) appropriately. &lt;/p&gt;  &lt;p&gt;To select a specific counter for your Sampling session in Visual Studio, go to Properties of your Performance Session (right click –&amp;gt; Properties), and select the &lt;strong&gt;Sampling&lt;/strong&gt; tab. In &lt;strong&gt;Sample event&lt;/strong&gt; drop down list switch default &lt;em&gt;Clock cycles&lt;/em&gt; to &lt;em&gt;Performance counter&lt;/em&gt;.&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/2046.image_5F00_0E863E22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5344.image_5F00_thumb_5F00_7DBE9373.png" width="473" height="215" /&gt;&lt;/a&gt;&lt;/h4&gt;  &lt;p&gt;Now you can select one of the provided counters and set its &lt;strong&gt;Sampling interval&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/1157.image_5F00_1D6D6D3C.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/0574.image_5F00_thumb_5F00_7228D634.png" width="484" height="346" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;The full set of counters provided by CPU vendors is quite big. VS Profiler suggests a sub-set of them, with an ability to add more counters to the selection if necessary. You will see all currently supported counters in VS UI. If you use &lt;a href="http://msdn.microsoft.com/en-us/library/bb385768.aspx"&gt;command line tools&lt;/a&gt; for your data collection, you can see the counters through the following option:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;C:\MyProjects&amp;gt;&lt;strong&gt;VSPerfCmd.exe /querycounters&lt;/strong&gt;       &lt;br /&gt;Microsoft (R) VSPerf Command Version 10.0.30319 x86       &lt;br /&gt;Copyright (C) Microsoft Corp. All rights reserved. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;Portable counters:        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; InstructionsRetired         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NonHaltedCycles         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; L2Misses         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; L2References         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ITLBMisses         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BranchesRetired         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MispredictedBranches         &lt;br /&gt;Platform counters:         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DCULinesIn         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DCUModifiedLinesIn         &lt;br /&gt;&lt;font size="4"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; . . .&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;To use one of them, you need to provide the counter name in &lt;strong&gt;/COUNTER&lt;/strong&gt; option of &lt;strong&gt;VSPerfCmd.exe&lt;/strong&gt; when you start your data collection. &lt;strong&gt;VSPerfCmd.exe /?&lt;/strong&gt; will give you an exact syntax. For example:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;VSPerfCmd.exe /attach:MyApplication.exe /COUNTER:L2Misses,1000&lt;/font&gt;&lt;/p&gt;  &lt;h1&gt;Instrumentation&lt;/h1&gt;  &lt;p&gt;In instrumentation mode, VS Profiler records timestamps at function entries and exits. If you add CPU Performance Counters to the session, their values will be collected at the same time, and you will have separate columns of data for each counter. Unlike the sampling mode, you theoretically can add to instrumentation profiling session as many CPU counters as you wish. Practically, however, the number of counters you can use simultaneously is limited by a number of registers that are implemented in your CPU for that purpose. Sometimes it could be as few as two registers only, and VS Profiler always tries to acquire one of them for internal usage. &lt;/p&gt;  &lt;p&gt;To add some Performance Counters to your Performance Session, go to the session Properties and select &lt;strong&gt;CPU Counters&lt;/strong&gt; tab. There you can enable and select counters you want to add to your instrumentation data collection.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/0167.image_5F00_1D013A47.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/6036.image_5F00_thumb_5F00_51A19682.png" width="511" height="220" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When you look at collected results, you will see new columns of data:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4774.image_5F00_7C79FA94.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/3618.image_5F00_thumb_5F00_181E868B.png" width="517" height="117" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If number of counters that you select exceeds current CPU limitation, some of them will be dropped from the collection and you will get a WARNING message in the Output window:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Warning VSP2318: The monitor was unable to initialize counter 'Mispredicted Branches'.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;While using command line tools, you can have multiple /COUNTER options to add several counters to your instrumentation session:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;VSPerfCmd.exe /start:trace /output:MyFile.vsp /COUNTER:c1 /COUNTER:c2&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/mgoldin"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10028559" width="1" height="1"&gt;</description></item><item><title>Thread Performance: Resource Contention Concurrency Profiling in Visual Studio 2010</title><link>http://blogs.msdn.com/b/profiler/archive/2010/06/08/thread-performance-resource-contention-concurrency-profiling-in-visual-studio-2010.aspx</link><pubDate>Tue, 08 Jun 2010 20:57:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10021919</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10021919</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/06/08/thread-performance-resource-contention-concurrency-profiling-in-visual-studio-2010.aspx#comments</comments><description>&lt;p&gt;Does your native code deals with &lt;strong&gt;&lt;em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms682530(VS.85).aspx"&gt;critical sections&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt; or other synchronization primitives?&lt;/p&gt;  &lt;p&gt;Does your managed code uses C# &lt;strong&gt;&lt;em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/c5kehkcz(VS.71).aspx"&gt;lock&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt; statement or &lt;strong&gt;&lt;em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.aspx"&gt;Monitor&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt; class?&lt;/p&gt;  &lt;p&gt;If yes, and if you would like to get a clear picture of all contentions in your application, you might want to check out the new profiling mode of VS2010 Profiler – Resource Contention concurrency profiling. It collects and presents information about all contentions, when synchronization resources cause your threads to be blocked in an attempt to acquire the resource.&amp;#160; Being contended, a thread doesn’t run. It waits. It wastes the time. It decreases the performance you wanted to gain from your super powerful multi-core machine, when you designed your application as a multithreaded in the first place.&lt;/p&gt;  &lt;p&gt;For detailed explanation about how to collect contentions data, and what are the best ways to investigate it, follow the links.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/ff714587.aspx"&gt;&lt;font color="#0000ff"&gt;Resource Contention Concurrency Profiling in Visual Studio 2010&lt;/font&gt;&lt;/a&gt; – June 2010 MSDN article &lt;/li&gt;    &lt;li&gt;&lt;a title="http://blogs.msdn.com/b/mgoldin/archive/2010/04/22/resource-contention-concurrency-profiling-in-visual-studio-2010-performance-investigation-flows.aspx" href="http://blogs.msdn.com/b/profiler/archive/2010/04/23/resource-contention-concurrency-profiling-in-visual-studio-2010-performance-investigation-flows.aspx"&gt;&lt;font color="#0000ff"&gt;Resource Contention Concurrency Profiling in Visual Studio 2010 – Performance Investigation Flows&lt;/font&gt;&lt;/a&gt; – a follow up blog to the MSDN article. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;img title="June 2010 issue" alt="June 2010 issue" align="middle" src="http://i.msdn.microsoft.com/ff727949.cover_0610_lrg(en-us,MSDN.10).png" /&gt;&lt;/p&gt;  &lt;p&gt;Resolve synchronization issues, if your code has any, and boost the performance of your application!&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/mgoldin"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10021919" width="1" height="1"&gt;</description></item><item><title>VS2010: Silverlight 4 profiling from Visual Studio UI</title><link>http://blogs.msdn.com/b/profiler/archive/2010/06/01/vs2010-sliverlight-4-profiling-from-visual-studio-ui.aspx</link><pubDate>Tue, 01 Jun 2010 19:40:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10018435</guid><dc:creator>profiler1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10018435</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/06/01/vs2010-sliverlight-4-profiling-from-visual-studio-ui.aspx#comments</comments><description>&lt;p&gt;In my previous &lt;a href="http://blogs.msdn.com/b/mgoldin/archive/2010/04/26/vs2010-silverlight-4-profiling.aspx"&gt;post&lt;/a&gt; I showed how VS2010 Profiler &lt;em&gt;command line tools&lt;/em&gt; can be used to profile your Silverlight 4 application, as this feature is only partially integrated with Visual Studio UI. While we are working on a full integration story, let me show you how VS UI can be used (with some extra work) currently to get same results as you get using the command line tools.&lt;/p&gt;  &lt;p&gt;We will use the same &lt;a href="http://www.silverlight.net/community/samples/silverlight-samples/breakout-game-34870/"&gt;Breakout Game&lt;/a&gt; example, which is open as a project in Visual Studio at the beginning:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5672.image_5F00_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5353.image_5F00_thumb_5F00_1.png" width="337" height="189" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As Silverlight project is not currently recognized by the Performance Wizard, you better start with creating an empty Performance Session. You can do it from the Analyze menu (Analyze –&amp;gt; Profiler –&amp;gt; New Performance Session):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7823.image_5F00_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/2045.image_5F00_thumb_5F00_3.png" width="674" height="211" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;or by clicking a &lt;em&gt;&lt;strong&gt;New Performance Session&lt;/strong&gt;&lt;/em&gt; button in Performance Explorer:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7823.image_5F00_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5684.image_5F00_thumb_5F00_4.png" width="326" height="138" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When a new Performance Session is created, it has empty Reports and Targets nodes. Now right click on Targets, select Add Target Binary and pick up&lt;strong&gt; &lt;font color="#0000ff"&gt;c:\Program Files\Internet Explorer\iexplore.exe&lt;/font&gt;&lt;/strong&gt; (or &lt;strong&gt;&lt;font color="#0000ff"&gt;c:\Program Files (x86)\Internet Explorer\iexplore.exe&lt;/font&gt;&lt;/strong&gt;, if you work on x64 machine):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/1462.image_5F00_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/3034.image_5F00_thumb_5F00_7.png" width="333" height="141" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next step is to right click on iexplore.exe node, select Properties, and then select Launch tab in the Property Pages window. The “Executable to launch” is set already, but you should add Arguments and Working directory for your application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/1462.image_5F00_24.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/8308.image_5F00_thumb_5F00_11.png" width="609" height="417" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The last preparation before you can start measurements is to make sure your Symbols setting includes the binary directory where the application is compiled. This is currently required for correct symbols resolution. You can find the Symbols setting in Tools –&amp;gt; Options –&amp;gt; Debugging –&amp;gt; Symbols (it is under Debugging and not Performance Tools, as both Debugger and Profiler share the same setting for Symbols).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/5287.image_5F00_26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4604.image_5F00_thumb_5F00_12.png" width="615" height="355" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now you can click Start Profiling button &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4101.image_5F00_36.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4113.image_5F00_thumb_5F00_17.png" width="28" height="28" /&gt;&lt;/a&gt; in the Performance Explorer, and Internet Explorer will be started under profiler, running your application. As I mentioned in the previous post, there could be number of IE processes while your application is running. Yet Visual Studio attaches Profiler to only first of them, and doesn’t reattach it automatically to other spawned processes. Thus, you have 2 options here – either to eliminate creation of child processes by IE &lt;a href="http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx"&gt;through the registry&lt;/a&gt; (modifying &lt;strong&gt;TabProcGrowth&lt;/strong&gt; value), or attach profiler to additional IE process (one or many) before you start running your scenario. Simultaneous profiling of several processes is supported, and you will actually profile all IE processes that you attach the profiler to. Those processes that run your application will generate a valuable profiling data, while rest could be later ignored. &lt;/p&gt;  &lt;p&gt;You can attach to additional processes using &lt;strong&gt;Attach/Detach&lt;/strong&gt; button of Performance Explorer:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4520.image_5F00_28.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/2134.image_5F00_thumb_5F00_13.png" width="319" height="113" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In our example, you can see in “Attach Profiler to Process” dialog that the profiler is attached already to one IE process, and now you will attach it to yet another one.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4520.image_5F00_30.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/0081.image_5F00_thumb_5F00_14.png" width="591" height="346" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After you finish your scenario, close IE window and profiling results will be automatically open for you in Visual Studio, so you can navigate it using all views as usual:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/4213.image_5F00_32.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-36-42-metablogapi/7356.image_5F00_thumb_5F00_15.png" width="1025" height="353" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/b/mgoldin"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10018435" width="1" height="1"&gt;</description></item><item><title>VS2010: Silverlight 4 profiling</title><link>http://blogs.msdn.com/b/profiler/archive/2010/04/26/vs2010-silverlight-4-profiling.aspx</link><pubDate>Mon, 26 Apr 2010 15:13:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10002590</guid><dc:creator>profiler1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10002590</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/04/26/vs2010-silverlight-4-profiling.aspx#comments</comments><description>&lt;p&gt;Did you know that Visual Studio 2010 Profiler allows you to profile your &lt;a href="http://www.silverlight.net/getstarted/silverlight-4/"&gt;Silverlight 4&lt;/a&gt; applications? You didn’t? It does.&lt;/p&gt;  &lt;p&gt;This feature, however, is only partially integrated with Visual Studio UI, and you need to use command line tools to collect the data. After that, you can open the resulting .VSP file in Visual Studio as you normally do after other types of profiling, and enjoy rich visualization experience while investigating your performance problems.&lt;/p&gt;  &lt;p&gt;Yes, we know it is not as cool as clicking VS buttons. We are working on a better experience. Yet I thought it is worth to emphasize that there is a way to use command line tools for customers that seek performance improvement in their Silverlight applications.&lt;/p&gt;  &lt;p&gt;Let assume you develop an application like &lt;a href="http://www.silverlight.net/community/samples/silverlight-samples/breakout-game-34870/"&gt;Breakout Game&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_thumb.png" width="378" height="343" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You compile it inside VS2010, run it, and want to profiler it. Performance Wizard tells you that this project can not be launched by the profiler. Alas. Time to go to the command line tools. Click you &lt;strong&gt;Start &lt;/strong&gt;button, go to &lt;strong&gt;All Programs &lt;/strong&gt;and find there &lt;strong&gt;Microsoft Visual Studio 2010&lt;/strong&gt;. There, go to &lt;strong&gt;Visual Studio Tools &lt;/strong&gt;and launch a &lt;strong&gt;Visual Studio Command Prompt (2010).&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_thumb_1.png" width="392" height="491" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;This command line window has predefined PATH that includes profiler command line tools:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_thumb_3.png" width="904" height="147" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now go to the directory where your Silverlight binaries are compiled:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;gt;cd c:\Breakout\Breakout\Bin\Release&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;We are ready to start our profiling session. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;strong&gt;VSPerfClrEnv&lt;/strong&gt; /sampleon &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;&amp;quot;c:\Program Files (x86)\Internet Explorer\iexplore.exe&amp;quot; C:\Breakout\Breakout\Bin\Release\TestPage.html&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;VSPerfCmd&lt;/strong&gt; /start:&lt;strong&gt;sample&lt;/strong&gt; /output:MyFile /attach:&amp;lt;PID of iexplore.exe process&amp;gt;&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;Run your scenario&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;VSPerfCmd&lt;/strong&gt; /detach&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;VSPerfCmd&lt;/strong&gt; /shutdown&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;strong&gt;VSPerfClrEnv&lt;/strong&gt; /off&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Steps above require some explanation. In 1 – you prepare environment that is needed for Silverlight profiling, and in 2 you start your hosting process (iexplore.exe, in our example) within that environment. This is essential, as if you start IE by clicking an icon on your desktop, you will get no Silverlight profiling data at the end. Step 3 starts profiler in &lt;strong&gt;Sampling&lt;/strong&gt; mode, and attaches it to the process of your choice. Keep in mind that you might have multiple IE processes running, so you need to choose one that runs your code. If you are not completely sure which one is it, or if your code runs in several IE processes – well, attach to all of them! You can do it either running “VSPerfCmd /attach:&amp;lt;PidN&amp;gt;” several times, or enumerating all PIDs in a single command: “VSPerfCmd /attach:PID1,PID2,PID3”. After profiler is attached, you run your scenario in step 4, and detach profiler from all target processes in step 5. Detaching is not enough, as you need to shutdown the profiler in order to finalize your result file (step 6). Step 7 cancels changes of the environment that are made in step 1.&lt;/p&gt;  &lt;p&gt;It could be that you need to profile your application from the very beginning. In this case steps 2 and 3 can be combined into one, where you launch IE under profiler: &lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;VSPerfCmd /start:&lt;strong&gt;sample&lt;/strong&gt; /output:MyFile /&lt;strong&gt;launch&lt;/strong&gt;:&amp;quot;c:\Program Files (x86)\Internet Explorer\iexplore.exe&amp;quot; /&lt;strong&gt;args&lt;/strong&gt;:”C:\Breakout\Breakout\Bin\Release\TestPage.html“&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;The caveat here is that if IE process spawns a child process that will run your application, the profiler will be still attached to the “father” IE process, as it doesn’t re-attach itself automatically to spawned processes. You may, however, eliminate creation of child processes by IE8 &lt;a href="http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx"&gt;through the registry&lt;/a&gt;, modifying &lt;strong&gt;TabProcGrowth&lt;/strong&gt; value. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://dgeenens.net/images/600px-Warning.png" width="52" height="44" /&gt;&lt;font color="#0000ff"&gt;Please make sure that you run all the above steps from the directory where your binaries are located. Until we complete the integration of this feature with VS, your function names will not be properly resolved otherwise. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;You can kill you IE process now. Open the MyFile.VSP in VS2010 as you would do normally for profiling results. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Silverlight4profiling_BD30/image_thumb_4.png" width="1138" height="311" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Formally, that would conclude an official support of Silverlight profiling in VS2010 – Sampling mode through command line tools. &lt;/p&gt;  &lt;p&gt;However, if you want to try .NET memory or concurrency resource contention profiling of your Silverlight application – I won’t stop you. This is not currently supported and tested modes of work, but they might work for you and help you to see your performance problems from a different angle. &lt;/p&gt;  &lt;p&gt;For .NET memory profiling, use “VSPerfClrEnv /samplegc” or “VSPerfClrEnv /samplegclife” in your step 1 to get either allocation profiling or allocation and lifetime profiling. &lt;/p&gt;  &lt;p&gt;For concurrency resource contention – use “/start&amp;quot;:concurrency,ResourceOnly” in the step 3 above. &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff"&gt;&lt;a href="http://www.nachmore.com/2010/profiling-silverlight-4-with-visual-studio-2010/"&gt;Oren Nachman&lt;/a&gt;&lt;/font&gt; from Sliverlight team is another excellent source for Silverlight profiling information. In his great article he provides several additional tricks and options that you can find quite useful. &lt;/p&gt;  &lt;p&gt;Enjoy!&amp;#160; &lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10002590" width="1" height="1"&gt;</description></item><item><title>Resource Contention Concurrency Profiling in Visual Studio 2010 – Performance Investigation Flows</title><link>http://blogs.msdn.com/b/profiler/archive/2010/04/23/resource-contention-concurrency-profiling-in-visual-studio-2010-performance-investigation-flows.aspx</link><pubDate>Fri, 23 Apr 2010 07:17:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10001359</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=10001359</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/04/23/resource-contention-concurrency-profiling-in-visual-studio-2010-performance-investigation-flows.aspx#comments</comments><description>&lt;p&gt;Visual Studio 2010 brings a number of innovations to multithreaded and parallel computing. One of them is Resource Contention Concurrency Profiling. John Robbins gives a really great first look at this feature in his Wintellect &lt;a href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/10/19/vs-2010-beta-2-concurrency-resource-profiling-in-depth-first-look.aspx"&gt;VS 2010 Beta 2 Concurrency Resource Profiling In Depth First Look&lt;/a&gt; post. The June 2010 issue of MSDN magazine contains the &lt;a title="Resource Contention Concurrency Profiling in Visual Studio 2010" href="http://msdn.microsoft.com/en-us/magazine/ff714587.aspx"&gt;Resource Contention Concurrency Profiling in Visual Studio 2010&lt;/a&gt; article with a detailed explanation of this profiling mode, including various ways of data collection and presentation and some guidance to efficient data analysis. Here I would like to &lt;em&gt;append &lt;/em&gt;the article with some additional valuable information. &lt;/p&gt;  &lt;p&gt;The table below presents a subset of VS2010 performance data views. Those views are useful while investigating results of Resource Contention Concurrency Profiling. &lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;&lt;strong&gt;View&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Summary&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;Summary information is presented to serve as a starting point for your investigation. This is the first view you see, and it is opened automatically after the profiling session is over and result file is ready.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Resource Details&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;A detailed view of a specific resource (for example, a lock), showing all threads that were blocked on it during the application lifetime. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Thread Details&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;A detailed view of a specific thread, showing all resources (such as locks) the thread was blocked on. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Contention&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;Call trees that are separated per contention resource. In other words, this view presents a set of call trees, each containing stacks that were blocked on a specific resource. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Processes&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;A list of inspected processes, where each process has a list of its threads, and each thread is attributed with the number of contentions it experienced, and summarized length of blocked time. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="139"&gt;         &lt;p&gt;Function Details&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="499"&gt;         &lt;p&gt;A detailed view of a specific function, including functions it calls and collected data. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;&lt;font color="#0000ff"&gt;Resource Details view&lt;/font&gt;&lt;/strong&gt;, for example, is the following one:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/ResourceContentionConcurrencyProfilingin_C1C4/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/ResourceContentionConcurrencyProfilingin_C1C4/image_thumb.png" width="1068" height="528" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There are several built-in transitions between profiling data views inside VS2010, and they are explained in the article. Let me briefly summarize those transitions through the below diagram, which presents possible performance investigation flows. When you analyze your data, do not feel obligated to use VS2010 views in that exact order or sequence – you can always select any desired view through a drop-down combo box of VS2010 that enumerates all views. The diagram is just a suggestion how that can be done.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/ResourceContentionConcurrencyProfilingin_C1C4/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/ResourceContentionConcurrencyProfilingin_C1C4/image_thumb_2.png" width="860" height="411" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The transitions that are enumerated on the diagram are: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. Move from Summary view to Resource Details view (chart) by clicking a resource name in the Most Contended Resources table &lt;/p&gt;    &lt;p&gt;2. Move from Summary view to Thread Details view (chart) by clicking a thread ID in the Most Contended Threads table &lt;/p&gt;    &lt;p&gt;3. Switch from Resource Details view to Thread Details view by clicking on a chart label, representing the thread &lt;/p&gt;    &lt;p&gt;4. Switch from Thread Details view to Resource Details view by clicking on a chart label, representing the resource &lt;/p&gt;    &lt;p&gt;5. Move from Resource Details view to Function Details view by double clicking on a function name in Contention Call Stack panel &lt;/p&gt;    &lt;p&gt;6. Move from Thread Details view to Function Details view by double clicking on a function name in Contention Call Stack panel &lt;/p&gt;    &lt;p&gt;7. Move from Resource Details view to Contention view by clicking on a Total label of the chart &lt;/p&gt;    &lt;p&gt;8. Move from Contention view to Resource Details view through a context menu (right-click) of a resource &lt;/p&gt;    &lt;p&gt;9. Move from Thread Details view to Processes/Threads view by clicking on a Total label of the chart &lt;/p&gt;    &lt;p&gt;10. Move from Processes/Threads view to Thread Details view through a context menu of a thread &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;When you open the profiling results file, you see a Summary view that helps you to select a possible investigation direction. Some options to consider here are: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Start in Summary view, detect a contention resource or a thread you want to inspect closely (because it has too many contentions), then explore data through the transitions:      &lt;ul&gt;       &lt;li&gt;1 – to see resource details, or 2 – to see thread details &lt;/li&gt;        &lt;li&gt;4 and 3 – to pivot between resources and threads details &lt;/li&gt;        &lt;li&gt;5 and 6 – to see details of function causing the contention &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Start in Summary view, use drop-down combo box to switch to Contention view, sort all resources, select one of them, then use transition 8 to get to the resource details, followed by transitions 4, 3, 5 and 6 as required. &lt;/li&gt;    &lt;li&gt;Start in Summary view, use drop-down combo box to switch to Processes/Threads view, sort all threads, select one of them, then use transition 10 to get to the thread details, followed by transitions 4, 3, 5 and 6 as required. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10001359" width="1" height="1"&gt;</description></item><item><title>VS2010: Profiler Guidance (rules) Part 1</title><link>http://blogs.msdn.com/b/profiler/archive/2010/02/25/vs2010-profiler-guidance-rules-part-1.aspx</link><pubDate>Fri, 26 Feb 2010 00:19:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9969613</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9969613</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/02/25/vs2010-profiler-guidance-rules-part-1.aspx#comments</comments><description>&lt;p&gt;The new guidance feature in the VS2010 profiler will look familiar to people who have used the &lt;a href="http://msdn.microsoft.com/en-us/library/3z0aeatx(VS.100).aspx"&gt;static code analysis tools&lt;/a&gt; in previous versions. However, instead of statically analyzing your code, the profiler runs it and analyzes the results to provide guidance to fix some common performance issues.&lt;/p&gt;  &lt;p&gt;Probably the best way to introduce this feature is via an example. Let’s assume you have written a simple application as follows:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; TestApplication&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;             BadStringConcat();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; BadStringConcat()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; s = &lt;span style="color: #006080"&gt;&amp;quot;Base &amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 10000; ++i)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;                 s += i.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  18:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  19:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  20:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;If you profile this application in Sampling Mode you’ll see an Action Link called ‘View Guidance’ on the Summary Page:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/actionlinks_guidance_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Action Links View Guidance" border="0" alt="Action Links View Guidance" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/actionlinks_guidance_thumb_1.png" width="202" height="100" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Clicking on this link brings up the Error List, which is where you would also see things like compiler errors and static code analysis warnings:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_concat_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Error List String.Concat" border="0" alt="Error List String.Concat" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_concat_thumb_2.png" width="636" height="159" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;em&gt;DA0001: System.String.Concat(.*) = 96.00; Consider using StringBuilder for string concatenations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As you can see there is a 1 warning, which is DA0001, warning about excessive usage of String.Concat. The number 96.00 is the percentage of inclusive samples in this function.&lt;/p&gt;

&lt;p&gt;Double-clicking on the warning in the Error List switches to the &lt;a href="http://blogs.msdn.com/colinth/archive/2010/01/18/vs2010-investigating-a-sample-profiling-report-function-details.aspx"&gt;Function Details View&lt;/a&gt;. Navigating up one level of callers, we see that BadStringConcat is calling Concat (96% of Inclusive Samples) and doing some work itself (4%). The String.Concat call is not a direct call, but looking at the Function Code View you can see a ‘+=’ call on a string triggers the call. 

  &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/function_details_concat_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Function Details Concat" border="0" alt="Function Details Concat" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/function_details_concat_thumb_1.png" width="746" height="700" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The DA0001 rule suggests fixing the problem by changing the string concatenation to use a StringBuilder but I’ll leave that up to the reader. Instead, I’ll cover some of the other aspects of rules. &lt;/p&gt;

&lt;p&gt;One of the more important questions is what to do if you wish to turn off a given rule (or even all rules)? The answer is to open up the ‘Tools/Options’ dialog and in the Performance section, navigate to the new ‘Rules’ subsection:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/rules_options_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="rules_options" border="0" alt="rules_options" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/rules_options_thumb.png" width="747" height="430" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Here you can see that I’ve started searching by typing ‘st’ in the search box at the top. This dialog can be used to turn off rules (by clicking on the checkboxes on the left), or to change rule categories to ‘Warning’, ‘Information’ or ‘Error’. The only affect is to change how the rule is displayed in the Error List.&lt;/p&gt;

&lt;p&gt;If you have a situation where you are sharing a profiler report (VSP file) with team members, sometimes it might be useful to let them know that a warning is not important or has already been considered. In this case you can right-click on the Error List and choose ‘Suppress Message’.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_suppress_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="errorlist_suppress" border="0" alt="errorlist_suppress" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_suppress_thumb.png" width="657" height="287" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The rule warning is crossed out and you can choose to save the VSP file so that the next time it is opened, the suppression is shown:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_suppressed_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="errorlist_suppressed" border="0" alt="errorlist_suppressed" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilerGuidancerules_C532/errorlist_suppressed_thumb.png" width="657" height="150" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;That’s it for now. I plan on covering a little more about rules in a future post, including more details about the rules themselves, how you can tweak thresholds and even write your own rules.&lt;/p&gt;

&lt;p&gt;[&lt;a href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9969613" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/visual+studio/">visual studio</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>VS2010: Profiling In Progress (PIP)</title><link>http://blogs.msdn.com/b/profiler/archive/2010/02/04/vs2010-profiling-in-progress-pip.aspx</link><pubDate>Fri, 05 Feb 2010 01:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9958550</guid><dc:creator>profiler1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9958550</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/02/04/vs2010-profiling-in-progress-pip.aspx#comments</comments><description>&lt;P&gt;With Visual Studio 2010 we want to make it clearer when you are profiling your application within the Visual Studio IDE. To accomplish this we added a new control which we call ‘Profiling In Progress’ or PIP, which we show when you launch the profiler or attach the profiler to a running application.&lt;/P&gt;
&lt;P&gt;Our goal was to show something simple and lightweight while profiling and to make a few simple operations possible. PIP in VS2010 is shown below:&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_1_2.png" mce_href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_1_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=pip_1 border=0 alt=pip_1 src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_1_thumb.png" width=505 height=294 mce_src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_1_thumb.png"&gt;&lt;/A&gt;&lt;EM&gt;Currently profiling. Pause profiling. Stop profiling or exit the application to generate a report.&lt;/EM&gt; &lt;/P&gt;
&lt;P&gt;The progress/spin control indicates that the UI is responding and there are two links:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Pause profiling, which changes to ‘Resume profiling’ when clicked. This has the same effect as clicking on the ‘Pause profiling’ button in the Performance Explorer. &lt;/LI&gt;
&lt;LI&gt;Stop profiling, which kills the application and finishes profiling. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;After profiling completes, PIP changes to show that we are about to open the report.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_2_2.png" mce_href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_2_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=pip_2 border=0 alt=pip_2 src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_2_thumb.png" width=505 height=294 mce_src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010ProfilingInProgressPIP_108BF/pip_2_thumb.png"&gt;&lt;/A&gt;&lt;EM&gt; Preparing to open report… This might take a while if your symbol server is slow or not responding.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;[&lt;A href="http://blogs.msdn.com/colinth" mce_href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/A&gt;]&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9958550" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>VS2010: Using profiler to improve cache data locality</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/20/vs2010-using-profiler-to-improve-cache-data-locality.aspx</link><pubDate>Thu, 21 Jan 2010 01:28:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9951207</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9951207</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/20/vs2010-using-profiler-to-improve-cache-data-locality.aspx#comments</comments><description>&lt;p&gt;A recent &lt;a href="http://www.codeproject.com/KB/threads/FalseSharing.aspx"&gt;Concurrency Hazards: False Sharing&lt;/a&gt; article demonstrates how VS2010 profiler can be used to detect source of cache data locality issues. To achieve this, you can sample with cache specific CPU performance counters, as long as you do not run inside Virtual Machine or on Hyper-V enabled environment (&lt;a href="http://blogs.msdn.com/mgoldin/archive/2010/01/09/visual-studio-profiler-in-virtual-environment.aspx"&gt;and this is why&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;In post-VS2010 Beta 2 releases you can use &lt;em&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;Last Level Cache Misses&lt;/font&gt; &lt;/strong&gt;&lt;/em&gt;and &lt;strong&gt;&lt;em&gt;&lt;font color="#0000ff"&gt;Last Level Cache References&lt;/font&gt; &lt;/em&gt;&lt;/strong&gt;counters for that purpose:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Usingprofilertoimprovecachedataloc_F542/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Usingprofilertoimprovecachedataloc_F542/image_thumb_2.png" width="600" height="376" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9951207" width="1" height="1"&gt;</description></item><item><title>VS2010: Investigating a sample profiling report (Function Details)</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/19/vs2010-investigating-a-sample-profiling-report-function-details.aspx</link><pubDate>Tue, 19 Jan 2010 17:35:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9950441</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9950441</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/19/vs2010-investigating-a-sample-profiling-report-function-details.aspx#comments</comments><description>&lt;p&gt;I’ve already discussed how the &lt;a href="http://blogs.msdn.com/colinth/archive/2009/12/31/vs2010-new-profiler-summary-page.aspx"&gt;new profiler summary page&lt;/a&gt; makes it easier to discover and fix performance issues, but sometimes a little more investigation is required. This time I’m going to drill in with another new VS2010 feature called the Function Details View.&lt;/p&gt;  &lt;p&gt;I’m going to use PeopleTrax application again, which you can &lt;a href="http://code.msdn.microsoft.com/VSTS2010B1PeopleTrax"&gt;download from CodeBox&lt;/a&gt;. I have a report which I collected earlier using the Sampling method of profiling, since the application appears to be CPU bound (at least on a single core).&lt;/p&gt;  &lt;p&gt;In this report I take a look at the Hot Path and see that People.GetNames is calling two hot functions ‘StringReader.ReadLine()’ and ‘String.Trim()’.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/1_summary_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1_summary" border="0" alt="1_summary" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/1_summary_thumb.png" width="700" height="520" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’d like to see where these expensive calls are in my code so I click on GetNames (shown in purple above) to bring up the new Function Details view.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/2_function_details_splitscreen_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2_function_details_splitscreen" border="0" alt="2_function_details_splitscreen" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/2_function_details_splitscreen_thumb.png" width="510" height="480" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There are a few things to note about this new view.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The title at the top is for People.GetNames(). &lt;/li&gt;    &lt;li&gt;There is a dropdown to switch between ‘Inclusive Samples %’ and ‘Inclusive Samples’ &lt;/li&gt;    &lt;li&gt;There are some blue boxes showing callers and callees (I’ll cover this more later). &lt;/li&gt;    &lt;li&gt;The code is shown with hot lines and an annotated margin. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In the default view we would need to drag the splitter (shown in purple) to see all of the boxes. Instead, we can use the toolbar option to ‘Split Screen Vertically’, also highlighted in purple.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/3_function_details_splitscreen2_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3_function_details_splitscreen2" border="0" alt="3_function_details_splitscreen2" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/3_function_details_splitscreen2_thumb.png" width="700" height="420" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now we can clearly see where the calls to ReadLine() and Trim() are in the code on the right-hand side. There is also a metrics table in the ‘Function Performance Details’ section and there are some related links.&lt;/p&gt;  &lt;p&gt;At this point, let’s look at the blue boxes. The left-hand box shows the callers of this function. The height of the box represents the relative cost for the metric that is currently chosen (in this case Inclusive Samples). Since we have a single caller, it takes up the entire box.&lt;/p&gt;  &lt;p&gt;On the right we have another blue box that contains several sections:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Function Body (87 samples). The height of this box represents the relative number of samples in the body itself (Exclusive Samples). &lt;/li&gt;    &lt;li&gt;ReadLine (727 samples). This is the function with the most Inclusive Samples. Again, the height is proportional so it is also the biggest box. &lt;/li&gt;    &lt;li&gt;Trim (642 samples). The function with the second most Inclusive Samples. Slightly smaller height. &lt;/li&gt;    &lt;li&gt;Other functions with smaller sample counts. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Each of these boxes (aside from Function Body) is clickable, allowing navigation of the Caller/Callees.&lt;/p&gt;  &lt;p&gt;Looking at the code I can’t see an easy way to simplify it and I don’t control either Trim() or ReadLine(), so now let’s navigate one level up in the callers by clicking on GetPeople.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/6_function_details_clickable_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="6_function_details_clickable" border="0" alt="6_function_details_clickable" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/6_function_details_clickable_thumb.png" width="294" height="318" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Clicking causes us to navigate to the GetPeople Function Details view:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/7_function_details_navigate_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="7_function_details_navigate" border="0" alt="7_function_details_navigate" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010Investigatingasampleprofilingrepor_DB38/7_function_details_navigate_thumb.png" width="700" height="455" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;From the code on the right-hand side we can see that in the two highlighted calls to GetNames 89.2% of the samples are occurring. From the loop structure it seems like it would be a good idea to avoid making these GetNames calls inside the for loop. Followers of the PeopleTrax application will notice that this is the first optimization suggestion for this application – cache the GetNames calls in the constructor. The next step in this investigation would be to change the code, collect another profile and compare the reports, but I’ll leave that up to you.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; line-level information is only available for sample-profiling. Since this information is not available in Instrumentation mode, highlighting and margin annotation is also not available for Instrumentation mode.&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9950441" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/profiler/">profiler</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>PRF0025: No data was collected – why is that?</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/14/prf0025-no-data-was-collected-why-is-that.aspx</link><pubDate>Fri, 15 Jan 2010 00:52:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9948739</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9948739</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/14/prf0025-no-data-was-collected-why-is-that.aspx#comments</comments><description>&lt;p&gt;One day, you may try to use Visual Studio profiler to sample an application you develop, and end up with an error saying no data is collected:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Profiling started.      &lt;br /&gt;Profiling process ID 2752 (&amp;lt;Your Application Name&amp;gt;).       &lt;br /&gt;Process ID 2752 has exited.       &lt;br /&gt;Data written to C:\&amp;lt;some path&amp;gt;\Report100114.vsp.       &lt;br /&gt;Profiling finished.       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;&lt;font size="4"&gt;PRF0025: No data was collected. &lt;/font&gt;&lt;/strong&gt;        &lt;br /&gt;Profiling complete. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;There could be number of reasons for that. &lt;/p&gt;  &lt;p&gt;The first question I will ask: “Is your application CPU bound?”. If your process doesn’t use CPU intensively enough during the profiling session (it waits on IO instead, for example), than the process becomes “invisible” for default profiler sampling (as events that trigger a sample happen when &lt;em&gt;other&lt;/em&gt; applications are running – see my previous &lt;a href="http://blogs.msdn.com/mgoldin/archive/2005/08/05/total-application-kernel-overhead-other-samples-what-are-they-all-about.aspx"&gt;post&lt;/a&gt; explaining different samples and what they mean). If you use advanced sampling, configuring some specific CPU Performance Counter (through either /COUNTER command line option, or using Visual Studio UI) – for example, L2 Cache Misses – then again, if your application doesn’t generate samples of &lt;em&gt;that specific event&lt;/em&gt;, no data will be collected. In those cases you may try to switch to Instrumentation mode.&lt;/p&gt;  &lt;p&gt;If, however, you are sure your application is CPU bound as you see CPU spikes during its execution, yet Visual Studio claims “no data was collected” – please look into Properties of the collected file (you can get it by pressing F4). In some rare cases you will see all collected Samples are set to 0. Which means no sample was collected at all (normally, even if your application is not CPU bound – samples &lt;em&gt;are&lt;/em&gt; collected, but they belong either to kernel mode, or other applications; Total number of samples equal to 0 is something really strange). The question I will ask in this case is: “Did you use any other diagnostic tool recently? Especially those, that are not developed by Microsoft?” And if you answer “Yes”, please reboot your machine and try again. The reason is that some tools may leave your machine hardware in a state that breaks functionality of Visual Studio profiler. Reboot will fix it for you.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/PRF0025Nodatawascollectedwhyisthat_9A69/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/PRF0025Nodatawascollectedwhyisthat_9A69/image_thumb_1.png" width="494" height="433" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9948739" width="1" height="1"&gt;</description></item><item><title>VS 2008 Profiler and Nehalem Intel Processor</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/14/vs-2008-profiler-and-nehalem-intel-processor.aspx</link><pubDate>Thu, 14 Jan 2010 19:07:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9948561</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9948561</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/14/vs-2008-profiler-and-nehalem-intel-processor.aspx#comments</comments><description>&lt;p&gt;When you run &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;amp;displaylang=en"&gt;VS 2008 SP1&lt;/a&gt; profiler on Intel &lt;a href="http://www.intel.com/technology/architecture-silicon/next-gen/" mce_href="http://www.intel.com/technology/architecture-silicon/next-gen/"&gt;Nehalem&lt;/a&gt; CPU based machine, you may experience crash of operating system (blue screen). &lt;/p&gt;  &lt;p&gt;This problem occurs because the sampling profiler uses a kernel mode driver in the operating system. However, the Intel Nehalem processor was created after the release of the 2008 version of the profiler, thus profiler could not be&lt;strong&gt; &lt;/strong&gt;completely compatible with the Nehalem processor before the release. There is a hot fix for this problem – &lt;a href="http://support.microsoft.com/kb/958842" mce_href="http://support.microsoft.com/kb/958842"&gt;KB958842&lt;/a&gt; – which you need to install to resolve the problem. &lt;/p&gt;  &lt;p&gt;On some versions of Nehalem family there is no blue screen experience, rather profiler doesn’t seem to work. For example: &lt;/p&gt; &lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;   &lt;p style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;&lt;/span&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;Error VSP1336 : Could not attach to process ID:1234 notepad.exe. The profiler was unable to start sampling with the specified configuration.&lt;/span&gt;&lt;span style="color: black; mso-ansi-language: pt-br" lang="PT-BR"&gt; &lt;/span&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;/p&gt;   &lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;&lt;font color="#000000" size="2" face="Arial"&gt;&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;/span&gt;   &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;&lt;font color="#000000" size="2" face="Arial"&gt;Or:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;&lt;font color="#000000" size="2" face="Arial"&gt;&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;Error VSP1398 : The monitor was unable to start the VS performance driver.&amp;#160; The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. Consider using the /Admin:Driver,Start and /Admin:Security options of VSPerfCmd from an elevated environment.&amp;#160; Profiling cannot continue. &lt;/span&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;Error VSP1341 : Could not start logging engine.&amp;#160; Shutting down. &lt;/span&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #1f497d; font-size: 11pt"&gt;Error VSP1394 : Could not start profile monitor &lt;/span&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The reason of the problem is the same, and the &lt;a href="http://support.microsoft.com/kb/958842" mce_href="http://support.microsoft.com/kb/958842"&gt;KB958842&lt;/a&gt; is the remedy for this case as well. &lt;/p&gt;  &lt;p&gt;Needless to say, the problem is taken care of in new version of profiler that is released in &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" mce_href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;Visual Studio 2010&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9948561" width="1" height="1"&gt;</description></item><item><title>Visual Studio Profiler in Virtual Environment</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/14/visual-studio-profiler-in-virtual-environment.aspx</link><pubDate>Thu, 14 Jan 2010 19:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9948560</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9948560</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/14/visual-studio-profiler-in-virtual-environment.aspx#comments</comments><description>&lt;p&gt;&lt;font size="2"&gt;Visual Studio profiler usage on virtual machines was limited so far, as it didn’t support Sampling mode in such environment. I’m glad to note that in Visual Studio 2010 you can sample your applications inside of virtual machines. VMs could be created using either VPC, VMWare of Hyper-V technologies. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Some hardware is not virtualized, though, and CPU performance counters (that are used by profiler) are, unfortunately, in the list. To overcome the issue, we used a different approach that targets each VM-vendor specifically, and timers that are used in virtual world are not the same as on a raw hardware. Some functionality, however, suffers from lack of CPU performance counters virtualization. Thus, you obviously cannot explicitly sample with those counters (instead of default one), and an attempt to do so will result in an error message:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Error VSP1478: Performance counters are not supported on virtual machines.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;So, you cannot sample with &lt;em&gt;Instructions Retired&lt;/em&gt;, &lt;em&gt;L2 Cache Misses&lt;/em&gt;, &lt;em&gt;Branch Mispredictions&lt;/em&gt; and other fancy counters provided by HW vendors.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Instrumentation mode of profiler inside of VM has some limitation as well. Explicit usage of CPU performance counters (through /COUNTER option of VSPerfMon.exe or VSPerfCmd.exe command line tools, or through Visual Studio UI) results in the same error. Default usage of Instrumentation will warn you that a difference between Elapsed (user mode + kernel mode) and Application (user mode) times for each function will not be detected:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Warning VSP2317: The monitor was unable to acquire a hardware performance counter for detection of kernel mode execution. Elapsed and Application time will be the same.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;But apart from this difference, Instrumentation mode works just fine.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;One word of caution. You may be confused to see those errors/warning about non supported performance counters on a &lt;em&gt;real&lt;/em&gt;, non-virtual machine. It could happen if your machine has CPU virtual technology enabled in BIOS, and a hypervisor role is added to operating system (&lt;a href="http://www.microsoft.com/windowsserver2008/en/us/hyperv-main.aspx" mce_href="http://www.microsoft.com/windowsserver2008/en/us/hyperv-main.aspx"&gt;Hyper-V&lt;/a&gt;, for example). In this case, your operating system runs on top of hypervisor and, in fact, becomes virtual (even when you logged in to a real machine, and didn’t create any virtual machine there). So, if that happens and you want to use CPU performance counters – all you need to do is to remove hypervisor role in your OS and disable virtual technology in BIOS. After that you can use profiler as usual.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/mgoldin/"&gt;Maxim Goldin&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9948560" width="1" height="1"&gt;</description></item><item><title>How to Profile NUnit tests using the Visual Studio 2010 Profiler</title><link>http://blogs.msdn.com/b/profiler/archive/2010/01/08/how-to-profile-nunit-tests-using-the-visual-studio-2010-profiler.aspx</link><pubDate>Fri, 08 Jan 2010 19:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9945879</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9945879</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2010/01/08/how-to-profile-nunit-tests-using-the-visual-studio-2010-profiler.aspx#comments</comments><description>&lt;p align="justify"&gt;Profiling NUnit tests can be achieved in a few simple steps. The first step, of course, is to decide on which method of profiling is best suited to analyze the performance of your unit test. One of my earlier posts addresses this question, which you can find &lt;a href="http://blogs.msdn.com/dalaqab/archive/2009/12/22/q-which-profiling-mode-should-i-use.aspx"&gt;here&lt;/a&gt;. In this post, I will use “CPU Sampling” to illustrate the steps necessary to profile NUnit tests. In a future post (hopefully in not so distant future), I will put together a similar post for using the “instrumentation” method.&lt;/p&gt;  &lt;h4&gt;One Item to Note Before You Start&lt;/h4&gt;  &lt;p align="justify"&gt;NUnit has a built in feature called “Shadow Copy”, which [as it appears on the surface] moves the test and application binaries to a temporary location before running the tests, and removes those DLLs from the temporary location when it is terminated. Depending on how your test and application’s binaries are setup to interact with one another, the Profiler may not be able to accurately locate the correct binary during its analysis stage and would not be able accurately tie back the collected performance data to source code. Therefore, you may want to consider disabling shadow copy when profiling NUnit tests. In NUnit, you will find this option under Tools -&amp;gt; Settings.&lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_3.png" width="711" height="476" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 1 - Disabling Shadow copy in NUnit&lt;/em&gt;&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;h4&gt;Profiling NUnit Tests in “CPU Sampling” Mode&lt;/h4&gt;  &lt;p align="justify"&gt;The first step to analyze the performance of any binary is to create a performance session. The easiest way to create a performance session is to use the &lt;a href="http://blogs.msdn.com/profiler/archive/2009/12/29/using-the-keyboard-to-profile-an-application-alt-f2-shortcut.aspx"&gt;Alt-F2 shortcut&lt;/a&gt; to launch the wizard. Alternatively, you can launch the performance wizard from the “Analyze” menu.&lt;/p&gt;  &lt;p align="justify"&gt;On the first page of the wizard, choose “CPU Sampling” and then click “Next”&lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_4.png" width="651" height="735" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 2 - Select CPU Sampling on Performance Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;On the second page of the wizard, select “An Executable (EXE File)”, and then click “Next”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_5.png" width="653" height="734" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 3 - Select &amp;quot;An Executable&amp;quot; on Performance Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="justify"&gt;On the third page of the wizard, you will see 3 text boxes. Since we are profiling NUnit tests (which are DLLs) we need to tell the profiler which executable should be used to run the desired NUnit tests. Therefore the first piece of information we need to provide profiler where to find NUnit.EXE. &lt;/p&gt;  &lt;p align="justify"&gt;Then we should have the profiler, tell NUnit.EXE how to find the test DLL, by providing a path to the test DLL on the “Command-Line Arguments” text box. Finally, we should make sure that the working directory is set correctly and that NUnit can locate all the binaries it needs. Once the information is provided, click “Next”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_6.png" width="652" height="737" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 4 - Tell Profiler which application to Launch on Performance Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;On the last step of wizard, keep the “Launch profiling after wizard finished” check box checked, and click finish.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_7.png" width="655" height="732" /&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 5 - Last page of the Performance Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Once NUnit is launched, run the tests as you normally do. When finished, close NUnit.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_8.png" width="845" height="395" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 6 - Run your tests using NUnit GUI application&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The Profiler will then analyze the data it has gathered and will display the performance report.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/HowtoProfileNUnittestsusingVisualStudio2_10297/image_thumb_9.png" width="567" height="484" /&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 7 - Profiler Report&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/dalaqab" target="_blank"&gt;Daryush Laqab&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9945879" width="1" height="1"&gt;</description></item><item><title>VS2010: New Profiler Summary Page</title><link>http://blogs.msdn.com/b/profiler/archive/2009/12/31/vs2010-new-profiler-summary-page.aspx</link><pubDate>Thu, 31 Dec 2009 22:28:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942711</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9942711</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2009/12/31/vs2010-new-profiler-summary-page.aspx#comments</comments><description>&lt;p&gt;With Visual Studio 2010 we want to make it easier for customers to find and fix performance issues with their code. One of the first things we looked at was the view that shows up after profiling an application – the Summary Page.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;I’ll describe a few features of the new summary page using the PeopleTrax application, which you can &lt;a href="http://code.msdn.microsoft.com/VSTS2010B1PeopleTrax"&gt;download from CodeBox&lt;/a&gt;. I won’t describe collecting the profiling data since this is already &lt;a href="http://msdn.microsoft.com/en-us/library/ms182398(VS.100).aspx"&gt;covered on MSDN&lt;/a&gt;. The summary page for a sample profiling run is shown below.&lt;/p&gt;  &lt;p align="left"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/summary_sampling_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="summary_sampling" border="0" alt="summary_sampling" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/summary_sampling_thumb.png" width="800" height="628" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’ll describe the individual pieces of the report below:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The header shows the type of data collected (Sample, Instrumentation, etc.) and also how many samples were collected.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__header_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling__header" border="0" alt="sampling__header" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__header_thumb.png" width="226" height="50" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;The hot path is shown right on the front page.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__hotpath_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling hotpath" border="0" alt="sampling hotpath" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__hotpath_thumb.png" width="702" height="170" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;We can see straight away that the ReadLine() function is an interesting function to look at. Clicking on the hyperlink will take you directly to the Function Details page. There are also related views links to navigate directly to the ‘Call Tree’ and ‘Functions’ views.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Functions that are doing the most individual work (have the highest Exclusive Samples) are listed with visual ‘sparklines’ (bar charts) to indicate relative importance.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__exclusive_functions_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling exclusive functions" border="0" alt="sampling exclusive functions" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__exclusive_functions_thumb.png" width="702" height="155" /&gt;&lt;/a&gt;       &lt;br /&gt;Clicking on the hyperlink for a function takes you directly to the Function Details page for that function.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Notifications that change based on the state of the report are shown in a new ‘Notifications’ area. In the example below, clicking Show All Code will reanalyze the report with Just My Code turned off. ‘View Guidance’ will bring up the Error List to display guidance from the new Rules and Guidance profiler feature.      &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__notifications_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; vertical-align: top; border-left-width: 0px; margin-right: 0px" title="sampling notifications" border="0" alt="sampling notifications" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__notifications_thumb.png" width="199" height="94" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Action links are shown in the ‘Report’ area and they do not depend on the state of the report. One useful link we added is ‘Toggle Full Screen’ which shows the report in full-screen mode.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__actions_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="sampling actions" border="0" alt="sampling actions" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__actions_thumb.png" width="201" height="234" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;A chart of CPU usage (for sampling, although we also show contention data in Concurrency mode) enables filtering of the report data. Highlight a region on the chart and choose ‘Filter by selection’ to show data from only that period of time. For example, with the chart below it may be useful to filter between 16 and 24 seconds.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__chart_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling chart" border="0" alt="sampling chart" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__chart_thumb.png" width="702" height="237" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;At the top of the report above the header, we still have the profiler toolbar which is useful for navigating (see the left and right arrows and also the dropdown for jumping between views) and for executing some of the actions that are also listed on the Summary Page.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__toolbar_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling toolbar" border="0" alt="sampling toolbar" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__toolbar_thumb.png" width="567" height="25" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Hopefully these new features on the front page will make it quicker and easier than ever to diagnose your performance issues.&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9942711" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/profiler/">profiler</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>Using the keyboard to profile an application (Alt-F2 shortcut)</title><link>http://blogs.msdn.com/b/profiler/archive/2009/12/29/using-the-keyboard-to-profile-an-application-alt-f2-shortcut.aspx</link><pubDate>Tue, 29 Dec 2009 22:26:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942084</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9942084</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2009/12/29/using-the-keyboard-to-profile-an-application-alt-f2-shortcut.aspx#comments</comments><description>&lt;p&gt;In announcing Visual Studio Beta 2 profiler features, Chris &lt;a href="http://blogs.msdn.com/profiler/archive/2009/10/22/visual-studio-2010-beta-2-available-now.aspx"&gt;mentioned&lt;/a&gt; that we have a new option on the Debug menu called ‘Start Performance Analysis’ which has the Alt-F2 keyboard shortcut. This makes it easier than ever to start profiling your application. The new menu item has the following behavior:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You must have a Visual Studio Solution open in order to enable it. &lt;/li&gt;    &lt;li&gt;If you have a solution open, but do not have a launchable current performance session, Start Performance Analysis launches the Performance Wizard. &lt;/li&gt;    &lt;li&gt;If you have a solution open and have a launchable current performance session, Start Performance Analysis starts profiling. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Let’s use this new functionality to profile an application that I have prepared earlier.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open the solution with ‘Alt-F, J, Enter’:      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/1_open_project_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1_open_project" border="0" alt="1_open_project" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/1_open_project_thumb_1.png" width="642" height="369" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Start Performance Analysis with ‘Alt-F2’, which brings up the wizard:      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/2_alt-f2_wizard_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2_alt-f2_wizard" border="0" alt="2_alt-f2_wizard" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/2_alt-f2_wizard_thumb.png" width="560" height="480" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&amp;#160; Press ‘Enter’ to choose the default ‘CPU Sampling’ profiling method and move to the target selection page:      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/3_enter_next_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3_enter_next" border="0" alt="3_enter_next" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/3_enter_next_thumb.png" width="560" height="480" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Press ‘Enter’ to select the only launchable project in the solution and move to final wizard page:      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/4_enter_finish_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="4_enter_finish" border="0" alt="4_enter_finish" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/4_enter_finish_thumb.png" width="560" height="480" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Press ‘Enter’ to finish the wizard and start profiling:      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/5_profiling_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="5_profiling" border="0" alt="5_profiling" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/5_profiling_thumb.png" width="640" height="311" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;The report will open when profiling finishes:      &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/6_report_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="6_report" border="0" alt="6_report" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/Usingthekeyboardtoprofileanapplication_9BB8/6_report_thumb.png" width="600" height="503" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;If you wish to profile again, selecting Alt-F2 will start profiling with the Performance Session that was created after step #4.&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9942084" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/profiler/">profiler</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/visual+studio/">visual studio</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item><item><title>Multi-Tier Performance Analysis</title><link>http://blogs.msdn.com/b/profiler/archive/2009/12/28/multi-tier-performance-analysis.aspx</link><pubDate>Mon, 28 Dec 2009 22:16:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9941742</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9941742</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2009/12/28/multi-tier-performance-analysis.aspx#comments</comments><description>&lt;p align="justify"&gt;Think of a typical three-tier application; the one that has, let’s say, an ASP.NET UI, a business logic layer, and a data access layer which talks to a SQL Server instance. Ever wondered which queries are executed as a result of serving a page? Ever wondered how long it takes to execute those queries? Ever wondered which one of those queries is the one taking the most time and slowing down your application? &lt;/p&gt;  &lt;p align="justify"&gt;Let me introduce you to Tier Interaction Profiling, the first Multi-Tier Performance Analysis feature in Visual Studio. Tier Interaction Profiling enables you to measure the performance of your application from a database interactions point of view. Let’s take a look at a screenshot:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image002_thumb.jpg" width="784" height="486" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 1 - Tier Interaction Profiling Report&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Tier Interaction Profiling (TIP) report follows a master-detail approach. Sections 1, 2, and 3 are in the master section, while sections 4 and 5 are in the details sections. These sections are:&lt;/p&gt;  &lt;p align="justify"&gt;1. This section looks a little different depending on whether your application is an ASP.NET application or a Windows application. If you are profiling a windows application, you will see the name of the EXE. On the other hand, if your application is an ASP.NET application, TIP will show you each page (and other artifacts like JPG or CSS content) requested during your profiling session.&lt;/p&gt;  &lt;p align="justify"&gt;2. If any web page (or Windows application if you are profiling a Windows application) makes use of a database connection (either directly or through an intermediary layer), TIP will display information about that connection. TIP groups the data about connections by connection string. For each connection, TIP will also show you the sum of the queries executed during the requests made to the web page (or Windows application) along with its total execution time. Once you select a connection, TIP will show you details about queries executed via that connection (see sections 4 and 5 below).&lt;/p&gt;  &lt;p align="justify"&gt;3. For each web page, TIP will show the number of times the page was request along with Total, Minimum, Maximum, and Average time spent on processing the request s. &lt;/p&gt;  &lt;p align="justify"&gt;4. For each connection selected in the master section, TIP will show the queries executed. As the connections (in section 2) are grouped by web page request (or Windows application run), you are in effect looking at the queries executed as a result of making that web page request. TIP shows you the actual command text of the query. If you are using stored procedures, TIP will report the stored procedure name. If you are using LINQ, TIP will show the SQL generated for the LINQ query. &lt;/p&gt;  &lt;p align="justify"&gt;5. For each query, TIP displays the number of times the query was executed along with Total, Minimum, maximum, and average time spent executing that query. Similar to section 4 and as the connections are grouped by web page request (or Windows application run), you are in effect looking at performance information for a given query (or stored procedure) as a result of execution of a web page.&lt;/p&gt;  &lt;p align="justify"&gt;Figure 2 below is a depiction of a typical 3-tier application. The green arrows indicate where TIP interjects itself to collect performance data points; the black arrows indicate places which TIP excludes from its performance data point collection:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image004_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image004_thumb.jpg" width="521" height="465" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 2 - TIP Data Point Collection Areas&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;Where do I find Tier Interaction Profiling&lt;/h3&gt;  &lt;p align="justify"&gt;There are two ways in which you enable TIP for your profiling session. First, when creating a performance session for a web application through the performance wizard, you can enable TIP by selecting it as an option for your performance session:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image006_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image006_thumb.jpg" width="465" height="521" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 3 - Enabling TIP on Performance Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;The other way is to enable TIP for the entire performance session or any of the performance session targets. You will find the Tier Interaction Profiling session option in the session or target properties:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image008_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image008_thumb.jpg" width="450" height="383" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 4 - Enabling TIP on Performance Session Properties&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;You are now ready to profile your application. Once you have enabled TIP and you have run your application under profiler, you can access “Tier Interaction” report from the list of available reports:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image009_2.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image009" border="0" alt="clip_image009" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/MultiTierPerformanceAnalysis_C859/clip_image009_thumb.png" width="339" height="272" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;em&gt;Figure 5 - Where to find Tier Interaction report&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;Start using Tier Interaction Profiling&lt;/h3&gt;  &lt;p align="justify"&gt;Vast majority of 3-tier application performance bottlenecks are in how the application utilizes the database. Prior to VS 2010 Profiler, one needed to employ a large set of breakpoints, debugger traces, and SQL Traces to identify which query is being called the most and which query takes the longest to execute. With Tier Interaction Profiling in VS 2010 Profiler, you are merely a few clicks away from a report showing you the exact call count and timing information for each query executed in your application. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/dalaqab/" target="_blank"&gt;Daryush Laqab&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9941742" width="1" height="1"&gt;</description></item><item><title>Which Profiling Mode Should I use?</title><link>http://blogs.msdn.com/b/profiler/archive/2009/12/22/which-profiling-mode-should-i-use.aspx</link><pubDate>Wed, 23 Dec 2009 00:32:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9940316</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9940316</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2009/12/22/which-profiling-mode-should-i-use.aspx#comments</comments><description>&lt;h4&gt;Short Answer:&lt;/h4&gt;  &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;Profiling Mode&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;&lt;b&gt;When to use&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;CPU Sampling&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;Use this mode to identify methods that consume too much CPU. This mode has low overhead and is well suited for CPU bound applications.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;Instrumentation&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;Use this mode to get exact call count and exact time for each method. This mode is well suited for application that make large amount of external kernel calls (e.g. I/O and Network).&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;.NET Memory Allocation&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;Use this mode to identify methods that allocate too much memory.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;Concurrency – Resource Contention&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;Use this mode if you suspect your multi-threaded application is experiencing synchronization issues&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="302"&gt;         &lt;p&gt;&lt;b&gt;Concurrency – Concurrency Visualizer&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="497"&gt;         &lt;p&gt;Use this mode to get a comprehensive view of how your application is utilizing parallelism &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h4&gt;Longer Answer:&lt;/h4&gt;  &lt;p&gt;So you have an application that is not performing as you anticipated and you want to know what is going on. Naturally :) you go to Analyze menu and choose “Launch Performance Wizard…”. There comes the first page of the performance wizard asking you to decide on one of the four available profiling modes before letting you proceed to the next step:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image002_thumb.jpg" width="379" height="427" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;But which one is the right one for your application? The following is a brief description of what you can expect from each mode of profiling to help you better decide which profiling mode to choose.&lt;/p&gt;  &lt;h4&gt;CPU Sampling&lt;/h4&gt;  &lt;p&gt;Sampling is a basic, yet powerful mode of profiling that can identify which method in your application are using too much CPU. Sampling has a very low overhead, but it is amazingly powerful in spotting performance issues. You can expect profiler to report a relative measure of how much work each method performed individually. You can also expect to see a relative measure of how much work each method caused other methods to perform.&lt;/p&gt;  &lt;p&gt;The way these relative measures are gathered is through “Inclusive” and “Exclusive” samples. Take a look at the following picture:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image004_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image004_thumb.jpg" width="501" height="303" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When you profile your application in Sampling mode, profiler will examine the execution call stack at pre-defined intervals and collect samples. For each method on top of the call stack, it collects one “Exclusive” sample. For all methods on the call stack (including the method on the top), the profiler collects one “inclusive” sample. Once you done profiling the application, the profiler will tally up all the sample counts for each method. The methods with the most number of “Exclusive” samples are doing a lot of individual work (since they have been on the top of the call stack a lot). Methods with the most number of “Inclusive” samples are causing a lot of work to be done (since they have other methods above them on the call stack). &lt;/p&gt;  &lt;p&gt;Sample profiling mode is most suited for CPU bound applications, as it only collects samples when the application is using CPU. Therefore, you may not collect enough samples if your application often blocks on external kernel calls (e.g. blocks a lot on I/O or Network). That is where you would want to use Instrumentation profiling.&lt;/p&gt;  &lt;h4&gt;Instrumentation&lt;/h4&gt;  &lt;p&gt;Instrumentation mode will provide you with exact call counts and exact time your application spent executing each method, including the time a method was blocked on external kernel calls. In order for profiler to collect exact call counts and exact execution time for each method, it needs to insert probes into your code (e.g. Instrument your code). &lt;/p&gt;  &lt;p&gt;Here is how probe insertion works:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image006_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image006_thumb.jpg" width="587" height="491" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Using these inserted probes, profiler computes “Elapsed Time” and “Application Time” for each method. Elapsed time is the time spent inside a method, whether that method is executing instructions or is blocked on external calls. Application time, on the other hand, is the amount of time a method spent doing individual work and was not blocked.&lt;/p&gt;  &lt;p&gt;During the instrumentation process, each method is enclosed by a set of “METHOD_ENTER” and “METHOD_EXIT” probes. Then, each&amp;#160; call that leaves the current assembly is wrapped by a set of “CALL_ENTER” and “CALL_EXIT” probes. Profiler will then counts the number of “METHOD_ENTER” and “METHOD_EXIT” probe hits to identify the exact call counts for each method. Profiler will then use the time spent between the probes to calculate Application and Elapsed time (I am skipping over a lot of details here that deserves its own post). &lt;/p&gt;  &lt;p&gt;So far, we have only been concerned with “Time” as a measure of performance. Obviously, time is not the only resource an application uses. Memory is another one. Profiler can help you identify how much memory your managed application is using. That brings us to the third profiling mode.&lt;/p&gt;  &lt;h4&gt;.NET Memory Allocation (Sampling)&lt;/h4&gt;  &lt;p&gt;.NET Memory Allocation mode uses the same approach as Sample Profiling mode, but instead of collecting samples at pre-defined intervals, profiler collects samples anytime an object is allocated. When an object is allocated, profiler will capture the type and size of the objects allocated. You can expect profiler to identify the methods that have allocated most amount of memory, as well as types with the most amount of memory and most amount of instances during the profiling session.&lt;/p&gt;  &lt;p&gt;In addition to collecting object allocation data, profiler can also capture object lifetime information. More on object lifetime will follow below in the “Switching between different modes” section.&lt;/p&gt;  &lt;h4&gt;Concurrency&lt;/h4&gt;  &lt;p&gt;In Multithreaded applications, synchronization objects are used to control the “rhythm” of the application. However, how these synchronization objects are used and how the threads are organized and executed can vastly impact how your application performs. Concurrency profiling will provide you the information you need to analyze how well your application is utilizing synchronization objects and how well your application is taking advantage of parallelism. &lt;/p&gt;  &lt;p&gt;When selecting concurrency mode, you must decide on at least one of the two collection methods:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image008_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image008_thumb.jpg" width="409" height="183" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The first option is Resource Contention mode. Resource contention mode is a low overhead method of concurrency profiling which (similar to CPU Sampling and .NET Memory Allocation Sampling) collect inclusive and exclusive samples of methods on the stack anytime a thread blocks on a locked synchronization object. When selecting Resource Contention profiling, you can expect profiler to report the list of most contented synchronization resources as well as the threads which had the most number of resource contentions. &lt;/p&gt;  &lt;p&gt;The second option, concurrency visualizer, is a comprehensive view of how well an application is using parallelism. When selecting concurrency visualizer, you can expect profiler to report on the activities of threads during the profiling session as well as how well CPU and each core on the CPU was utilized. I encourage you to check out the &lt;a href="http://blogs.msdn.com/visualizeparallel/default.aspx"&gt;concurrency visualizer blog&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Switching between different modes&lt;/h4&gt;  &lt;p&gt;Up to this point, we have focused on the first page of the Performance Wizard. Performance wizard walks you through the steps necessary to create a performance session. You can, however, change the profiling mode after a session is created. Profiling mode is found on the “General” tab of performance session properties:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image009_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image009" border="0" alt="clip_image009" src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/WhichProfilingModeShouldIuse_DE63/clip_image009_thumb.png" width="814" height="468" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It is via the General tab that you can enable .NET Object Lifetime collection or add .NET Memory Allocation and .NET Object Lifetime collection to instrumentation mode.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blogs.msdn.com/dalaqab"&gt;Daryush Laqab&lt;/a&gt;]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9940316" width="1" height="1"&gt;</description></item><item><title>VS2010: Attaching the Profiler to a Managed Application</title><link>http://blogs.msdn.com/b/profiler/archive/2009/12/07/vs2010-attaching-the-profiler-to-a-managed-application.aspx</link><pubDate>Mon, 07 Dec 2009 19:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9933655</guid><dc:creator>profiler1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/profiler/rsscomments.aspx?WeblogPostID=9933655</wfw:commentRss><comments>http://blogs.msdn.com/b/profiler/archive/2009/12/07/vs2010-attaching-the-profiler-to-a-managed-application.aspx#comments</comments><description>&lt;P&gt;Before Visual Studio 2010, in order to attach the profiler to a managed application, certain environment variables had to be set using vsperfclrenv.cmd. An example profiling session might look like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;vsperfclrenv /sampleon &lt;/LI&gt;
&lt;LI&gt;[Start managed application from the same command window] &lt;/LI&gt;
&lt;LI&gt;vsperfcmd /start:sample /output:myapp.vsp /attach:[pid] &lt;/LI&gt;
&lt;LI&gt;[Close application] &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If the environment variables were not correctly set, when attempting to attach you would see this message: &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_warning_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_warning_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=old_attach_warning border=0 alt=old_attach_warning src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_warning_thumb.png" width=560 height=312 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_warning_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;EM&gt;The profiling environment for ConsoleApplication2 is not set up correctly. Use vsperfclrenv.cmd to setup environment variables. Continue anyway?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The generated report would typically look something like the report below. The warning at the bottom of the page indicates the problem and the report itself would typically not be useful since no managed modules or functions would be resolved correctly.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_badreport_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_badreport_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=old_attach_badreport border=0 alt=old_attach_badreport src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_badreport_thumb.png" width=642 height=437 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/old_attach_badreport_thumb.png"&gt;&lt;/A&gt;&lt;EM&gt;&amp;nbsp; Report with 'CLRStubOrUnknownAddress and Unknown Frame(s) and the warning ‘It appears that the file was collected without properly setting the environment variables with VSPerfCLREnv.cmd. Symbols for managed binaries may not resolve’.&lt;/EM&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Fortunately the Common Language Runtime (CLR) team provided us with a new capability to attach to an already running managed application without setting any environment variables. For more detailed information take a look at &lt;A href="http://blogs.msdn.com/davbr/archive/2009/11/04/clr-v4-profiler-attach-basics-with-sample-code.aspx" mce_href="http://blogs.msdn.com/davbr/archive/2009/11/04/clr-v4-profiler-attach-basics-with-sample-code.aspx"&gt;David Broman’s post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Caveats:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;We only support attach without environment variables for basic sampling. It will not work for Allocation or Object Lifetime data collection and Instrumentation attach is not possible. Concurrency (resource contention) attach is supported. &lt;/LI&gt;
&lt;LI&gt;The new attach mechanism only works for CLR V4-based runtimes. &lt;/LI&gt;
&lt;LI&gt;The new attach mechanism will work if your application has multiple runtimes (i.e. V2 and V4&amp;nbsp; SxS), but as noted above, you can only attach to the V4 runtime. I’ll write another post about the profiler and Side by Side (SxS). &lt;/LI&gt;
&lt;LI&gt;The old environment-variable-based attach still works, so you can still use that if you prefer. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The new procedure for attaching the profiler to a managed application in Visual Studio 2010 goes like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Launch your app (if it isn’t already running) &lt;/LI&gt;
&lt;LI&gt;Attach to it, either from the command-line or from the UI. &lt;/LI&gt;
&lt;LI&gt;When you’re finished, detach or close the app to generate a report. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_report_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_report_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=new_attach_report border=0 alt=new_attach_report src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_report_thumb.png" width=616 height=482 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_report_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If you want to diagnose any issues with attach, the CLR V4 runtime provides diagnostic information via the Event Log (view with Event Viewer) and the profiler also displays information there:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_eventlog_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=new_attach_eventlog border=0 alt=new_attach_eventlog src="http://blogs.msdn.com/blogfiles/profiler/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_eventlog_thumb.png" width=644 height=229 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010AttachingtheProfilertoManagedAppli_DEA7/new_attach_eventlog_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;EM&gt;Event Log: ‘Loading profiler. Running CLR: v4.0.21202. Using ‘Profile First’ strategy’&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;There are two .NET Runtime messages regarding the attach, the first indicating that an attach was requested and the second that the attach succeeded. The VSPERF message describes which CLR is being profiled.&lt;/P&gt;
&lt;P&gt;[&lt;A href="http://blogs.msdn.com/colinth" mce_href="http://blogs.msdn.com/colinth"&gt;Colin Thomsen&lt;/A&gt;]&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9933655" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/profiler/archive/tags/profiler/">profiler</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/colin/">colin</category><category domain="http://blogs.msdn.com/b/profiler/archive/tags/vs2010/">vs2010</category></item></channel></rss>