LogDump: CLRProfiler Log analysis tool

Published 08 August 05 05:44 PM | ricom 

Ever wonder how I produce nice textual allocation summaries like this one?

This report shows allocations in dictread.log

Total Allocations 136301 Objects 6694232 Bytes

Top 10 Allocated Types

   Count    Bytes Type
  108040  5836392 System.String
   26726   534520 DictionaryEntry
      73   275604 System.Object []
    1010    20200 System.Text.StringBuilder
      51    10466 System.Char []
      11     6358 System.Byte []
      53     1272 System.Collections.ArrayList
      52     1248 ArrayListEnumeratorSimple
       6     1008 bucket []
      18      504 System.Security.SecurityElement

Top 10 Allocating Stacks

Stack 1 allocates 3132656 bytes
NS.Test::Main static void (String[])
Dictionary::.ctor void ()
DictionaryEntry::Parse static DictionaryEntry (String)
System.String::Substring String (int32 int32)
   80178  3132656 System.String

Stack 2 allocates 2402768 bytes
NS.Test::Main static void (String[])
Dictionary::.ctor void ()
System.IO.StreamReader::ReadLine String ()
   25723  2382668 System.String
    1005    20100 System.Text.StringBuilder

Stack 3 allocates 534520 bytes
NS.Test::Main static void (String[])
Dictionary::.ctor void ()
DictionaryEntry::Parse static DictionaryEntry (String)
   26726   534520 DictionaryEntry

That's a report similar to the one that I generated for Performance Quiz #6 -- I get a ton of mileage out of these.  Just use CLRProfiler for Beta2 or greater, save your .log files and run this little tool over it to get a summary of the total costs and their major sources.  This little guy saves me a ton of time and I've used it to anlayze multi-gigabyte log files where the UI approach just isn't going to work.  The algorithm is to just attribute each allocation to a callstack and then compute the callstacks with the biggest cost -- which is basically the same as going into the tree view in the UI and opening the biggest choice at each step, then 2nd biggest etc.

I've just posted the source code for this little dumper -- it's a quickie I wrote one afternoon and it shows -- but hopefully you can get some good usage out of it as well.

Legal Note: Like all other code samples this program is offered AS IS with no warranty implied and confers no rights.

Filed under: ,

Comments

# Rico Mariani's Performance Tidbits said on September 15, 2005 5:54 PM:
I was talking about memory management issues -- and diagnosis with simple tools today.  I promised...
# Sam Gentile's Blog said on September 16, 2005 12:06 PM:
# Sam Gentile::Longhorn said on September 17, 2005 4:07 PM:


New and Notable 79
I was in the middle of a beautifull New and Notable, 2nd day in a row no less...
# Sam Gentile::Longhorn said on September 17, 2005 4:13 PM:


I was in the middle of a beautifull New and Notable, 2nd day in a row no less when Windows Vista...
# Rico Mariani and some tips » Advanced .NET Debugging said on January 12, 2007 4:12 AM:

PingBack from http://dotnetdebug.net/2005/09/18/rico-mariani-and-some-tips/

New Comments to this post are disabled

Search

This Blog

Syndication

Page view tracker