Hi,

I made a commit that embeded dtrace probes into Ruby so that you can
profile a Ruby application at runtime. (r26235)

Adding probes had been approved by a Ruby developer's meeting,
however, the commit was little larger than what other committers
expected. I got some objection for the commit. [ruby-dev:39954]
In the end, I decided to temporarily revert the commit. (r26243)

I discussed how we should support dynamic runtime tracing, with ko1,
mame, naruse, unak and shyouhei. The problems of the commit were:
* the probes duplicated with the event_hook framework
(rb_add_event_hook, Kernel#set_trace_func)
* Design of the probes were not verified enough.
  * more trial and error are necessary, to make it clear what is
necessary to trace a Ruby application.

I accepted ko1's suggestion:
* reverting the commit
* adding some hooks for rb_add_event_hook().
* implementing probes for dynamic runtime tracing on the event_hook framework.
  * these probes can be implemented as a gem
  * I will aget a chance for trial and error.
  * The probes possibly will be merged into Ruby itself after enough
designed and getting enough use cases.

Here is a patch to add the hooks I and ko1 talked about. (attached)
And here is an extension library that provides prove points to dtrace,
on top of the hooks. (http://github.com/yugui/vm_probes )

What do you think?  Can I commit the patch I attached?

Thank you,
-- Yuki Sonoda (Yugui)
ZGlmZiAtLWdpdCBhL2NvbXBpbGUuYyBiL2NvbXBpbGUuYwppbmRleCA1NGI1MTNjLi5lYTQyNjhh
IDEwMDY0NAotLS0gYS9jb21waWxlLmMKKysrIGIvY29tcGlsZS5jCkBAIC0zNTY5LDYgKzM1Njks
NyBAQCBpc2VxX2NvbXBpbGVfZWFjaChyYl9pc2VxX3QgKmlzZXEsIExJTktfQU5DSE9SICpyZXQs
IE5PREUgKiBub2RlLCBpbnQgcG9wZWQpCiAJICAgIH0KIAkgICAgQUREX0lOU05MKHJldCwgbmRf
bGluZShub2RlKSwganVtcCwgbGFiZWxfbWlzcyk7CiAJICAgIEFERF9MQUJFTChyZXQsIGxhYmVs
X2hpdCk7CisJICAgIEFERF9UUkFDRShyZXQsIG5kX2xpbmUobm9kZSksIFJVQllfRVZFTlRfUkVT
Q1VFKTsKIAkgICAgQ09NUElMRShyZXQsICJyZXNib2R5IGJvZHkiLCByZXNxLT5uZF9ib2R5K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