[profiler] Split shutdown callback into early/late callbacks.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 24 Jun 2017 02:53:43 +0000 (04:53 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Thu, 6 Jul 2017 09:32:41 +0000 (11:32 +0200)
mono/metadata/profiler-events.h
mono/mini/debugger-agent.c
mono/mini/mini-runtime.c
mono/profiler/aot.c
mono/profiler/iomap.c
mono/profiler/log.c
mono/profiler/vtune.c

index 4f9ce6462c50aa032e7fae31fb892b0142e4186b..3c08d81d1369ddbdbc3374fde4ae273324cbbc43 100644 (file)
@@ -20,7 +20,8 @@
  */
 
 MONO_PROFILER_EVENT_0(runtime_initialized, RuntimeInitialized)
-MONO_PROFILER_EVENT_0(runtime_shutdown, RuntimeShutdown)
+MONO_PROFILER_EVENT_0(runtime_shutdown_begin, RuntimeShutdown)
+MONO_PROFILER_EVENT_0(runtime_shutdown_end, RuntimeShutdown)
 
 MONO_PROFILER_EVENT_1(context_loaded, ContextLoaded, MonoAppContext *, context)
 MONO_PROFILER_EVENT_1(context_unloaded, ContextUnloaded, MonoAppContext *, context)
index 96ef5e20ab2de107c067837e096b57178d2d9d83..acabbbdb0930d55a8b68d838005efc6ee6e145a1 100644 (file)
@@ -1000,7 +1000,7 @@ mono_debugger_agent_init (void)
        mono_coop_cond_init (&debugger_thread_exited_cond);
 
        MonoProfilerHandle prof = mono_profiler_install ((MonoProfiler*)&debugger_profiler);
-       mono_profiler_set_runtime_shutdown_callback (prof, runtime_shutdown);
+       mono_profiler_set_runtime_shutdown_end_callback (prof, runtime_shutdown);
        mono_profiler_set_runtime_initialized_callback (prof, runtime_initialized);
        mono_profiler_set_domain_loaded_callback (prof, appdomain_load);
        mono_profiler_set_domain_unloading_callback (prof, appdomain_start_unload);
index 0f3c217c65420bcbeb763ddaee76d6d812814784..8fb7949938748350cb7fd644f7a3b51c11c6009d 100644 (file)
@@ -4359,6 +4359,8 @@ mini_cleanup (MonoDomain *domain)
        if (mono_profiler_sampling_enabled ())
                mono_runtime_shutdown_stat_profiler ();
 
+       MONO_PROFILER_RAISE (runtime_shutdown_begin, ());
+
 #ifndef DISABLE_COM
        cominterop_release_all_rcws ();
 #endif
@@ -4380,7 +4382,7 @@ mini_cleanup (MonoDomain *domain)
 
        mono_threadpool_cleanup ();
 
-       MONO_PROFILER_RAISE (runtime_shutdown, ());
+       MONO_PROFILER_RAISE (runtime_shutdown_end, ());
 
        mono_profiler_cleanup ();
 
index 758f86eef1409bf7773d33f1bd1054b34645c815..d2b227d826c6263ba8eecf84487fb1087a18bce0 100644 (file)
@@ -168,7 +168,7 @@ mono_profiler_init (const char *desc)
        mono_os_mutex_init (&mutex);
 
        MonoProfilerHandle handle = mono_profiler_install (prof);
-       mono_profiler_set_runtime_shutdown_callback (handle, prof_shutdown);
+       mono_profiler_set_runtime_shutdown_end_callback (handle, prof_shutdown);
        mono_profiler_set_jit_done_callback (handle, prof_jit_leave);
 }
 
index 5297df369e38ea23a45c5379a8196023f819b8c2..89a30193179607755687a9ec8d57a672f061e855 100644 (file)
@@ -541,7 +541,7 @@ void mono_profiler_init (const char *desc)
        prof->string_locations_hash = g_hash_table_new (mismatched_files_guint32_hash, mismatched_files_guint32_equal);
 
        MonoProfilerHandle handle = mono_profiler_install (prof);
-       mono_profiler_set_runtime_shutdown_callback (handle, profiler_shutdown);
+       mono_profiler_set_runtime_shutdown_end_callback (handle, profiler_shutdown);
        mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized_cb);
        mono_profiler_set_iomap_report_callback (handle, mono_portability_iomap_event);
        mono_profiler_enable_allocations ();
index 2b586159b6f35194eabd908839add1c180251a1e..3fc08c01c12956a4addb3a16416228dfce91d490 100644 (file)
@@ -4715,7 +4715,7 @@ mono_profiler_init (const char *desc)
        MonoProfilerHandle handle = log_profiler->handle = mono_profiler_install (log_profiler);
 
        //Required callbacks
-       mono_profiler_set_runtime_shutdown_callback (handle, log_shutdown);
+       mono_profiler_set_runtime_shutdown_end_callback (handle, log_shutdown);
        mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized);
 
        mono_profiler_set_gc_event_callback (handle, gc_event);
index a1615bfa362fce7b443cbc3127634786ce378a6d..a11650951a4d52a25ed2669122c669f386428c98 100644 (file)
@@ -167,7 +167,7 @@ mono_profiler_init (const char *desc)
        if (flags == iJIT_SAMPLING_ON)
        {
                MonoProfilerHandle handle = mono_profiler_install (NULL);
-               mono_profiler_set_runtime_shutdown_callback (handle, codeanalyst_shutdown);
+               mono_profiler_set_runtime_shutdown_end_callback (handle, codeanalyst_shutdown);
                mono_profiler_set_jit_done_callback (handle, method_jit_done);
                mono_profiler_set_jit_code_buffer_callback (handle, code_buffer_new);
        }