Ruby Programming/Standard Library/Profiler
Description[edit | edit source]
Ruby has a "pure ruby" profiler that comes with the standard lib.
To use it
ruby -rprofile file_name.rb
somewhere in your script (it will profile after that point). See profile.rb file
$ gem which profile.rb
to see an example of how it starts itself.
This will work with any version of Ruby, but doesn't accommodate for multiple threads, and it uses uses set_trace_func, which is slow.
If you're on MRI, checkout the ruby-prof gem as a C'ified profiler that works much faster and accommodates for threads. Jruby also has a jruby-prof gem.