<?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 : vs2010</title><link>http://blogs.msdn.com/profiler/archive/tags/vs2010/default.aspx</link><description>Tags: vs2010</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>VS2010: Attaching the Profiler to a Managed Application</title><link>http://blogs.msdn.com/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>profiler</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/profiler/comments/9933655.aspx</comments><wfw:commentRss>http://blogs.msdn.com/profiler/commentrss.aspx?PostID=9933655</wfw:commentRss><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/profiler/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/profiler/archive/tags/colin/default.aspx">colin</category><category domain="http://blogs.msdn.com/profiler/archive/tags/vs2010/default.aspx">vs2010</category></item><item><title>See The Profiler At PDC2008</title><link>http://blogs.msdn.com/profiler/archive/2008/10/27/see-the-profiler-at-pdc2008.aspx</link><pubDate>Mon, 27 Oct 2008 10:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9017688</guid><dc:creator>profiler</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/profiler/comments/9017688.aspx</comments><wfw:commentRss>http://blogs.msdn.com/profiler/commentrss.aspx?PostID=9017688</wfw:commentRss><description>&lt;P&gt;Steve Carroll, development lead for the Visual Studio Profiler, will be at &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com"&gt;PDC2008&lt;/A&gt; next week giving a presentation on the profiler:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;What: &lt;A href="http://channel9.msdn.com/pdc2008/TL24/" mce_href="http://channel9.msdn.com/pdc2008/TL24/"&gt;TL24: Improving .NET Application Performance and Scalability&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;When: Wednesday, October 29th, 1:15pm - 2:30pm &lt;/LI&gt;
&lt;LI&gt;Where: Room 153 &lt;/LI&gt;
&lt;LI&gt;Abstract: “Performance must be considered in each step of the development lifecycle. See how to integrate performance in design, development, testing, tuning, and production. Work with tools and technologies like: static analysis, managed memory profiling, data population, load testing, and performance reports. Learn best practices to avoid the performance pitfalls of poor CPU utilization, memory allocation bugs, and improper data sizing.” &lt;/LI&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;If you’re going to be there, it’d be worth checking out some of the new features we’ve been working on as well as seeing how the profiler and load testing tools in Visual Studio Team System can help you improve your software.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; The video of this session is now &lt;A class="" title="available online" href="http://channel9.msdn.com/pdc2008/TL24/" mce_href="http://channel9.msdn.com/pdc2008/TL24/"&gt;available online&lt;/A&gt;. It covers a bunch of new profiler features including Javascript profiling, contention profiling, 'hot lines' source code highlighting, summary page and other UI improvements, load-test integration and numerous other changes that will be shipping in Visual Studio 2010 (Team System).&lt;/P&gt;
&lt;P&gt;[&lt;A href="http://blogs.msdn.com/chrissc/" mce_href="http://blogs.msdn.com/chrissc/"&gt;Chris Schmich&lt;/A&gt;&amp;nbsp;&amp;amp; &lt;A class="" title="Colin Thomsen" 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=9017688" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/profiler/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/profiler/archive/tags/visual+studio/default.aspx">visual studio</category><category domain="http://blogs.msdn.com/profiler/archive/tags/vsts/default.aspx">vsts</category><category domain="http://blogs.msdn.com/profiler/archive/tags/vs2010/default.aspx">vs2010</category></item></channel></rss>