[profiler] Profiler entry point name must now include the module name.
[mono.git] / mono / metadata / profiler.h
index 74a9e651ba4064d0a96ae22dc370f4d2b2268170..5063431bc8bf1b2ed2a7b21e5a8e0b8a007e78fd 100644 (file)
 
 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
@@ -20,9 +27,9 @@ MONO_BEGIN_DECLS
  * 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)
  * {
  * }
  *
@@ -127,14 +134,14 @@ typedef enum {
 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
@@ -143,7 +150,7 @@ MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, Mon
  *
  * 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
@@ -189,6 +196,7 @@ typedef MonoProfilerCallInstrumentationFlags (*MonoProfilerCallInstrumentationFi
  */
 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,
@@ -204,6 +212,7 @@ typedef enum {
 
        MONO_PROFILER_GC_ROOT_TYPEMASK = 0xff,
 } MonoProfilerGCRootType;
+#endif
 
 typedef enum {
        /* data = MonoMethod *method */
@@ -220,18 +229,13 @@ typedef enum {
        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,