+Mon Jan 24 16:42:29 CET 2005 Paolo Molaro <lupus@ximian.com>
+
+ * gc-internal.h, null-gc.c, profiler.c, boehm-gc.c: hook the
+ GC events to the profiler.
+
Mon Jan 24 15:59:54 CET 2005 Paolo Molaro <lupus@ximian.com>
* gc.c: remove valgrind detection nonsense. Set GC_DONT_GC
#include <mono/os/gc_wrapper.h>
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/profiler-private.h>
#if HAVE_BOEHM_GC
#endif
}
+extern int GC_is_marked (void *p);
+
gboolean
mono_object_is_alive (MonoObject* o)
{
#endif
}
+#ifdef USE_INCLUDED_LIBGC
+
+static void
+on_gc_notification (GCEventType event)
+{
+ mono_profiler_gc_event ((MonoGCEvent) event, 0);
+}
+
+static void
+on_gc_heap_resize (size_t new_size)
+{
+ mono_profiler_gc_heap_resize (new_size);
+}
+
+void
+mono_gc_enable_events (void)
+{
+ GC_notify_event = on_gc_notification;
+ GC_on_heap_resize = on_gc_heap_resize;
+}
+
+#else
+
+void
+mono_gc_enable_events (void)
+{
+}
+
+#endif
+
#endif /* no Boehm GC */
extern gboolean mono_object_is_alive (MonoObject* obj);
extern gboolean mono_gc_is_finalizer_thread (MonoThread *thread);
extern gpointer mono_gc_out_of_memory (size_t size);
+extern void mono_gc_enable_events (void);
#endif /* __MONO_METADATA_GC_H__ */
return TRUE;
}
+void
+mono_gc_enable_events (void)
+{
+}
+
#endif
#include "mono/metadata/mono-debug.h"
#include "mono/metadata/class-internals.h"
#include "mono/metadata/domain-internals.h"
+#include "mono/metadata/gc-internal.h"
#include "mono/io-layer/io-layer.h"
#include <string.h>
#include <sys/time.h>
void
mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback)
{
+ mono_gc_enable_events ();
gc_event = callback;
gc_heap_resize = heap_resize_callback;
}