From: Alex Rønne Petersen Date: Sat, 24 Jun 2017 02:53:43 +0000 (+0200) Subject: [profiler] Split shutdown callback into early/late callbacks. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=5abf30d8933e20ca8796121b697e36c647b1697f;p=mono.git [profiler] Split shutdown callback into early/late callbacks. --- diff --git a/mono/metadata/profiler-events.h b/mono/metadata/profiler-events.h index 4f9ce6462c5..3c08d81d136 100644 --- a/mono/metadata/profiler-events.h +++ b/mono/metadata/profiler-events.h @@ -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) diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 96ef5e20ab2..acabbbdb093 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -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); diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index 0f3c217c654..8fb79499387 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -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 (); diff --git a/mono/profiler/aot.c b/mono/profiler/aot.c index 758f86eef14..d2b227d826c 100644 --- a/mono/profiler/aot.c +++ b/mono/profiler/aot.c @@ -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); } diff --git a/mono/profiler/iomap.c b/mono/profiler/iomap.c index 5297df369e3..89a30193179 100644 --- a/mono/profiler/iomap.c +++ b/mono/profiler/iomap.c @@ -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 (); diff --git a/mono/profiler/log.c b/mono/profiler/log.c index 2b586159b6f..3fc08c01c12 100644 --- a/mono/profiler/log.c +++ b/mono/profiler/log.c @@ -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); diff --git a/mono/profiler/vtune.c b/mono/profiler/vtune.c index a1615bfa362..a11650951a4 100644 --- a/mono/profiler/vtune.c +++ b/mono/profiler/vtune.c @@ -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); }