Added support for keeping track of code chunks and buffers.
[mono.git] / mono / metadata / profiler-private.h
1
2 #ifndef __MONO_PROFILER_PRIVATE_H__
3 #define __MONO_PROFILER_PRIVATE_H__
4
5 #include <mono/metadata/profiler.h>
6 #include "mono/utils/mono-compiler.h"
7
8 extern MonoProfileFlags mono_profiler_events;
9
10 enum {
11         MONO_PROFILE_START_LOAD,
12         MONO_PROFILE_END_LOAD,
13         MONO_PROFILE_START_UNLOAD,
14         MONO_PROFILE_END_UNLOAD
15 };
16
17 typedef struct {
18         int entries;
19         struct {
20                 guchar* cil_code;
21                 int count;
22         } data [1];
23 } MonoProfileCoverageInfo;
24
25 void mono_profiler_shutdown        (void) MONO_INTERNAL;
26
27 void mono_profiler_method_enter    (MonoMethod *method) MONO_INTERNAL;
28 void mono_profiler_method_leave    (MonoMethod *method) MONO_INTERNAL;
29 void mono_profiler_method_jit      (MonoMethod *method) MONO_INTERNAL;
30 void mono_profiler_method_end_jit  (MonoMethod *method, MonoJitInfo* jinfo, int result) MONO_INTERNAL;
31 void mono_profiler_method_free     (MonoMethod *method) MONO_INTERNAL;
32
33 void mono_profiler_code_transition (MonoMethod *method, int result) MONO_INTERNAL;
34 void mono_profiler_allocation      (MonoObject *obj, MonoClass *klass) MONO_INTERNAL;
35 void mono_profiler_monitor_event   (MonoObject *obj, MonoProfilerMonitorEvent event) MONO_INTERNAL;
36 void mono_profiler_stat_hit        (guchar *ip, void *context) MONO_INTERNAL;
37 void mono_profiler_stat_call_chain (int call_chain_depth, guchar **ips, void *context) MONO_INTERNAL;
38 #define MONO_PROFILER_MAX_STAT_CALL_CHAIN_DEPTH 16
39 int  mono_profiler_stat_get_call_chain_depth (void) MONO_INTERNAL;
40 void mono_profiler_thread_start    (gsize tid) MONO_INTERNAL;
41 void mono_profiler_thread_end      (gsize tid) MONO_INTERNAL;
42
43 void mono_profiler_exception_thrown         (MonoObject *exception) MONO_INTERNAL;
44 void mono_profiler_exception_method_leave   (MonoMethod *method) MONO_INTERNAL;
45 void mono_profiler_exception_clause_handler (MonoMethod *method, int clause_type, int clause_num) MONO_INTERNAL;
46
47 void mono_profiler_assembly_event  (MonoAssembly *assembly, int code) MONO_INTERNAL;
48 void mono_profiler_assembly_loaded (MonoAssembly *assembly, int result) MONO_INTERNAL;
49
50 void mono_profiler_module_event  (MonoImage *image, int code) MONO_INTERNAL;
51 void mono_profiler_module_loaded (MonoImage *image, int result) MONO_INTERNAL;
52
53 void mono_profiler_class_event  (MonoClass *klass, int code) MONO_INTERNAL;
54 void mono_profiler_class_loaded (MonoClass *klass, int result) MONO_INTERNAL;
55
56 void mono_profiler_appdomain_event  (MonoDomain *domain, int code) MONO_INTERNAL;
57 void mono_profiler_appdomain_loaded (MonoDomain *domain, int result) MONO_INTERNAL;
58
59 MonoProfileCoverageInfo* mono_profiler_coverage_alloc (MonoMethod *method, int entries) MONO_INTERNAL;
60 void                     mono_profiler_coverage_free  (MonoMethod *method) MONO_INTERNAL;
61
62 void mono_profiler_gc_event       (MonoGCEvent e, int generation) MONO_INTERNAL;
63 void mono_profiler_gc_heap_resize (gint64 new_size) MONO_INTERNAL;
64
65 void mono_profiler_code_chunk_new (gpointer chunk, int size) MONO_INTERNAL;
66 void mono_profiler_code_chunk_destroy (gpointer chunk) MONO_INTERNAL;
67 void mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, void *data) MONO_INTERNAL;
68
69 void mono_profiler_runtime_initialized (void) MONO_INTERNAL;
70
71 #endif /* __MONO_PROFILER_PRIVATE_H__ */
72