Skip to content

Commit daa5b79

Browse files
authored
Merge pull request #789 from Unity-Technologies/unity-master-fix-deep-profiling
Fix instrumentation with legacy profiler APIs (case 979612)
2 parents 9d02a18 + 4c76fc9 commit daa5b79

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

mono/metadata/profiler.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,9 +1069,41 @@ mono_profiler_install_jit_end (MonoLegacyProfileJitResult end)
10691069
}
10701070
}
10711071

1072+
1073+
static MonoProfilerCallInstrumentationFlags
1074+
call_instrumentation_filter_callback (MonoProfiler *prof, MonoMethod *method)
1075+
{
1076+
return MONO_PROFILER_CALL_INSTRUMENTATION_ENTER | MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE | MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL | MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE;
1077+
}
1078+
1079+
typedef enum
1080+
{
1081+
MONO_PROFILE_NONE = 0,
1082+
MONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0,
1083+
MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1,
1084+
MONO_PROFILE_MODULE_EVENTS = 1 << 2,
1085+
MONO_PROFILE_CLASS_EVENTS = 1 << 3,
1086+
MONO_PROFILE_JIT_COMPILATION = 1 << 4,
1087+
MONO_PROFILE_INLINING = 1 << 5,
1088+
MONO_PROFILE_EXCEPTIONS = 1 << 6,
1089+
MONO_PROFILE_ALLOCATIONS = 1 << 7,
1090+
MONO_PROFILE_GC = 1 << 8,
1091+
MONO_PROFILE_THREADS = 1 << 9,
1092+
MONO_PROFILE_REMOTING = 1 << 10,
1093+
MONO_PROFILE_TRANSITIONS = 1 << 11,
1094+
MONO_PROFILE_ENTER_LEAVE = 1 << 12,
1095+
MONO_PROFILE_COVERAGE = 1 << 13,
1096+
MONO_PROFILE_INS_COVERAGE = 1 << 14,
1097+
MONO_PROFILE_STATISTICAL = 1 << 15
1098+
} LegacyMonoProfileFlags;
1099+
10721100
void
10731101
mono_profiler_set_events (int flags)
10741102
{
1103+
if (flags & MONO_PROFILE_ENTER_LEAVE)
1104+
mono_profiler_set_call_instrumentation_filter_callback (current->handle, call_instrumentation_filter_callback);
1105+
else
1106+
mono_profiler_set_call_instrumentation_filter_callback (current->handle, NULL);
10751107
/* Do nothing. */
10761108
}
10771109

0 commit comments

Comments
 (0)