<?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>Angry Richard's WebLog : Profiling</title><link>http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx</link><description>Tags: Profiling</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Off-road Profiling Windows Services</title><link>http://blogs.msdn.com/angryrichard/archive/2005/07/28/444593.aspx</link><pubDate>Thu, 28 Jul 2005 22:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:444593</guid><dc:creator>AngryRichard</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/444593.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=444593</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Garamond&gt;I've just posted an article on the pitfalls of profiling services with the Visual Studio profiler.&amp;nbsp; It includes a sample service with a quick walkthrough.&amp;nbsp; Enjoy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a href="http://blogs.msdn.com/angryrichard/articles/Profiling_Windows_Services.aspx"&gt;&lt;FONT face=Garamond&gt;Profiling Windows™ Services with the Visual Studio Profiler&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=444593" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>Limiting the Data Crunch from Trace Profiling</title><link>http://blogs.msdn.com/angryrichard/archive/2005/01/16/354194.aspx</link><pubDate>Mon, 17 Jan 2005 03:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:354194</guid><dc:creator>AngryRichard</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/354194.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=354194</wfw:commentRss><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;Typically, one can use the sampling profiler to nail down the hot spot in an application.&amp;nbsp; Having done that, what does one do when the sampling data doesn't provide enough information?&amp;nbsp; The trace profiler can offer up more detail, particularly if the issue revolves around thread interaction.&amp;nbsp; However, if you profile a heavily CPU bound application, you may find that you are getting huge trace files, or that the profiler is significantly impacting the performance of your application.&amp;nbsp; The VisualStudio profiler offers a mechanism to stem the avalanche of data.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;I'll illustrate the general idea with an example.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Suppose we'd like to run trace profiling on the following highly useful piece of code.&amp;nbsp; We've decided that we only care about profiling in the context of the function "OnlyProfileThis()"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; &lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;using System;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;public class A&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;private int _x;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public A(int x)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;_x = x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public int DoNotProfileThis()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;return _x * _x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public int OnlyProfileThis()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;return _x + _x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public static void Main()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;A a;&lt;br /&gt;&amp;nbsp;&amp;nbsp;a = new A(2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Console.WriteLine("2 square is {0}", a.DoNotProfileThis());&lt;br /&gt;&amp;nbsp;&amp;nbsp;Console.WriteLine("2 doubled is {0}", a.OnlyProfileThis());&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; &lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;The VisualStudio profiler provides an API for controlling data collection from within the application.&amp;nbsp; For native code, this API lives in VSPerf.dll.&amp;nbsp; A header (VSPerf.h) and import library (VSPerf.lib) provided in the default Team Developer install allows us to use the profiler control API from native code.&amp;nbsp; For managed code, this API is wrapped by the DataCollection class in Microsoft.VisualStudio.Profiler.dll.&amp;nbsp; We can update the example to the following to control the profiler during our run:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; &lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;using System;&lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;using Microsoft.VisualStudio.Profiler;&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;public class A&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;private int _x;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public A(int x)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;_x = x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public int DoNotProfileThis()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;return _x * _x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public int OnlyProfileThis()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;return _x + _x;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;public static void Main()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;A a;&lt;br /&gt;&amp;nbsp;&amp;nbsp;a = new A(2);&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;int x;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Console.WriteLine("2 square is {0}", a.DoNotProfileThis());&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;DataCollection.StartProfile(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataCollection.ProfileLevel.DC_LEVEL_GLOBAL, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataCollection.PROFILE_CURRENTID);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;x = a.OnlyProfileThis();&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;DataCollection.StopProfile(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataCollection.ProfileLevel.DC_LEVEL_GLOBAL, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataCollection.PROFILE_CURRENTID);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;Console.WriteLine("2 doubled is {0}", x);&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; We still need to instrument the application as normal.&amp;nbsp; We also have one additional step.&amp;nbsp; When running the code above, data collection will be enabled by default, so the API won't appear to do anything beyond stopping data collection after the call to OnlyProfileThis.&amp;nbsp; We need to disable data collection before running the application.&amp;nbsp; The profiler control tool,&lt;br /&gt;VSPerfCmd, has options to do this.&lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;To run this scenario from the command line:&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;csc /debug- /r:Microsoft.VisualStudio.Profiler.dll Sample.cs&lt;br /&gt;VSInstr Sample.exe&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;VSPerfCmd /start:trace /output:SampleTrace.VSP&lt;br /&gt;VSPerfCmd /globaloff&lt;br /&gt;Sample.exe&lt;br /&gt;VSPerfCmd /shutdown&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;VSPerfReport /calltrace SampleTrace.VSP&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt; &lt;hr id="null" /&gt; &lt;font face="Arial" size="2"&gt;There are several control functions in the DataCollection class.&amp;nbsp; Here is a brief rundown.&lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;StartProfile(ProfileLevel level, UInt32 id)&lt;br /&gt;StopProfile(ProfileLevel level, UInt32 id)&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;This unconditionally starts or stops profiling.&amp;nbsp; The level parameter indicates whether profiling should be stopped for the current thread, process, or globally.&amp;nbsp; For thread and process level changes, the id specifies thread id or process id to control (respectively), or PROFILE_CURRENTID to control the current thread or process.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;SuspendProfile(ProfileLevel level, UInt32 id)&lt;br /&gt;ResumeProfile(ProfileLevel level, UInt32 id)&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;This works very much like StartProfile and StopProfile, however, calls to these functions are reference counted.&amp;nbsp; If you call SuspendProfile twice, you must call ResumeProfile twice to enable profiling.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p dir="ltr"&gt;&lt;font face="Arial" size="2"&gt;&lt;font face="Courier New"&gt;MarkProfile(Int32 markId)&lt;br /&gt;CommentMarkProfile(Int32 markId, String comment)&lt;br /&gt;CommentMarkAtProfile(Int64 timeStamp, Int32 markId, String comment)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p dir="ltr"&gt;&lt;font face="Arial" size="2"&gt;Inserts a 32-bit data value into the collection stream.&amp;nbsp; Optionally, you can include a comment.&amp;nbsp; With the last function, the mark can be inserted at a specific time stamp.&amp;nbsp; The id value and the optional comment will appear in the CallTrace report.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; The profiler control tool provides similar functionality through a command line interface, though the notion of a "current" process or thread id is obviously not relevant.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;VSPerfCmd /?&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;[...]&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-GLOBALON&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sets the global Start/Stop count to one (starts profiling).&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-GLOBALOFF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sets the global Start/Stop count to zero (stops profiling).&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-PROCESSON:pid&amp;nbsp; Sets the Start/Stop count to one for the given process.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-PROCESSOFF:pid Sets the Start/Stop count to zero for the given process.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-THREADON:tid&amp;nbsp;&amp;nbsp; Sets the Start/Stop count to one for the given thread.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Valid only in TRACE mode.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;-THREADOFF:tid&amp;nbsp; Sets the Start/Stop count to zero for the given thread.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Valid only in TRACE mode.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;font face="Courier New"&gt;-MARK:marknum[,marktext]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inserts a mark into the global event stream, with&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; optional text.&lt;br /&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;[...]&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt; &lt;hr id="null" /&gt; &lt;/font&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;If you find yourself buried under a ton of trace data, investigate the profiling API to help focus on the important parts of your application.&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=354194" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>Trying out the profiler on the VPC</title><link>http://blogs.msdn.com/angryrichard/archive/2004/08/06/210178.aspx</link><pubDate>Fri, 06 Aug 2004 21:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:210178</guid><dc:creator>AngryRichard</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/210178.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=210178</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've frequently heard the question asked, "Can I use the profiler on a Virtual PC?"&amp;nbsp; It has even come up on the blog feedback a few times.&amp;nbsp; My answer has always been, "Theoretically, yes."&amp;nbsp; I didn't want to post this answer externally until I'd actually gotten around to trying it myself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've finally been nagged into it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In my limited experience with our VirtualPC product, it has quite impressed me with its functionality.&amp;nbsp; However, it does not emulate the hardware performance counters upon which the profiler implicitly depends.&amp;nbsp; For this reason, you &lt;EM&gt;can not&lt;/EM&gt; run the sampling profiler using a performance counter based interrupt.&amp;nbsp; My collegue Ishai&amp;nbsp;pointed out&lt;SUP&gt;*&lt;/SUP&gt; that you should be able to use page-fault or system-call based sampling, but the VPC has a different problem with these modes that is still under investigation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Instrumentation based profiling &lt;EM&gt;will&lt;/EM&gt; work on the VPC.&amp;nbsp; However, as I've already mentioned, there is a bug check issue with the driver when it unloads.&amp;nbsp; Fortunately, instrumentation based profiling doesn't rely on the presence of the driver.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;By renaming the driver to prevent the profiling monitor from installing it at startup, I was able to use instrumentation based profiling on the VPC.&amp;nbsp; This is obviously just a workaround,&amp;nbsp; but I hope this will allow you to investigate some of our tools in the comfort of a VirtualPC environment.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Here is how you can prevent the driver from loading on your VPC installation.&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Use regedit to delete the key HKLM\CurrentControlSet\Services\VSPerfDrv.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Find C:\Program Files\Microsoft Visual Studio\Enterprise Developer Tools\Performance Tools\VSPerfDrv.sys, and rename&amp;nbsp;it to something silly like __VSPerfDrv.sys__, or delete it.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Reboot your VPC to ensure that the driver isn't installed&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Happy hunting!&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SUP&gt;*&amp;nbsp;&lt;/SUP&gt;&lt;FONT size=1&gt;I'm pretty sure Ishai was hired to point out things I do wrong.&amp;nbsp;&amp;nbsp;Fortunately, he usually points out solutions as well.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=210178" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>VPC and the BSOD (part 2)</title><link>http://blogs.msdn.com/angryrichard/archive/2004/06/03/148123.aspx</link><pubDate>Fri, 04 Jun 2004 03:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:148123</guid><dc:creator>AngryRichard</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/148123.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=148123</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I had a nice long email chat with members of the Virtual PC team.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The good news:&amp;nbsp; The Virtual PC emulates the host processor well enough that&amp;nbsp;our kernel-mode&amp;nbsp;driver can detect what features are enabled.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The bad news:&amp;nbsp; The Virtual PC does not emulate an APIC or performance counters.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So, if you were planning on running the profiler inside a Virtual PC, the best you can hope to do is get function trace data on an instrumented app.&amp;nbsp; Sampling will not work at all, and collecting perfomance counter data in the instrumentation will fault the application.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Bummer.&amp;nbsp; I wish I had better news.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=148123" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>VPC and the BSOD</title><link>http://blogs.msdn.com/angryrichard/archive/2004/06/01/146280.aspx</link><pubDate>Wed, 02 Jun 2004 03:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:146280</guid><dc:creator>AngryRichard</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/146280.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=146280</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I'm so pleased.&amp;nbsp; Someone did something exciting and dangerous with the profiler.&amp;nbsp; In case you're not reading the newsgroups, an intrepid customer tried to profile on a &lt;A href="http://www.microsoft.com/windowsxp/virtualpc/"&gt;Virtual PC&lt;/A&gt;, and discovered that it only leads to pain and misery via the BSOD.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So don't do that.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Seriously, is this something people want to do?&amp;nbsp; I mean, VPC is about &lt;EM&gt;the coolest thing ever&lt;/EM&gt;, but we do use hardware performance counters by default, and VPC is not exactly a real life environment for performance analysis and measurement.&amp;nbsp; Still, maybe y'all have good reasons for this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;At the very least, we'll fix that BSOD thing.&amp;nbsp; I mean, how 1990's is that?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This is an excellent time to point out that the profiler does in fact install a kernel-mode device driver in order to play with the hardware counters on your Intel and AMD processors.&amp;nbsp; There are some fun implications from this:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;You need to be running as a user who can &lt;EM&gt;install&lt;/EM&gt; a kernel-mode device driver.&amp;nbsp; We currently install the driver dynamically when starting the profiling monitor, and we uninstall it when the monitor shuts down.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The kernel-mode device driver is not &lt;A href="http://www.microsoft.com/whdc/winlogo/drvsign/digitsign.mspx"&gt;signed&lt;/A&gt;.&amp;nbsp; If you're one of those cheeky folks who has unsigned drivers shimmed through &lt;A href="http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q244/6/17.asp&amp;amp;NoWebContent=1"&gt;verifier&lt;/A&gt;, you may discover the joy of a &lt;EM&gt;forced&lt;/EM&gt; BSOD if you exercise the profiler in new interesting ways we hadn't thought of.&amp;nbsp; This is not all bad; just make sure you send us the &lt;A href="http://oca.microsoft.com/en/dcp20.asp"&gt;error report&lt;/A&gt; after you've rebooted.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;If you're running on Intel Pentium I&amp;nbsp;or&amp;nbsp;AMD K6* (or anything older), expect no love from the sampling based profiler, and some uphill battles with instrumentation.&amp;nbsp; I may post hints on this latter point if a few people speak up about legacy hardware.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=146280" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>C'mon, all your Friends are Doing it</title><link>http://blogs.msdn.com/angryrichard/archive/2004/05/27/143376.aspx</link><pubDate>Thu, 27 May 2004 22:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:143376</guid><dc:creator>AngryRichard</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/angryrichard/comments/143376.aspx</comments><wfw:commentRss>http://blogs.msdn.com/angryrichard/commentrss.aspx?PostID=143376</wfw:commentRss><description>&lt;P&gt;A bunch of the guys on the &lt;A href="http://blogs.msdn.com/profiler"&gt;team&lt;/A&gt; I work for have been starting up blogs.&amp;nbsp; I started feeling left out, &lt;BR&gt;which made me very angry.&lt;/P&gt;
&lt;P&gt;It appears all blogs start with "Hi, I'm a developer who does X and I'm going to talk about Y and maybe Z."&lt;BR&gt;It's all part of Microsoft's new image -- we're transparent now.&lt;/P&gt;
&lt;P&gt;Transparency's good, right?&lt;/P&gt;
&lt;P&gt;Go down to your local German car dealer, or, if you own a newer German car, go out to your driveway.&amp;nbsp; Shiny, pretty, isn't it?&amp;nbsp; Open the hood.&amp;nbsp; Look at that -- a big, fat, intake pipe that goes into a big box that says "BMW" in a 4" Century Gothic font.&amp;nbsp; Cool.&amp;nbsp; Now pop that plastic thing off the top.&amp;nbsp; Go ahead, I dare you.&amp;nbsp; Not so pretty now.&amp;nbsp; Look at all those wires and tubes.&amp;nbsp; Look at all that stuff you could cut yourself on.&amp;nbsp; That's why that plastic thing is there; it makes owning all that power a little less scary.&lt;/P&gt;
&lt;P&gt;Some of us spend all our time under the shiny plastic thing, hands full of wires and tubes and spark plugs.&amp;nbsp; That'd be me and some of my less 'transparent' friends, working on the instrumentation and data collection engine in the profiler.&lt;/P&gt;
&lt;P&gt;Of course, with great power, comes great potential for disaster.&amp;nbsp; Some day you'll have your turn with the profiler.&amp;nbsp; Trust me, something's always too slow.&amp;nbsp; If it works, great.&amp;nbsp; If you find yourself upside down in a ditch, tell us, we want to know where we need to cover up the sharp edges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=143376" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Profiling/default.aspx">Profiling</category><category domain="http://blogs.msdn.com/angryrichard/archive/tags/Useless+rants/default.aspx">Useless rants</category></item></channel></rss>