From 0c7e37856da0e328470a670c81d70843d48b4da2 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Wed, 7 May 2014 16:55:00 -0400 Subject: [PATCH] [proflog] Add integration of counters_init and counters_sample counters_init is called at the end of runtime initialization, on runtime_initialized hook counters_sample is called in the helper_thread at least once per second --- mono/profiler/proflog.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c index 49a0ca1ee71..61a729b47e4 100644 --- a/mono/profiler/proflog.c +++ b/mono/profiler/proflog.c @@ -659,10 +659,15 @@ process_requests (MonoProfiler *profiler) mono_gc_collect (mono_gc_max_generation ()); } +static void counters_init (MonoProfiler *profiler); + static void runtime_initialized (MonoProfiler *profiler) { runtime_inited = 1; +#ifndef DISABLE_HELPER_THREAD + counters_init (profiler); +#endif /* ensure the main thread data and startup are available soon */ safe_dump (profiler, ensure_logbuf (0)); } @@ -2126,6 +2131,9 @@ helper_thread (void* arg) int len; char buf [64]; MonoThread *thread = NULL; + GTimeVal start, now; + + g_get_current_time (&start); //fprintf (stderr, "Server listening\n"); command_socket = -1; @@ -2156,6 +2164,10 @@ helper_thread (void* arg) } } #endif + g_get_current_time (&now); + counters_sample (prof, (uint64_t)(now.tv_sec * 1000 + now.tv_usec / 1000) - (uint64_t)(start.tv_sec * 1000 + start.tv_usec / 1000)); + safe_dump (prof, ensure_logbuf (0)); + tv.tv_sec = 1; tv.tv_usec = 0; len = select (max_fd + 1, &rfds, NULL, NULL, &tv); -- 2.25.1