#include <mono/metadata/profiler-private.h>
#include <mono/utils/mono-dl.h>
#include <mono/utils/mono-error-internals.h>
+#include <mono/utils/mono-logger-internals.h>
MonoProfilerState mono_profiler_state;
char *err;
if (!(err = mono_dl_symbol (module, old_name, (gpointer) &func))) {
- g_warning ("Found old-style startup symbol %s; profiler has not been migrated to the new API.", old_name);
+ mono_profiler_printf_err ("Found old-style startup symbol %s for %s; profiler has not been migrated to the new API.", old_name, desc);
g_free (old_name);
return FALSE;
}
MonoDl *module = mono_dl_open (NULL, MONO_DL_EAGER, &err);
if (!module) {
- g_warning ("Could not open main executable (%s).", err);
+ mono_profiler_printf_err ("Could not open main executable: %s", err);
g_free (err);
return FALSE;
}
res = load_profiler_from_directory (NULL, libname, desc);
if (!res)
- g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
+ mono_profiler_printf_err ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
g_free (libname);
}
}
mono_bool
-mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint64_t freq)
+mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq)
{
if (handle != mono_profiler_state.sampling_owner)
return FALSE;
mono_profiler_state.sample_mode = mode;
mono_profiler_state.sample_freq = freq;
- mono_os_sem_post (&mono_profiler_state.sampling_semaphore);
+ mono_profiler_sampling_thread_post ();
return TRUE;
}
mono_bool
-mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint64_t *freq)
+mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq)
{
if (mode)
*mode = mono_profiler_state.sample_mode;
}
void
-mono_profiler_sampling_thread_sleep (void)
+mono_profiler_sampling_thread_post (void)
+{
+ mono_os_sem_post (&mono_profiler_state.sampling_semaphore);
+}
+
+void
+mono_profiler_sampling_thread_wait (void)
{
mono_os_sem_wait (&mono_profiler_state.sampling_semaphore, MONO_SEM_FLAGS_NONE);
}