Permalink
Browse files

Fix for 1.9

  • Loading branch information...
1 parent 7e102da commit 2fe524f20f14ca721ca8ecb8e3a20e75522039b4 @tmm1 committed Nov 13, 2010
Showing with 11 additions and 0 deletions.
  1. +11 −0 ext/perftools.c
View
11 ext/perftools.c
@@ -339,18 +339,29 @@ uc_get_ip(ucontext_t *uc) {
return (char**)&uc->program_counter;
}
+#ifdef RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+static void
+event_handler(rb_event_flag_t event, VALUE data, VALUE self, ID id, VALUE klass) {
+ ProfilerRecord(0, NULL, NULL);
+}
+#else
static void
event_handler(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass) {
ProfilerRecord(0, NULL, NULL);
}
+#endif
static VALUE
methprofiler_setup()
{
if (bMethProfilerRunning)
return Qtrue;
+#ifdef RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+ rb_add_event_hook(event_handler, RUBY_EVENT_CALL|RUBY_EVENT_C_CALL, 0);
+#else
rb_add_event_hook(event_handler, RUBY_EVENT_CALL|RUBY_EVENT_C_CALL);
+#endif
bMethProfilerRunning = Qtrue;
return Qtrue;

0 comments on commit 2fe524f

Please sign in to comment.