Does ruby-prof actually work?

I am running rails 2.1 and cannot get ruby-prof, or more acurately,
the script/performance/request to work.

Installing ruby-prof I get this:
sudo gem install ruby-prof
Building native extensions. This could take a while…
Successfully installed ruby-prof-0.6.0
1 gem installed
Installing ri documentation for ruby-prof-0.6.0…

No definition for prof_get_cpu_frequency

No definition for prof_set_cpu_frequency
Installing RDoc documentation for ruby-prof-0.6.0…

No definition for prof_get_cpu_frequency

No definition for prof_set_cpu_frequency

Which looks like it is having problems in the docs, so ok.

If I run:
script/performance/request lib/prof_scripts/store_browse_profiler.rb

I get:
Warming up once
3.80 sec, 1 requests, 0 req/sec

Profiling 100x
gem install ruby-prof to use the profiler

but doing a gem list has:
ruby-prof (0.6.0)

I can run ruby-prof from the command line:
ruby-prof lib/prof_scripts/store_browse_profiler.rb

But it (obviously) doesn’t understand the file as it has a ‘get’ in
it.

Help!

Phil,

Did you have any joy getting this working?

I have the exact same problem as you.

Paul

No - no luck

On Jul 26, 1:05 pm, “[email protected]

Please use Jeremy Kamper’s ruby-prof :
http://github.com/jeremy/ruby-prof/tree/master

gem sources -a http://gems.github.com
sudo gem install jeremy-ruby-prof

On Fri, Jul 18, 2008 at 3:06 PM, phil [email protected] wrote:

but doing a gem list has:


Cheers!

Pratik,

Thanks for the response, but that didnt work for me.

With both ruby-profs installed I get:

./test/performance/tree_profiler.rb:1: undefined method `get’ for
main:Object (NoMethodError)

After uninstalling ruby-prof with just jeremy-ruby-prof I get:

dyld: NSLinkModule() error
dyld: Symbol not found: _rb_os_allocated_objects
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/jeremy-ruby-
prof-0.6.1/lib/ruby_prof.bundle
Expected in: flat namespace

Trace/BPT trap

In both instances I restarted the server after install…thinking that
ruby-prof might need to get its hooks into the server somehow.

Paul

For some bizarre reason I can now get performance/request to work. All
I did was a complete shutdown/restart… very wierd!

I have the same problem. However a restart didn’t help. Have anyone
found the reason for this problem?

10x in advance.

I also see this error

dyld: NSLinkModule() error
dyld: Symbol not found: _rb_os_allocated_objects
Referenced from:
/opt/local/lib/ruby/gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby_prof.bundle
Expected in: flat namespace

Trace/BPT trap

Yes, I first uninstalled ruby-prof:
sudo gem uninstall ruby-prof
then did
gem sources -a http://gems.github.com
sudo gem install jeremy-ruby-prof

generated an empty file called prof_script.rb

Get this error:
$ ruby-prof lib/prof_script.rb
/Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby-prof/
flat_printer.rb:40:in print_methods': wrong argument type Symbol (expected Proc) (TypeError) from /Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby-prof/ flat_printer.rb:33:in print_threads’
from /Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby-prof/
flat_printer.rb:32:in each' from /Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby-prof/ flat_printer.rb:32:in print_threads’
from /Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/lib/ruby-prof/
flat_printer.rb:26:in `print’
from /Library/Ruby/Gems/1.8/gems/jeremy-ruby-prof-0.6.1/bin/ruby-prof:
171
from /usr/bin/ruby-prof:19