From: "ko1 (Koichi Sasada)" Date: 2012-07-25T19:06:19+09:00 Subject: [ruby-core:46758] [ruby-trunk - Feature #6649][Rejected] Add new set_trace_func events "b-call", "b-return" Issue #6649 has been updated by ko1 (Koichi Sasada). Status changed from Assigned to Rejected Nobody has interest about it. I close (reject) this ticket and make new ticket of , with implementation. If you have any idea, please teach me. ---------------------------------------- Feature #6649: Add new set_trace_func events "b-call", "b-return" https://bugs.ruby-lang.org/issues/6649#change-28429 Author: ko1 (Koichi Sasada) Status: Rejected Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: =begin = Abstract Add new events "b-call", "b-return" for set_trace_func(). When block is invoked, then "b-call" is called. When block is finished, then "b-return" is called. = Background set_trace_func() has several events: * "line" * "call", "return" * "c-call", "c-return" * "class", "end" * "raise" With above events, we can trace execution. However, we can't trace block invocation because there are no events related to block invocation and return from block. For example, performance profiler using set_trace_func() has problem in such case: def m1 yield end def m2 m1 do # long time process end end A method `m1' doesn't consume time, but `m2' consume long time (within block). However, the profiler detects that the method `m1' consumes long time. = Proposal Add "b-call" and "b-return" events for set_trace_func. "b-call" is for block invocation. "b-return" is for returning from block. Parameters: * event: "b-call" or "b-return" * file: filename of block * line: start/end line number of block * id: block owner method id * binding: binding of block * klass: block owner class = Concerns * This proposal breaks 100% compatibility. It seems problem (*1). * It will make some runtime overhead (slow down). * parameters id and klass is appropriate? (*1) Making an alternative API which can replace set_trace_func() (correctly speaking, set_trace_func() can be implemented with this new API) is another proposal. # as usual, the method name is temporary name set_trace_func2(lamda{|info| info.event ... } =end -- http://bugs.ruby-lang.org/