G'Day,
On Thu, Jun 19, 2008 at 12:58:04PM -0700, Yehuda Katz wrote:
>
> I'm trying to put together a dtrace script that'll track the hottest
> Ruby lines, but I'm afraid I'm far too much of a green n00b to even
> get started with such a task. I'm kind of surprised something along
> these lines doesn't already exist, but I'm happy to release it once
> done.
>
> The plan is to use it to streamline the Merb framework in the run-up
> to 1.0
The Ruby provider has been designed to make such tasks easy. It can
count lines, which will catch many hot spots, with a one-liner:
dtrace -n 'ruby*:::line { @calls[basename(copyinstr(arg0)), arg1] = count(); }'
It exists in the DTraceToolkit as a script, in case people start looking
there, although the script only formats the output neatly:
# rb_lines.d
Tracing... Hit Ctrl-C to end.
^C
FILE:LINE COUNT
func_slow.rb:3 1
func_slow.rb:4 1
func_slow.rb:5 1
func_slow.rb:6 1
func_slow.rb:12 1
func_slow.rb:13 1
func_slow.rb:14 1
func_slow.rb:15 1
func_slow.rb:19 1
func_slow.rb:22 1
func_slow.rb:23 1
func_slow.rb:24 1
func_slow.rb:25 1
func_slow.rb:29 1
func_slow.rb:32 1
func_slow.rb:26 100000
func_slow.rb:27 100000
func_slow.rb:16 200000
func_slow.rb:17 200000
func_slow.rb:7 300000
func_slow.rb:8 300000
Untar the DTraceToolkit (http://freshmeat.net/projects/dtracetoolkit)
and look for:
/Ruby scripts
/Examples/rb_*.txt example outputs from those scripts
/Man/man1/rb_*.1 man pages
/Code/Ruby example Ruby code for testing
Brendan
--
Brendan
[CA, USA]
_______________________________________________
dtrace-discuss mailing list
[email protected]