CoolToolList.Add(CLRProfiler);
By rickvdbosch
- 3 minutes read - 436 words <LI class="MsoNormal">
<SPAN lang="EN-US">Which methods allocate which types of objects?</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">Which objects survive?</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">What is on the heap?</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">What keeps objects alive?</SPAN>
</LI></UL>
<br /> <LI class="MsoNormal">
<SPAN lang="EN-US">Additionally:</SPAN><br /> <UL type="circle">
<br />
<LI class="MsoNormal">
<SPAN lang="EN-US">The call graph feature lets you see who is calling whom how often.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">Which methods, classes, modules get pulled in by whom</SPAN>
</LI></UL>
<br /> <LI class="MsoNormal">
<SPAN lang="EN-US">The tool can profile applications, services, and ASP</SPAN><SPAN lang="EN-US">.NET</SPAN><SPAN lang="EN-US"> pages.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">The tool can control profiling:</SPAN><br /> <UL type="circle">
<br />
<LI class="MsoNormal">
<SPAN lang="EN-US">You can add comments that can also serve as time markers.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">You can turn allocation and call logging on or off.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">You can trigger a heap dump.</SPAN>
</LI></UL>
<br /> <LI class="MsoNormal">
<SPAN lang="EN-US">The log files produced are self-contained – you do not need to save symbol files and the like to later analyze the log file.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">There is also a command-line interface allowing log files to be produced in batch mode.</SPAN>
</LI></UL>
<br /> <P class="MsoNormal">
<SPAN lang="EN-US"><A name="_Toc54579204"><STRONG>Lowlights</STRONG></A></SPAN>
</P>
<br /> <UL type="disc">
<br />
<LI class="MsoNormal">
<SPAN lang="EN-US">CLRProfiler is an intrusive tool; seeing a 10 to 100x slowdown in the application being profiled is not unusual. Therefore, it is not the right tool to find out where time is spent – use other profilers for that.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">Log files can get huge. By default, every allocation and every call is logged, which can consume gigabytes of disk space. However, allocation and call logging can be turned on and off selectively either by the application or in the CLRProfiler UI.</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">CLRProfiler cannot “attach” to an application that is already running.</SPAN>
</LI></UL>
<br /> <P class="MsoNormal">
<SPAN lang="EN-US"></SPAN><SPAN lang="EN-US"><A name="_Toc54579205"><SPAN lang="EN-US"><STRONG>Internals overview</STRONG></SPAN></A><SPAN lang="EN-US"></SPAN></P><br />
<UL type="disc">
<br />
<LI class="MsoNormal">
<SPAN lang="EN-US">The tool uses the public profiling interfaces that the CLR exposes. These work by loading a COM component that then gets called whenever a significant event happens – a method gets called, an object gets allocated, a garbage collection gets triggered, and so on. </SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">The COM component writes information about these events into a log file (such as “C:WINDOWSTemppipe_1636.log”).</SPAN><br /> <LI class="MsoNormal">
<SPAN lang="EN-US">The GUI (Windows Forms application) analyzes the log file and displays various views.</SPAN>
</LI></UL>
<br /> <P class="MsoNormal">
<SPAN lang="EN-US">I also found <A href="https://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030729CLRGN/manifest.xml">this video</A> about the CLRProfiler, but I haven't had time to watch it yet...</SPAN></SPAN>
</P></p>