What can I use to profile code in 1.9.2? All of the versions of ruby-prof I've found segfault against 1.9.2.
For instance, when I add
gem "ruby-prof"
to my Rails project's Gemfile and run
bundle
bundle exec ruby-prof config/environment.rb
I get a segfault.
Is there a new profiling gem in town? Is there a way to make ruby-prof play nice?
Not sure it helps but I stumbled on this which may add a bit more clarity or lead you down a different path: http://www.devheads.net/development/ruby/core/segmentation-fault-when-using-ruby-prof-and-ruby-192.htm. You may want to check out wycats' fork based on that thread: https://github.com/wycats/ruby-prof
Also, I have not tried it out myself and it may not be exactly what you are looking for but Aman of Github fame has a port of google-perftools for Ruby: https://github.com/tmm1/perftools.rb
As @chris.baglieri suggested, you can use the perftools.rb
gem for profiling Ruby 1.9 code.
gem install perftools.rb
Then
require 'perftools'
PerfTools::CpuProfiler.start('profile_data') do
# something cpu-intensive
end
`pprof.rb --text profile_data profile.txt`
`pprof.rb --pdf profile_data profile.pdf`
You can use another popular profiler tool - MethodProfiler
It's very handy to find slow method in the target class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With