ENTER_LOG (&sync_points_ctr, logbuffer,
EVENT_SIZE /* event */ +
- LEB128_SIZE /* type */
+ BYTE_SIZE /* type */
);
emit_event (logbuffer, TYPE_META | TYPE_SYNC_POINT);
for (int i = 0; i < num; ++i) {
emit_obj (logbuffer, objects [i]);
- emit_byte (logbuffer, root_types [i]);
+ emit_value (logbuffer, root_types [i]);
emit_value (logbuffer, extra_info [i]);
}
}
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;
+ if (log_config.callspec.len > 0 &&
+ !mono_callspec_eval (method, &log_config.callspec))
+ return MONO_PROFILER_CALL_INSTRUMENTATION_NONE;
+
+ 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
EVENT_SIZE /* event */ +
BYTE_SIZE /* clause type */ +
LEB128_SIZE /* clause num */ +
- LEB128_SIZE /* method */
+ LEB128_SIZE /* method */ +
+ LEB128_SIZE /* exc */
);
emit_event (logbuffer, TYPE_EXCEPTION | TYPE_CLAUSE);
LEB128_SIZE /* load address */ +
LEB128_SIZE /* offset */ +
LEB128_SIZE /* size */ +
- nlen /* file name */
+ len /* file name */
);
emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_UBIN);
;
for (agent = log_profiler.counters; agent; agent = agent->next) {
+ /*
+ * FIXME: This calculation is incorrect for string counters since
+ * mono_counter_get_size () just returns 0 in that case. We should
+ * address this if we ever actually add any string counters to Mono.
+ */
+
size +=
LEB128_SIZE /* index */ +
BYTE_SIZE /* type */ +
mono_coop_mutex_lock (&log_profiler.api_mutex);
if (value) {
- ENABLE (PROFLOG_EXCEPTION_EVENTS);
+ ENABLE (PROFLOG_MONITOR_EVENTS);
mono_profiler_set_monitor_contention_callback (log_profiler.handle, monitor_contention);
mono_profiler_set_monitor_acquired_callback (log_profiler.handle, monitor_acquired);
mono_profiler_set_monitor_failed_callback (log_profiler.handle, monitor_failed);
} else {
- DISABLE (PROFLOG_EXCEPTION_EVENTS);
+ DISABLE (PROFLOG_MONITOR_EVENTS);
mono_profiler_set_monitor_contention_callback (log_profiler.handle, NULL);
mono_profiler_set_monitor_acquired_callback (log_profiler.handle, NULL);
mono_profiler_set_monitor_failed_callback (log_profiler.handle, NULL);
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);