X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fprofiler.h;h=17128a1cb5a79d950d70cc90c6a73337fae24b0b;hb=9d596e5b2b8888d250c1bd158b056406d96cb641;hp=4ae77ef7368c64e502de7d5d57a4d489dc758807;hpb=9224ca55bf2a961b096d82f33d5dc15091d8892f;p=mono.git diff --git a/mono/metadata/profiler.h b/mono/metadata/profiler.h index 4ae77ef7368..17128a1cb5a 100644 --- a/mono/metadata/profiler.h +++ b/mono/metadata/profiler.h @@ -28,7 +28,10 @@ typedef enum { MONO_PROFILE_STATISTICAL = 1 << 15, MONO_PROFILE_METHOD_EVENTS = 1 << 16, MONO_PROFILE_MONITOR_EVENTS = 1 << 17, - MONO_PROFILE_IOMAP_EVENTS = 1 << 18 + MONO_PROFILE_IOMAP_EVENTS = 1 << 18, /* this should likely be removed, too */ + MONO_PROFILE_GC_MOVES = 1 << 19, + MONO_PROFILE_GC_ROOTS = 1 << 20, + MONO_PROFILE_CONTEXT_EVENTS = 1 << 21 } MonoProfileFlags; typedef enum { @@ -63,6 +66,15 @@ typedef struct { typedef enum { MONO_PROFILER_CODE_BUFFER_UNKNOWN, MONO_PROFILER_CODE_BUFFER_METHOD, + MONO_PROFILER_CODE_BUFFER_METHOD_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_HELPER, + MONO_PROFILER_CODE_BUFFER_MONITOR, + MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, + MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, MONO_PROFILER_CODE_BUFFER_LAST } MonoProfilerCodeBufferType; @@ -82,6 +94,24 @@ typedef enum { MONO_PROFILER_CALL_CHAIN_INVALID = 4 } MonoProfilerCallChainStrategy; +typedef enum { + MONO_PROFILER_GC_HANDLE_CREATED, + MONO_PROFILER_GC_HANDLE_DESTROYED +} MonoProfileGCHandleEvent; + +typedef enum { + MONO_PROFILE_GC_ROOT_PINNING = 1 << 8, + MONO_PROFILE_GC_ROOT_WEAKREF = 2 << 8, + MONO_PROFILE_GC_ROOT_INTERIOR = 4 << 8, + /* the above are flags, the type is in the low 2 bytes */ + MONO_PROFILE_GC_ROOT_STACK = 0, + MONO_PROFILE_GC_ROOT_FINALIZER = 1, + MONO_PROFILE_GC_ROOT_HANDLE = 2, + MONO_PROFILE_GC_ROOT_OTHER = 3, + MONO_PROFILE_GC_ROOT_MISC = 4, /* could be stack, handle, etc. */ + MONO_PROFILE_GC_ROOT_TYPEMASK = 0xff +} MonoProfileGCRootType; + /* * Functions that the runtime will call on the profiler. */ @@ -89,6 +119,7 @@ typedef enum { typedef void (*MonoProfileFunc) (MonoProfiler *prof); typedef void (*MonoProfileAppDomainFunc) (MonoProfiler *prof, MonoDomain *domain); +typedef void (*MonoProfileContextFunc) (MonoProfiler *prof, MonoAppContext *context); typedef void (*MonoProfileMethodFunc) (MonoProfiler *prof, MonoMethod *method); typedef void (*MonoProfileClassFunc) (MonoProfiler *prof, MonoClass *klass); typedef void (*MonoProfileModuleFunc) (MonoProfiler *prof, MonoImage *module); @@ -99,6 +130,7 @@ typedef void (*MonoProfileExceptionFunc) (MonoProfiler *prof, MonoObject *object typedef void (*MonoProfileExceptionClauseFunc) (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num); typedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain *domain, int result); +typedef void (*MonoProfileAppDomainFriendlyNameFunc) (MonoProfiler *prof, MonoDomain *domain, const char *name); typedef void (*MonoProfileMethodResult) (MonoProfiler *prof, MonoMethod *method, int result); typedef void (*MonoProfileJitResult) (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, int result); typedef void (*MonoProfileClassResult) (MonoProfiler *prof, MonoClass *klass, int result); @@ -107,12 +139,16 @@ typedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *ass typedef void (*MonoProfileMethodInline) (MonoProfiler *prof, MonoMethod *parent, MonoMethod *child, int *ok); -typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, intptr_t tid); +typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, uintptr_t tid); +typedef void (*MonoProfileThreadNameFunc) (MonoProfiler *prof, uintptr_t tid, const char *name); typedef void (*MonoProfileAllocFunc) (MonoProfiler *prof, MonoObject *obj, MonoClass *klass); typedef void (*MonoProfileStatFunc) (MonoProfiler *prof, mono_byte *ip, void *context); typedef void (*MonoProfileStatCallChainFunc) (MonoProfiler *prof, int call_chain_depth, mono_byte **ip, void *context); typedef void (*MonoProfileGCFunc) (MonoProfiler *prof, MonoGCEvent event, int generation); +typedef void (*MonoProfileGCMoveFunc) (MonoProfiler *prof, void **objects, int num); typedef void (*MonoProfileGCResizeFunc) (MonoProfiler *prof, int64_t new_size); +typedef void (*MonoProfileGCHandleFunc) (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj); +typedef void (*MonoProfileGCRootFunc) (MonoProfiler *prof, int num_roots, void **objects, int *root_types, uintptr_t *extra_info); typedef void (*MonoProfileIomapFunc) (MonoProfiler *prof, const char *report, const char *pathname, const char *new_pathname); @@ -127,44 +163,58 @@ typedef void (*MonoProfilerCodeBufferNew) (MonoProfiler *prof, void* buffer, int /* * Function the profiler may call. */ -void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc shutdown_callback); -void mono_profiler_set_events (MonoProfileFlags events); +MONO_API void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc shutdown_callback); +MONO_API void mono_profiler_set_events (MonoProfileFlags events); -MonoProfileFlags mono_profiler_get_events (void); +MONO_API MonoProfileFlags mono_profiler_get_events (void); -void mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load, +MONO_API void mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load, MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload); -void mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load, +MONO_API void mono_profiler_install_appdomain_name (MonoProfileAppDomainFriendlyNameFunc domain_name_cb); +MONO_API void mono_profiler_install_context (MonoProfileContextFunc load, MonoProfileContextFunc unload); +MONO_API void mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load, MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload); -void mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load, +MONO_API void mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load, MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload); -void mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load, +MONO_API void mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load, MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload); -void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end); -void mono_profiler_install_jit_end (MonoProfileJitResult end); -void mono_profiler_install_method_free (MonoProfileMethodFunc callback); -void mono_profiler_install_method_invoke (MonoProfileMethodFunc start, MonoProfileMethodFunc end); -void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave); -void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end); -void mono_profiler_install_transition (MonoProfileMethodResult callback); -void mono_profiler_install_allocation (MonoProfileAllocFunc callback); -void mono_profiler_install_monitor (MonoProfileMonitorFunc callback); -void mono_profiler_install_statistical (MonoProfileStatFunc callback); -void mono_profiler_install_statistical_call_chain (MonoProfileStatCallChainFunc callback, int call_chain_depth, MonoProfilerCallChainStrategy call_chain_strategy); -void mono_profiler_install_exception (MonoProfileExceptionFunc throw_callback, MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc clause_callback); -void mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback); -void mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method, MonoProfileCoverageFunc func); -void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback); -void mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback); - -void mono_profiler_install_code_chunk_new (MonoProfilerCodeChunkNew callback); -void mono_profiler_install_code_chunk_destroy (MonoProfilerCodeChunkDestroy callback); -void mono_profiler_install_code_buffer_new (MonoProfilerCodeBufferNew callback); - -void mono_profiler_install_iomap (MonoProfileIomapFunc callback); - -void mono_profiler_load (const char *desc); +MONO_API void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end); +MONO_API void mono_profiler_install_jit_end (MonoProfileJitResult end); +MONO_API void mono_profiler_install_method_free (MonoProfileMethodFunc callback); +MONO_API void mono_profiler_install_method_invoke (MonoProfileMethodFunc start, MonoProfileMethodFunc end); +MONO_API void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave); +MONO_API void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end); +MONO_API void mono_profiler_install_thread_name (MonoProfileThreadNameFunc thread_name_cb); +MONO_API void mono_profiler_install_transition (MonoProfileMethodResult callback); +MONO_API void mono_profiler_install_allocation (MonoProfileAllocFunc callback); +MONO_API void mono_profiler_install_monitor (MonoProfileMonitorFunc callback); +MONO_API void mono_profiler_install_statistical (MonoProfileStatFunc callback); +MONO_API void mono_profiler_install_statistical_call_chain (MonoProfileStatCallChainFunc callback, int call_chain_depth, MonoProfilerCallChainStrategy call_chain_strategy); +MONO_API void mono_profiler_install_exception (MonoProfileExceptionFunc throw_callback, MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc clause_callback); +MONO_API void mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback); +MONO_API void mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method, MonoProfileCoverageFunc func); +MONO_API void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback); +MONO_API void mono_profiler_install_gc_moves (MonoProfileGCMoveFunc callback); +MONO_API void mono_profiler_install_gc_roots (MonoProfileGCHandleFunc handle_callback, MonoProfileGCRootFunc roots_callback); +MONO_API void mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback); + +MONO_API void mono_profiler_install_code_chunk_new (MonoProfilerCodeChunkNew callback); +MONO_API void mono_profiler_install_code_chunk_destroy (MonoProfilerCodeChunkDestroy callback); +MONO_API void mono_profiler_install_code_buffer_new (MonoProfilerCodeBufferNew callback); + +MONO_API void mono_profiler_install_iomap (MonoProfileIomapFunc callback); + +MONO_API void mono_profiler_load (const char *desc); + +typedef enum { + /* Elapsed time is tracked by user+kernel time of the process - this is the default*/ + MONO_PROFILER_STAT_MODE_PROCESS = 0, + /* Elapsed time is tracked by wallclock time */ + MONO_PROFILER_STAT_MODE_REAL = 1, +} MonoProfileSamplingMode; + +MONO_API void mono_profiler_set_statistical_mode (MonoProfileSamplingMode mode, int64_t sampling_frequency_is_us); MONO_END_DECLS