95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'ext/gcprof/gcprof.c', line 95
static VALUE
set_after_gc_hook(VALUE module, VALUE proc)
{
rb_event_flag_t events;
/* disable previous keys */
if (RTEST(_gcprof.tpval)) {
rb_tracepoint_disable(_gcprof.tpval);
_gcprof.tpval = Qnil;
_gcprof.proc = Qnil;
}
if (RTEST(proc)) {
if (!rb_obj_is_proc(proc)) {
rb_raise(rb_eTypeError, "trace_func needs to be Proc");
}
events = RUBY_INTERNAL_EVENT_GC_START|RUBY_INTERNAL_EVENT_GC_END_MARK|RUBY_INTERNAL_EVENT_GC_END_SWEEP;
_gcprof.tpval = rb_tracepoint_new(0, events, gc_hook_i, (void *)0);
_gcprof.proc = proc;
rb_tracepoint_enable(_gcprof.tpval);
}
return proc;
}
|