Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / profiler-events.h
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. If you need more arguments
18  * then the current macros provide, add another macro and update all areas
19  * where the macros are used.
20  */
21
22 MONO_PROFILER_EVENT_0(runtime_initialized, RuntimeInitialized)
23 MONO_PROFILER_EVENT_0(runtime_shutdown_begin, RuntimeShutdownBegin)
24 MONO_PROFILER_EVENT_0(runtime_shutdown_end, RuntimeShutdownEnd)
25
26 MONO_PROFILER_EVENT_1(context_loaded, ContextLoaded, MonoAppContext *, context)
27 MONO_PROFILER_EVENT_1(context_unloaded, ContextUnloaded, MonoAppContext *, context)
28
29 MONO_PROFILER_EVENT_1(domain_loading, DomainLoading, MonoDomain *, domain)
30 MONO_PROFILER_EVENT_1(domain_loaded, DomainLoaded, MonoDomain *, domain)
31 MONO_PROFILER_EVENT_1(domain_unloading, DomainUnloading, MonoDomain *, domain)
32 MONO_PROFILER_EVENT_1(domain_unloaded, DomainUnloaded, MonoDomain *, domain)
33 MONO_PROFILER_EVENT_2(domain_name, DomainName, MonoDomain *, domain, const char *, name)
34
35 MONO_PROFILER_EVENT_1(jit_begin, JitBegin, MonoMethod *, method)
36 MONO_PROFILER_EVENT_1(jit_failed, JitFailed, MonoMethod *, method)
37 MONO_PROFILER_EVENT_2(jit_done, JitDone, MonoMethod *, method, MonoJitInfo *, jinfo)
38 MONO_PROFILER_EVENT_2(jit_chunk_created, JitChunkCreated, const mono_byte *, chunk, uintptr_t, size)
39 MONO_PROFILER_EVENT_1(jit_chunk_destroyed, JitChunkDestroyed, const mono_byte *, chunk)
40 MONO_PROFILER_EVENT_4(jit_code_buffer, JitCodeBuffer, const mono_byte *, buffer, uint64_t, size, MonoProfilerCodeBufferType, type, const void *, data)
41
42 MONO_PROFILER_EVENT_1(class_loading, ClassLoading, MonoClass *, klass)
43 MONO_PROFILER_EVENT_1(class_failed, ClassFailed, MonoClass *, klass)
44 MONO_PROFILER_EVENT_1(class_loaded, ClassLoaded, MonoClass *, klass)
45
46 MONO_PROFILER_EVENT_1(image_loading, ModuleLoading, MonoImage *, image)
47 MONO_PROFILER_EVENT_1(image_failed, ModuleFailed, MonoImage *, image)
48 MONO_PROFILER_EVENT_1(image_loaded, ModuleLoaded, MonoImage *, image)
49 MONO_PROFILER_EVENT_1(image_unloading, ModuleUnloading, MonoImage *, image)
50 MONO_PROFILER_EVENT_1(image_unloaded, ModuleUnloaded, MonoImage *, image)
51
52 MONO_PROFILER_EVENT_1(assembly_loading, AssemblyLoading, MonoAssembly *, assembly)
53 MONO_PROFILER_EVENT_1(assembly_loaded, AssemblyLLoaded, MonoAssembly *, assembly)
54 MONO_PROFILER_EVENT_1(assembly_unloading, AssemblyLUnloading, MonoAssembly *, assembly)
55 MONO_PROFILER_EVENT_1(assembly_unloaded, AssemblyLUnloaded, MonoAssembly *, assembly)
56
57 MONO_PROFILER_EVENT_2(method_enter, MethodEnter, MonoMethod *, method, MonoProfilerCallContext *, context)
58 MONO_PROFILER_EVENT_2(method_leave, MethodLeave, MonoMethod *, method, MonoProfilerCallContext *, context)
59 MONO_PROFILER_EVENT_2(method_tail_call, MethodTailCall, MonoMethod *, method, MonoMethod *, target)
60 MONO_PROFILER_EVENT_2(method_exception_leave, MethodExceptionLeave, MonoMethod *, method, MonoObject *, exception)
61 MONO_PROFILER_EVENT_1(method_free, MethodFree, MonoMethod *, method)
62 MONO_PROFILER_EVENT_1(method_begin_invoke, MethodBeginInvoke, MonoMethod *, method)
63 MONO_PROFILER_EVENT_1(method_end_invoke, MethodEndInvoke, MonoMethod *, method)
64
65 MONO_PROFILER_EVENT_1(exception_throw, ExceptionThrow, MonoObject *, exception)
66 MONO_PROFILER_EVENT_4(exception_clause, ExceptionClause, MonoMethod *, method, uint32_t, index, MonoExceptionEnum, type, MonoObject *, exception)
67
68 MONO_PROFILER_EVENT_2(gc_event, GCEvent, MonoProfilerGCEvent, event, uint32_t, generation)
69 MONO_PROFILER_EVENT_1(gc_allocation, GCAllocation, MonoObject *, object)
70 MONO_PROFILER_EVENT_2(gc_moves, GCMoves, MonoObject *const *, objects, uint64_t, count)
71 MONO_PROFILER_EVENT_1(gc_resize, GCResize, uintptr_t, size)
72 MONO_PROFILER_EVENT_3(gc_handle_created, GCHandleCreated, uint32_t, handle, MonoGCHandleType, type, MonoObject *, object)
73 MONO_PROFILER_EVENT_2(gc_handle_deleted, GCHandleDeleted, uint32_t, handle, MonoGCHandleType, type)
74 MONO_PROFILER_EVENT_0(gc_finalizing, GCFinalizing)
75 MONO_PROFILER_EVENT_0(gc_finalized, GCFinalized)
76 MONO_PROFILER_EVENT_1(gc_finalizing_object, GCFinalizingObject, MonoObject *, object)
77 MONO_PROFILER_EVENT_1(gc_finalized_object, GCFinalizedObject, MonoObject *, object)
78
79 /*
80  * This callback provides very low quality data and doesn't really match how
81  * roots are actually handled in the runtime. It will be replaced with a more
82  * sensible callback in the future. **This will be a breaking change.**
83  *
84  * In the meantime, you must define MONO_PROFILER_UNSTABLE_GC_ROOTS to be able
85  * to use this interface.
86  */
87 #ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS
88 MONO_PROFILER_EVENT_4(gc_roots, GCRoots, MonoObject *const *, roots, const MonoProfilerGCRootType *, types, const uintptr_t *, extra, uint64_t, count)
89 #endif
90
91 MONO_PROFILER_EVENT_1(monitor_contention, MonitorContention, MonoObject *, object)
92 MONO_PROFILER_EVENT_1(monitor_failed, MonitorFailed, MonoObject *, object)
93 MONO_PROFILER_EVENT_1(monitor_acquired, MonitorAcquired, MonoObject *, object)
94
95 MONO_PROFILER_EVENT_1(thread_started, ThreadStarted, uintptr_t, tid)
96 MONO_PROFILER_EVENT_1(thread_stopped, ThreadStopped, uintptr_t, tid)
97 MONO_PROFILER_EVENT_2(thread_name, ThreadName, uintptr_t, tid, const char *, name)
98
99 MONO_PROFILER_EVENT_2(sample_hit, SampleHit, const mono_byte *, ip, const void *, context)
100
101 MONO_PROFILER_EVENT_3(iomap_report, IOMap, const char *, report, const char *, old_path, const char *, new_path)