[Mono-devel-list] Profiler Idea

Ben Maurer bmaurer at users.sourceforge.net
Tue Jan 13 10:51:02 EST 2004

Hey guys,

Recently, while doing a profile, I saw the following lines:

>      433 KB System.String::ToCharArray(int,int)
>          433 KB      247 System.Char[]                                   
>   Callers (with count) that contribute at least for 1%:
>          247  100 % System.String::ToCharArray()
> ########################

Now, obviously, I have seen this method before. But for the first time
today, I reflected on how useless this data was. You get no idea *WHO*
is calling the method.

So, I was thinking `maybe we should make a list of common allocators
like that that are just called by other methods.' For example, in
Hashtable, you often get profiles like:

>      316 KB System.Collections.Hashtable::Rehash()
>          316 KB       29 .Slot[]                                         
>   Callers (with count) that contribute at least for 1%:
>           29  100 % System.Collections.Hashtable::PutImpl(object,object,bool)

However, it is hard to track down who is causing the rehashes because
not all calls to PutImpl cause a rehash.

So, I would like to propose the following set of changes:

      * All allocations from System.Collections that are in the mscorlib
        assembly shall be attributed to the first non-System.Collections
        caller. For example, in the case of Rehash() the attribution for
        the allocation shall go to the method which called the public
        interface for Hashtable.
      * For other select methods and classes, we shall apply a similar
        rule. For example, ToCharArray would be attributed to the method
        that called the 0 args overload.


-- ben

More information about the Mono-devel-list mailing list