Profiling Tests
Hydra uses ruby-prof for profiling.
First of all, it is ruby prof! But when you use ruby prof, you have to run it around a chunk of code. Rails comes with some helpers for this, and they are great at telling you what is slow about a single isolated chunk of code.
But running ruby-prof on Hydra means you get one combined report for all of your tests (across all your frameworks) that aggregates the results of ruby-prof for you.
Setting up a profile task is just like setting up a test task, except you get a few new options:
Hydra::ProfileTask.new('hydra:prof') do |t| t.add_files 'test/unit/**/*_test.rb' t.add_files 'test/functional/**/*_test.rb' t.add_files 'test/integration/**/*_test.rb' t.generate_html = true # defaults to false t.generate_text = true # defaults to true # put any setup you don't want to profile here # useful for removing environment load from the output require 'test/test_helper.rb' # or spec helper or anything else end
Choose whether or not to generate an HTML report. HTML reports are more detailed, but they take longer to produce. Off by default.
Choose whether or not the generate a text report. On by default.
Scroll down to the Reports section and check out their examples.