INNER CODE UNIT · Ruby

profile_scenario

bolshakov/stoplight · bench/prof.rb:26

def profile_scenario(name, measurement_mode = RubyProf::WALL_TIME)
  RubyProf.measure_mode = measurement_mode
  RubyProf.start

  yield

  result = RubyProf.stop

  PROF_TYPES.each_pair do |type, klass|
    File.open("profile_results/#{name}_#{type}.txt", "w") do |file|
      klass.new(result).print(file)
    end
  end
end

profile_scenario("success", RubyProf::PROCESS_TIME) do
  50.times do
    stoplight.run {}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…