From: Aaron Patterson Date: 2012-07-30T05:55:52+09:00 Subject: [ruby-core:46870] Re: [ruby-trunk - Feature #2565] adding hooks for better tracing --qjNfmADvan18RZcF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 29, 2012 at 12:02:27PM +0900, SASADA Koichi wrote: > Sorry for late response. >=20 > (2012/07/19 3:52), tenderlovemaking (Aaron Patterson) wrote: > > https://bugs.ruby-lang.org/projects/ruby/wiki/DTraceProbes >=20 > my comments: >=20 > > ruby:::function-entry(classname, methodname, filename, lineno); > > ruby:::function-return(classname, methodname, filename, lineno); >=20 > set_trace_func spearates "call" and "c-call" (and return). > No need to separate on dtrace? I don't think we need to separate these. Information like that hasn't been useful to me when debugging or profiling my ruby programs. > > ruby:::require-entry(requiredfile, filename, lineno); > > ruby:::require-return(filename); > > ruby:::load-entry(loadedfile, filename, lineno); > > ruby:::load-return(filename); >=20 > Do we need `require' and `load' both needed? (It depends on usecase) I'm not sure we need both. What I *want* is a way to know when Ruby starts and finishes loading a file. > What happen on exception? The `raise` probe is fired. > (There is a same question on `function-entry') >=20 > > ruby:::object-create-start(classname, filename, lineno); > > ruby:::object-create-done(classname, filename, lineno); >=20 > (1) How to detect object creation and finish of creation? rb_obj_alloc has probes. It wraps object allocation. > (2) I can't accept your patch on insns.def on string and array. Why? You want specific string / array / hash probes (like below)? > IIRC, you suggest that String creation trace and Array creation trace > and so on. I write examples: >=20 > ruby:::string-create(filename, lineno, size) > ruby:::array-create(filename, lineno, size) > ruby:::hash-create(filename, lineno, size) > ruby:::object-create(filename, lineno, classname) >=20 > size is string or array size. > classname is a classname of object. These seem good. I can implement them. > I'm not sure we need string-modified (size) are needed. I tried doing this once, but it seemed like the patch was too large. I wanted to start small. :) > ruby:::object-collected(object_id) will be help. To use it correctly, > object-create needs to pass object_id. But it will be complicated. >=20 > > ruby:::gc-begin(); > > ruby:::gc-end(); >=20 > How to define GC begin and end? Nari-san already has defined GC begin and end for GC::Profiler. See the GC_PROF_TIMER_START and GC_PROF_TIMER_STOP macros: https://github.com/ruby/ruby/blob/trunk/gc.c#L180 https://github.com/ruby/ruby/blob/trunk/gc.c#L199 My patch just adds the DTrace probes to his existing macros. > > ruby:::gc-sweep-begin(); > > ruby:::gc-sweep-end(); >=20 > How to define GC sweep begin and end? Same here. Nari-san has already defined GC_PROF_SWEEP_TIMER_START and GC_PROF_SWEEP_TIMER_STOP for GC::Profiler. My patch just adds probes by his existing macros. > > ruby:::line(filename, lineno); >=20 > Your patch depends on the `trace' instruction. I plan to remove `trace' > instruction on default (if I can implement it). It will conflicts with > your proposed patch. > Or I shouldn't make such optimizations? I think we should remove this. I added it for backwards compatibility with Joyant's DTrace probes, but I never use this. Besides backwards compatibility, I don't think it's a useful probe. --=20 Aaron Patterson http://tenderlovemaking.com/ --qjNfmADvan18RZcF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) iQEcBAEBAgAGBQJQFaNYAAoJEJUxcLy0/6/GJx0H/Ar0O7Co7Ucw/Dss6ORldhZD UUdkHzMmwJIRvAms0vwXJTQ1SHRj6A+QW+0+YTJgXPtxLV7uuB5enciAHngNpWkE Y/vAA4mOL6tB+gudEVLsUHRUd9AnXX3yeVJX3QRvnvJAcYTCSSIu5s+twp7rRkP+ b65QWQdRyypqai3Uhh8AxJ7LBK26jX9WI1jwdUbywlQqLCLLyTVx3rkpQpjzi22B e9rf7aNHF7V34fmUjeTtf8hdvVrmKQTTYc/SiXsbzFqQoGFWTJMKWTmMEG1ToYAS bWi/3/vpPu1lTzakEiCEOH1tJ9eMpRzddgwvqIXc58SwlAczhHRLlBb+8UESRYo= =/ECQ -----END PGP SIGNATURE----- --qjNfmADvan18RZcF--