MONO_BEGIN_DECLS
+/*
+ * This value will be incremented whenever breaking changes to the profiler API
+ * are made. This macro is intended for use in profiler modules that wish to
+ * support older versions of the profiler API.
+ */
+#define MONO_PROFILER_API_VERSION 2
+
/*
* Loads a profiler module based on the specified description. The description
* can be of the form "name:args" or just "name". For example, "log:sample" and
* the module after it has been loaded. If the specified module has already
* been loaded, this function has no effect.
*
- * A module should declare an entry point like so:
+ * A module called foo should declare an entry point like so:
*
- * void mono_profiler_init (const char *desc)
+ * void mono_profiler_init_foo (const char *desc)
* {
* }
*
MONO_API mono_bool mono_profiler_enable_sampling (MonoProfilerHandle handle);
/*
- * Sets the sampling mode and frequency (in Hz). If the calling profiler has
- * ownership over sampling settings, the settings will be changed and this
- * function will return TRUE; otherwise, it returns FALSE without changing any
- * settings.
+ * Sets the sampling mode and frequency (in Hz). The frequency must be a
+ * positive number. If the calling profiler has ownership over sampling
+ * settings, the settings will be changed and this function will return TRUE;
+ * otherwise, it returns FALSE without changing any settings.
*
* This function is async safe.
*/
-MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint64_t freq);
+MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq);
/*
* Retrieves the current sampling mode and/or frequency (in Hz). Returns TRUE if
*
* This function is async safe.
*/
-MONO_API mono_bool mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint64_t *freq);
+MONO_API mono_bool mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq);
/*
* Enables instrumentation of GC allocations. This is necessary so that managed
*/
MONO_API void mono_profiler_set_call_instrumentation_filter_callback (MonoProfilerHandle handle, MonoProfilerCallInstrumentationFilterCallback cb);
+#ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS
typedef enum {
/* Upper 2 bytes. */
MONO_PROFILER_GC_ROOT_PINNING = 1 << 8,
MONO_PROFILER_GC_ROOT_TYPEMASK = 0xff,
} MonoProfilerGCRootType;
+#endif
typedef enum {
/* data = MonoMethod *method */
MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING = 9,
} MonoProfilerCodeBufferType;
-// Keep somewhat in sync with libgc/include/gc.h : GC_EventType.
typedef enum {
- MONO_GC_EVENT_START = 0,
- MONO_GC_EVENT_MARK_START = 1,
- MONO_GC_EVENT_MARK_END = 2,
- MONO_GC_EVENT_RECLAIM_START = 3,
- MONO_GC_EVENT_RECLAIM_END = 4,
- MONO_GC_EVENT_END = 5,
MONO_GC_EVENT_PRE_STOP_WORLD = 6,
/* When this event arrives, the GC and suspend locks are acquired. */
MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED = 10,
MONO_GC_EVENT_POST_STOP_WORLD = 7,
+ MONO_GC_EVENT_START = 0,
+ MONO_GC_EVENT_END = 5,
MONO_GC_EVENT_PRE_START_WORLD = 8,
/* When this event arrives, the GC and suspend locks are released. */
MONO_GC_EVENT_POST_START_WORLD_UNLOCKED = 11,