[Mono-bugs] [Bug 53010][Wis] New - Profiling + Threads gives bad results

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 17 Jan 2004 23:27:54 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=53010

--- shadow/53010	2004-01-17 23:27:54.000000000 -0500
+++ shadow/53010.tmp.24937	2004-01-17 23:27:54.000000000 -0500
@@ -0,0 +1,51 @@
+Bug#: 53010
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Profiling + Threads gives bad results
+
+Take the following example:
+using System;
+using System.Collections;
+using System.Threading;
+
+class Test {
+	static void Main ()
+	{
+		for (int i = 0; i < 1000; i ++) {
+			ArrayList foo = new ArrayList ();
+		}
+		
+		ThreadStart threadDelegate = new ThreadStart (DoWork);
+		Thread newThread = new Thread (threadDelegate);
+		newThread.Start ();
+	}
+	static void DoWork ()
+	{
+		for (int i = 0; i < 100; i ++) {
+			ArrayList foo = new ArrayList ();
+		}
+	}
+}
+
+--profile gives:
+
+########################
+      85 KB System.Collections.ArrayList::.ctor()
+          85 KB     1100 System.Object[]
+  Callers (with count) that contribute at least for 1%:
+         100  100 % .Test::DoWork()
+
+However, it was actually main that allocated the most arraylists!