Welcome to MSDN Blogs Sign in | Join | Help

LogDump: CLRProfiler Log analysis tool

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.

Published Monday, August 08, 2005 5:44 PM by ricom
Filed under: ,

Comments

# My Second PDC05 talk

I was talking about memory management issues -- and diagnosis with simple tools today.  I promised...
Thursday, September 15, 2005 5:54 PM by Rico Mariani's Performance Tidbits

# New and Notable 79

Friday, September 16, 2005 12:06 PM by Sam Gentile's Blog

# New and Notable 79



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

# New and Notable 79



I was in the middle of a beautifull New and Notable, 2nd day in a row no less when Windows Vista...
Saturday, September 17, 2005 4:13 PM by Sam Gentile::Longhorn

# Rico Mariani and some tips » Advanced .NET Debugging

Friday, January 12, 2007 4:12 AM by Rico Mariani and some tips » Advanced .NET Debugging
New Comments to this post are disabled
 
Page view tracker