[Mono-list] Does heapshot profiler work?

xplicit svg at ngs.ru
Mon Mar 26 12:03:55 UTC 2012


I try to use heapshot profiler, but it seems not working. 

I run as test the following program:

using System;
using System.Collections.Generic;
using System.Threading;

namespace heapshottest
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			List<string> testList = new List<string>();
			
			for (int i=0; i<500000; i++)
			{
				testList.Add("test");
				testList.Add("anotherTest");
				testList.RemoveAt(0);
				if (i % 100000 == 0)
				{
					//	Thread.Sleep(1000);
					Console.WriteLine("i={0}",i);
				}
			}
		}
	}
}

Then I run mono with heapshot profile:
*mono --profile=log:heapshot=2000ms,alloc ./heapshot-test.exe *

*mprof-report --reports=alloc,gc,heapshot --verbose output.mlpd*

Allocation summary
     Bytes      Count  Average Type name
   4195184         35   119862 System.String[]
     16824         14     1201 System.Byte[]
      9080         15      605 System.Char[]
      7560        224       33 System.String
      1392         87       16 System.MonoType
       856          8      107 System.Object[]
       400          2      200 System.Globalization.DateTimeFormatInfo
       336          2      168 System.Threading.InternalThread
       320          4       80 System.IO.FileStream
       304          2      152 System.Globalization.NumberFormatInfo
       256          1      256 System.TermInfoStrings[]
       240          2      120 System.Globalization.CultureInfo
       224         14       16 System.Int32
       216          9       24 System.Int32[]
       184          1      184 System.TermInfoDriver
       120          5       24 System.Text.StringBuilder
       112          2       56 System.IO.CStreamWriter
        88          1       88 System.AppDomainSetup
        80          2       40 System.Threading.Thread
        72          1       72 System.AppDomain
        64          1       64 System.IO.StreamReader.NullStreamReader
        64          8        8 System.Object
        64          1       64 System.IO.CStreamReader
        64          1       64 System.NumberFormatter
        64          2       32 System.IO.SynchronizedWriter
        64          1       64 System.Globalization.TextInfo
        56          1       56 System.IO.UnexceptionalStreamWriter
        56          1       56 System.OutOfMemoryException
        56          1       56 System.Console.InternalCancelHandler
        56          1       56 System.NullReferenceException
        56          1       56 System.StackOverflowException
        56          1       56 System.Text.UTF8Encoding
        56          1       56 System.IO.StreamWriter
        48          1       48 System.Text.ASCIIEncoding
        48          1       48 System.Runtime.Remoting.Contexts.Context
        48          3       16 System.Text.DecoderReplacementFallback
        40          1       40 System.Globalization.GregorianCalendar
        32          2       16 System.Text.EncoderReplacementFallback
        24          1       24 System.IO.TextWriter.NullTextWriter
        24          1       24 System.Text.UTF8Encoding.UTF8Decoder
        24          1       24 System.TermInfoReader
        24          1       24
System.Collections.Generic.List<System.String>
        16          1       16 System.IO.NullStream
        16          1       16 System.IO.TextReader.NullTextReader
        16          1       16
System.Security.Permissions.SecurityPermission
         8          1        8 System.Text.DecoderExceptionFallback
         8          1        8 System.Text.EncoderExceptionFallback
Total memory allocated: 4235000 bytes in 469 objects

GC summary
	GC resizes: 10
	Max heap size: 7790592
	Object moves: 0
	Gen0 collections: 6, max time: 3297us, total time: 6210us, average: 1035us

Heap shot summary

	Heap shot 0 at 0.000 secs: size: 0, object count: 0, class count: 0, roots:
0
	     Bytes      Count  Average Class name

	Heap shot 1 at 6.985 secs: size: 0, object count: 0, class count: 0, roots:
0
	     Bytes      Count  Average Class name

	Heap shot 2 at 26.243 secs: size: 0, object count: 0, class count: 0,
roots: 0
	     Bytes      Count  Average Class name


So there are two questions:
1. Why there are no data in the heapshot section?
2. Why is heaphost activated at 7th and 26th second instead of 2nd and 4th?

Am I miss something?

mono version 2.10.8.1
Checked on two OSes: 
Ubuntu 10.04 desktop (mono from badgerports)
Ubuntu 12.04 beta  desktop

--
View this message in context: http://mono.1490590.n4.nabble.com/Does-heapshot-profiler-work-tp4505554p4505554.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list