}
static void
-method_enter (MonoProfiler *prof, MonoMethod *method)
+method_enter (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
{
if (get_thread ()->call_depth++ <= log_config.max_call_depth) {
ENTER_LOG (&method_entries_ctr, logbuffer,
}
static void
-method_leave (MonoProfiler *prof, MonoMethod *method)
+method_leave (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
{
if (--get_thread ()->call_depth <= log_config.max_call_depth) {
ENTER_LOG (&method_exits_ctr, logbuffer,
}
}
+static void
+tail_call (MonoProfiler *prof, MonoMethod *method, MonoMethod *target)
+{
+ method_leave (prof, method, NULL);
+}
+
static void
method_exc_leave (MonoProfiler *prof, MonoMethod *method, MonoObject *exc)
{
static MonoProfilerCallInstrumentationFlags
method_filter (MonoProfiler *prof, MonoMethod *method)
{
- return MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE | MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE;
+ return MONO_PROFILER_CALL_INSTRUMENTATION_ENTER |
+ MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE |
+ MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL |
+ MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE;
}
static void
log_profiler.startup_time = current_time ();
}
-/*
- * declaration to silence the compiler: this is the entry point that
- * mono will load from the shared library and call.
- */
-extern void
-mono_profiler_init (const char *desc);
-
-extern void
+MONO_API void
mono_profiler_init_log (const char *desc);
-/*
- * this is the entry point that will be used when the profiler
- * is embedded inside the main executable.
- */
void
mono_profiler_init_log (const char *desc)
-{
- mono_profiler_init (desc);
-}
-
-void
-mono_profiler_init (const char *desc)
{
GPtrArray *filters = NULL;
mono_lls_init (&log_profiler.profiler_thread_list, NULL);
- MonoProfilerHandle handle = log_profiler.handle = mono_profiler_install (&log_profiler);
+ MonoProfilerHandle handle = log_profiler.handle = mono_profiler_create (&log_profiler);
/*
* Required callbacks. These are either necessary for the profiler itself
mono_profiler_set_call_instrumentation_filter_callback (handle, method_filter);
mono_profiler_set_method_enter_callback (handle, method_enter);
mono_profiler_set_method_leave_callback (handle, method_leave);
+ mono_profiler_set_method_tail_call_callback (handle, tail_call);
mono_profiler_set_method_exception_leave_callback (handle, method_exc_leave);
}
- if (log_config.collect_coverage)
+ if (log_config.collect_coverage) {
+ mono_profiler_enable_coverage ();
mono_profiler_set_coverage_filter_callback (handle, coverage_filter);
+ }
mono_profiler_enable_allocations ();
mono_profiler_enable_sampling (handle);