1 #ifndef __MONO_PROFILER_H__
2 #define __MONO_PROFILER_H__
4 #include <mono/metadata/object.h>
5 #include <mono/metadata/appdomain.h>
6 #include <mono/io-layer/io-layer.h>
10 MONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0,
11 MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1,
12 MONO_PROFILE_MODULE_EVENTS = 1 << 2,
13 MONO_PROFILE_CLASS_EVENTS = 1 << 3,
14 MONO_PROFILE_JIT_COMPILATION = 1 << 4,
15 MONO_PROFILE_INLINING = 1 << 5,
16 MONO_PROFILE_EXCEPTIONS = 1 << 6,
17 MONO_PROFILE_ALLOCATIONS = 1 << 7,
18 MONO_PROFILE_GC = 1 << 8,
19 MONO_PROFILE_THREADS = 1 << 9,
20 MONO_PROFILE_REMOTING = 1 << 10,
21 MONO_PROFILE_TRANSITIONS = 1 << 11,
22 MONO_PROFILE_ENTER_LEAVE = 1 << 12
30 typedef struct _MonoProfiler MonoProfiler;
33 * Functions that the runtime will call on the profiler.
36 typedef void (*MonoProfileFunc) (MonoProfiler *prof);
38 typedef void (*MonoProfileAppDomainFunc) (MonoProfiler *prof, MonoDomain *domain);
39 typedef void (*MonoProfileMethodFunc) (MonoProfiler *prof, MonoMethod *method);
40 typedef void (*MonoProfileClassFunc) (MonoProfiler *prof, MonoClass *klass);
41 typedef void (*MonoProfileModuleFunc) (MonoProfiler *prof, MonoImage *module);
42 typedef void (*MonoProfileAssemblyFunc) (MonoProfiler *prof, MonoAssembly *assembly);
44 typedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain *domain, int result);
45 typedef void (*MonoProfileMethodResult) (MonoProfiler *prof, MonoMethod *method, int result);
46 typedef void (*MonoProfileClassResult) (MonoProfiler *prof, MonoClass *klass, int result);
47 typedef void (*MonoProfileModuleResult) (MonoProfiler *prof, MonoImage *module, int result);
48 typedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *assembly, int result);
50 typedef void (*MonoProfileMethodInline) (MonoProfiler *prof, MonoMethod *parent, MonoMethod *child, int *ok);
52 typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, guint32 tid);
53 typedef void (*MonoProfileAllocFunc) (MonoProfiler *prof, MonoObject *obj, MonoClass *klass);
56 * Function the profiler may call.
58 void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc shutdown_callback);
59 void mono_profiler_set_events (MonoProfileFlags events);
61 MonoProfileFlags mono_profiler_get_events (void);
63 void mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load,
64 MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload);
65 void mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load,
66 MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload);
67 void mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load,
68 MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload);
69 void mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load,
70 MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload);
72 void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end);
73 void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc leave);
74 void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end);
75 void mono_profiler_install_transition (MonoProfileMethodResult callback);
76 void mono_profiler_install_allocation (MonoProfileAllocFunc callback);
78 void mono_profiler_install_simple (void);
80 #endif /* __MONO_PROFILER_H__ */