1 /* 2 * Licensed to the .NET Foundation under one or more agreements. 3 * The .NET Foundation licenses this file to you under the MIT license. 4 * See the LICENSE file in the project root for more information. 5 */ 6 7 /* 8 * To #include this file, #define the following macros first: 9 * 10 * MONO_PROFILER_EVENT_0(name, type) 11 * MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) 12 * MONO_PROFILER_EVENT_2(name, type, arg1_type, arg1_name, arg2_type, arg2_name) 13 * MONO_PROFILER_EVENT_3(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name) 14 * MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) 15 * 16 * To add new callbacks to the API, simply add a line in this file and use 17 * MONO_PROFILER_RAISE to raise the event wherever. 18 * 19 * If you need more arguments then the current macros provide, add another 20 * macro and update all areas where the macros are used. Remember that this is 21 * a public header and not all users will be defining the newly added macro. So 22 * to prevent errors in existing code, you must add something like this at the 23 * beginning of this file: 24 * 25 * #ifndef MONO_PROFILER_EVENT_5 26 * #define MONO_PROFILER_EVENT_5(...) # Do nothing. 27 * #endif 28 */ 29 30 MONO_PROFILER_EVENT_0(runtime_initialized, RuntimeInitialized) 31 MONO_PROFILER_EVENT_0(runtime_shutdown_begin, RuntimeShutdownBegin) 32 MONO_PROFILER_EVENT_0(runtime_shutdown_end, RuntimeShutdownEnd) 33 34 MONO_PROFILER_EVENT_1(context_loaded, ContextLoaded, MonoAppContext *, context) 35 MONO_PROFILER_EVENT_1(context_unloaded, ContextUnloaded, MonoAppContext *, context) 36 37 MONO_PROFILER_EVENT_1(domain_loading, DomainLoading, MonoDomain *, domain) 38 MONO_PROFILER_EVENT_1(domain_loaded, DomainLoaded, MonoDomain *, domain) 39 MONO_PROFILER_EVENT_1(domain_unloading, DomainUnloading, MonoDomain *, domain) 40 MONO_PROFILER_EVENT_1(domain_unloaded, DomainUnloaded, MonoDomain *, domain) 41 MONO_PROFILER_EVENT_2(domain_name, DomainName, MonoDomain *, domain, const char *, name) 42 43 MONO_PROFILER_EVENT_1(jit_begin, JitBegin, MonoMethod *, method) 44 MONO_PROFILER_EVENT_1(jit_failed, JitFailed, MonoMethod *, method) 45 MONO_PROFILER_EVENT_2(jit_done, JitDone, MonoMethod *, method, MonoJitInfo *, jinfo) 46 MONO_PROFILER_EVENT_2(jit_chunk_created, JitChunkCreated, const mono_byte *, chunk, uintptr_t, size) 47 MONO_PROFILER_EVENT_1(jit_chunk_destroyed, JitChunkDestroyed, const mono_byte *, chunk) 48 MONO_PROFILER_EVENT_4(jit_code_buffer, JitCodeBuffer, const mono_byte *, buffer, uint64_t, size, MonoProfilerCodeBufferType, type, const void *, data) 49 50 MONO_PROFILER_EVENT_1(class_loading, ClassLoading, MonoClass *, klass) 51 MONO_PROFILER_EVENT_1(class_failed, ClassFailed, MonoClass *, klass) 52 MONO_PROFILER_EVENT_1(class_loaded, ClassLoaded, MonoClass *, klass) 53 54 MONO_PROFILER_EVENT_1(image_loading, ModuleLoading, MonoImage *, image) 55 MONO_PROFILER_EVENT_1(image_failed, ModuleFailed, MonoImage *, image) 56 MONO_PROFILER_EVENT_1(image_loaded, ModuleLoaded, MonoImage *, image) 57 MONO_PROFILER_EVENT_1(image_unloading, ModuleUnloading, MonoImage *, image) 58 MONO_PROFILER_EVENT_1(image_unloaded, ModuleUnloaded, MonoImage *, image) 59 60 MONO_PROFILER_EVENT_1(assembly_loading, AssemblyLoading, MonoAssembly *, assembly) 61 MONO_PROFILER_EVENT_1(assembly_loaded, AssemblyLLoaded, MonoAssembly *, assembly) 62 MONO_PROFILER_EVENT_1(assembly_unloading, AssemblyLUnloading, MonoAssembly *, assembly) 63 MONO_PROFILER_EVENT_1(assembly_unloaded, AssemblyLUnloaded, MonoAssembly *, assembly) 64 65 MONO_PROFILER_EVENT_2(method_enter, MethodEnter, MonoMethod *, method, MonoProfilerCallContext *, context) 66 MONO_PROFILER_EVENT_2(method_leave, MethodLeave, MonoMethod *, method, MonoProfilerCallContext *, context) 67 MONO_PROFILER_EVENT_2(method_tail_call, MethodTailCall, MonoMethod *, method, MonoMethod *, target) 68 MONO_PROFILER_EVENT_2(method_exception_leave, MethodExceptionLeave, MonoMethod *, method, MonoObject *, exception) 69 MONO_PROFILER_EVENT_1(method_free, MethodFree, MonoMethod *, method) 70 MONO_PROFILER_EVENT_1(method_begin_invoke, MethodBeginInvoke, MonoMethod *, method) 71 MONO_PROFILER_EVENT_1(method_end_invoke, MethodEndInvoke, MonoMethod *, method) 72 73 MONO_PROFILER_EVENT_1(exception_throw, ExceptionThrow, MonoObject *, exception) 74 MONO_PROFILER_EVENT_4(exception_clause, ExceptionClause, MonoMethod *, method, uint32_t, index, MonoExceptionEnum, type, MonoObject *, exception) 75 76 MONO_PROFILER_EVENT_2(gc_event, GCEvent, MonoProfilerGCEvent, event, uint32_t, generation) 77 MONO_PROFILER_EVENT_1(gc_allocation, GCAllocation, MonoObject *, object) 78 MONO_PROFILER_EVENT_2(gc_moves, GCMoves, MonoObject *const *, objects, uint64_t, count) 79 MONO_PROFILER_EVENT_1(gc_resize, GCResize, uintptr_t, size) 80 MONO_PROFILER_EVENT_3(gc_handle_created, GCHandleCreated, uint32_t, handle, MonoGCHandleType, type, MonoObject *, object) 81 MONO_PROFILER_EVENT_2(gc_handle_deleted, GCHandleDeleted, uint32_t, handle, MonoGCHandleType, type) 82 MONO_PROFILER_EVENT_0(gc_finalizing, GCFinalizing) 83 MONO_PROFILER_EVENT_0(gc_finalized, GCFinalized) 84 MONO_PROFILER_EVENT_1(gc_finalizing_object, GCFinalizingObject, MonoObject *, object) 85 MONO_PROFILER_EVENT_1(gc_finalized_object, GCFinalizedObject, MonoObject *, object) 86 87 /* 88 * This callback provides very low quality data and doesn't really match how 89 * roots are actually handled in the runtime. It will be replaced with a more 90 * sensible callback in the future. **This will be a breaking change.** 91 * 92 * In the meantime, you must define MONO_PROFILER_UNSTABLE_GC_ROOTS to be able 93 * to use this interface. 94 */ 95 #ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS 96 MONO_PROFILER_EVENT_4(gc_roots, GCRoots, MonoObject *const *, roots, const MonoProfilerGCRootType *, types, const uintptr_t *, extra, uint64_t, count) 97 #endif 98 99 MONO_PROFILER_EVENT_1(monitor_contention, MonitorContention, MonoObject *, object) 100 MONO_PROFILER_EVENT_1(monitor_failed, MonitorFailed, MonoObject *, object) 101 MONO_PROFILER_EVENT_1(monitor_acquired, MonitorAcquired, MonoObject *, object) 102 103 MONO_PROFILER_EVENT_1(thread_started, ThreadStarted, uintptr_t, tid) 104 MONO_PROFILER_EVENT_1(thread_stopping, ThreadStopping, uintptr_t, tid) 105 MONO_PROFILER_EVENT_1(thread_stopped, ThreadStopped, uintptr_t, tid) 106 MONO_PROFILER_EVENT_1(thread_exited, ThreadExited, uintptr_t, tid) 107 MONO_PROFILER_EVENT_2(thread_name, ThreadName, uintptr_t, tid, const char *, name) 108 109 MONO_PROFILER_EVENT_2(sample_hit, SampleHit, const mono_byte *, ip, const void *, context) 110 111 MONO_PROFILER_EVENT_3(iomap_report, IOMap, const char *, report, const char *, old_path, const char *, new_path) 112