Added a new "runtime initialized" profiler hook.
authorMassimiliano Mantione <massi@mono-cvs.ximian.com>
Thu, 24 Jul 2008 08:18:22 +0000 (08:18 -0000)
committerMassimiliano Mantione <massi@mono-cvs.ximian.com>
Thu, 24 Jul 2008 08:18:22 +0000 (08:18 -0000)
svn path=/trunk/mono/; revision=108630

mono/metadata/ChangeLog
mono/metadata/profiler-private.h
mono/metadata/profiler.c
mono/metadata/profiler.h

index 8095504f5bf4126bbd3d153f7bfe0f5ad2cac592..cba70d340618f0943c9c8032c8d654d24e261eea 100644 (file)
@@ -1,3 +1,11 @@
+2008-07-24  Massimiliano Mantione  <massi@ximian.com>
+       * profiler.c: Added runtime_initialized_event,
+       mono_profiler_install_runtime_initialized and
+       mono_profiler_runtime_initialized. This new hook tells the profiler
+       when the runtime is sufficiently initialized to be able to call
+       mono_thread_attach on the root appdomain.
+       * profiler.h, profiler-private.h: Likewise.
+
 2008-07-23 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * verify.c (do_cast): Do boxing for generic arguments as well.
index 595ea923c6ed0fcd96909123c922170eab5629fe..f85da9bb219df4bb13685cd4ff268e2758a2f53f 100644 (file)
@@ -61,5 +61,7 @@ void                     mono_profiler_coverage_free  (MonoMethod *method) MONO_
 void mono_profiler_gc_event       (MonoGCEvent e, int generation) MONO_INTERNAL;
 void mono_profiler_gc_heap_resize (gint64 new_size) MONO_INTERNAL;
 
+void mono_profiler_runtime_initialized (void) MONO_INTERNAL;
+
 #endif /* __MONO_PROFILER_PRIVATE_H__ */
 
index 8323e3984cfcae0522a6c33690a0f7d3a77f1cee..54093343d81ad644b9dd20661b0963adf6690928 100644 (file)
@@ -78,6 +78,8 @@ static MonoProfileFunc shutdown_callback;
 static MonoProfileGCFunc        gc_event;
 static MonoProfileGCResizeFunc  gc_heap_resize;
 
+static MonoProfileFunc          runtime_initialized_event;
+
 #define mono_profiler_coverage_lock() EnterCriticalSection (&profiler_coverage_mutex)
 #define mono_profiler_coverage_unlock() LeaveCriticalSection (&profiler_coverage_mutex)
 static CRITICAL_SECTION profiler_coverage_mutex;
@@ -532,6 +534,19 @@ mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc he
        gc_heap_resize = heap_resize_callback;
 }
 
+void
+mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback)
+{
+       runtime_initialized_event = runtime_initialized_callback;
+}
+
+void
+mono_profiler_runtime_initialized (void) {
+       if (runtime_initialized_event)
+               runtime_initialized_event (current_profiler);
+}
+
+
 static GHashTable *coverage_hash = NULL;
 
 MonoProfileCoverageInfo* 
index fe323305be81c66d26788f4ee2c3002bd1853c4d..dafbb177f25b2b1d4f8f7c2e07acca9f77521fb3 100644 (file)
@@ -123,6 +123,7 @@ void mono_profiler_install_exception   (MonoProfileExceptionFunc throw_callback,
 void mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback);
 void mono_profiler_coverage_get  (MonoProfiler *prof, MonoMethod *method, MonoProfileCoverageFunc func);
 void mono_profiler_install_gc    (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);
+void mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback);
 
 void mono_profiler_load             (const char *desc);