<?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>All topics fundamental : etw</title><link>http://blogs.msdn.com/tvoellm/archive/tags/etw/default.aspx</link><description>Tags: etw</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Which is better a sample or instrumentation based profiler?</title><link>http://blogs.msdn.com/tvoellm/archive/2007/08/02/what-is-the-difference-between-sample-and-instrumentation-based-profilers.aspx</link><pubDate>Thu, 02 Aug 2007 21:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4191901</guid><dc:creator>tvoellm</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/tvoellm/comments/4191901.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tvoellm/commentrss.aspx?PostID=4191901</wfw:commentRss><description>&lt;P&gt;One of my passions is teaching performance and it is interesting to see students not realize the difference between instrumentation based profilers and sample based profilers.&amp;nbsp; In fact you might be wondering what the difference is now.&amp;nbsp; If you are keep reading.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;There are a couple of classes or profilers and instrumentation;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sample based - These are profilers that run without modifying the binaries they gather measurementation on.&amp;nbsp; Typically time (cpu cycles) are used to determine when to take a sample.&amp;nbsp; A sample can be a stack trace, current performance counters, or anything else for that matter.&amp;nbsp; Sampling can also be done on events other than time like system calls, L2 cache miss, ...&amp;nbsp; When the preset value of time expires or&amp;nbsp;the set number of&amp;nbsp;L2 cache misses happens a sample is taken.&lt;/P&gt;
&lt;P&gt;Instrumentation based profilers - These profilers will modify your binary typically around function entry / exit to gather call stacks.&amp;nbsp; Just like sample based profilers other information can be collected as well.&lt;/P&gt;
&lt;P&gt;Global - Refers to tools that look at the overall performance of systems like the OS + application.&lt;/P&gt;
&lt;P&gt;Code level -&amp;nbsp;Refers to profilers that just look at a particular application.&amp;nbsp; This is what is provided with Visual Studio Team Suite Profilers.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;When to use sample vs instrumenation based profilers:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sample&amp;nbsp;based - Good for CPU bound problems,&lt;/P&gt;
&lt;P&gt;Instrumentation based profilers - Good for I/O, idle wait, memory, ...&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Which tools exist&amp;nbsp;for Windows?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sample based profilers - Visual Studio Team Suite Profilers (aka F1), CLRProfiler, PerfMon, ETW (see logman.exe to control), ...&lt;/P&gt;
&lt;P&gt;Instrumentation based profilers - Visual Studio Team Suite Profilers (aka F1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;VTune from Intel and&amp;nbsp;AMD CodeAnalyst are also good&amp;nbsp;profilers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Word of caution...&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Before diving into Visual Studio Team Suite or other code level profilers you should really start with a gobal performance tool to make sure the problem is in your code.&amp;nbsp; All too often people spend days profiling their code to find the perfomance issue somewhere else in the system due to an unexpected interaction.&amp;nbsp; Try tools like Perfmon&amp;nbsp;and ETW (future post) first.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;So which is better?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I think the answer really depends on the type of performance issue you are trying to solve.&amp;nbsp; If most of your problems are with CPU then a sample based profiler is the way to go but you are unlikely to find an I/O issue.&lt;/P&gt;
&lt;P&gt;Happy perf hunting...&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Tony&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4191901" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tvoellm/archive/tags/etw/default.aspx">etw</category><category domain="http://blogs.msdn.com/tvoellm/archive/tags/tools/default.aspx">tools</category></item></channel></rss>