projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4c6c318
)
[profiler] Add counters for numbers of signals sent/received/accepted.
author
Andi McClure
<andi.mcclure@xamarin.com>
Fri, 8 Apr 2016 23:22:52 +0000
(
01:22
+0200)
committer
Rodrigo Kumpera
<kumpera@gmail.com>
Tue, 19 Apr 2016 21:34:46 +0000
(14:34 -0700)
mono/mini/mini-posix.c
patch
|
blob
|
history
diff --git
a/mono/mini/mini-posix.c
b/mono/mini/mini-posix.c
index 8e6646cc77c99efc1c45680045bef393c5bbc337..dab2ac288f2cdf6a270d475e23c476c9c7a8fd68 100644
(file)
--- a/
mono/mini/mini-posix.c
+++ b/
mono/mini/mini-posix.c
@@
-322,18
+322,26
@@
per_thread_profiler_hit (void *ctx)
}
}
}
}
+static gint32 profiler_signals_sent;
+static gint32 profiler_signals_received;
+static gint32 profiler_signals_accepted;
+
MONO_SIG_HANDLER_FUNC (static, profiler_signal_handler)
{
int old_errno = errno;
int hp_save_index;
MONO_SIG_HANDLER_GET_CONTEXT;
MONO_SIG_HANDLER_FUNC (static, profiler_signal_handler)
{
int old_errno = errno;
int hp_save_index;
MONO_SIG_HANDLER_GET_CONTEXT;
+ InterlockedIncrement (&profiler_signals_received);
+
if (mono_thread_info_get_small_id () == -1)
return; //an non-attached thread got the signal
if (!mono_domain_get () || !mono_native_tls_get_value (mono_jit_tls_id))
return; //thread in the process of dettaching
if (mono_thread_info_get_small_id () == -1)
return; //an non-attached thread got the signal
if (!mono_domain_get () || !mono_native_tls_get_value (mono_jit_tls_id))
return; //thread in the process of dettaching
+ InterlockedIncrement (&profiler_signals_accepted);
+
hp_save_index = mono_hazard_pointer_save_for_signal_handler ();
mono_thread_info_set_is_async_context (TRUE);
hp_save_index = mono_hazard_pointer_save_for_signal_handler ();
mono_thread_info_set_is_async_context (TRUE);
@@
-718,6
+726,7
@@
sampling_thread_func (void *data)
g_assert (mono_thread_info_get_tid (info) != mono_native_thread_id_get ());
mono_threads_pthread_kill (info, profiler_signal);
g_assert (mono_thread_info_get_tid (info) != mono_native_thread_id_get ());
mono_threads_pthread_kill (info, profiler_signal);
+ InterlockedIncrement (&profiler_signals_sent);
} FOREACH_THREAD_SAFE_END
clock_sleep_ns_abs (sleep);
} FOREACH_THREAD_SAFE_END
clock_sleep_ns_abs (sleep);
@@
-769,6
+778,10
@@
mono_runtime_setup_stat_profiler (void)
add_signal_handler (profiler_signal, profiler_signal_handler, SA_RESTART);
add_signal_handler (profiler_signal, profiler_signal_handler, SA_RESTART);
+ mono_counters_register ("Sampling signals sent", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &profiler_signals_sent);
+ mono_counters_register ("Sampling signals received", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &profiler_signals_received);
+ mono_counters_register ("Sampling signals accepted", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &profiler_signals_accepted);
+
InterlockedWrite (&sampling_thread_running, 1);
mono_native_thread_create (&sampling_thread, sampling_thread_func, NULL);
}
InterlockedWrite (&sampling_thread_running, 1);
mono_native_thread_create (&sampling_thread, sampling_thread_func, NULL);
}