class Bench::Commands::Reference

Public Instance Methods

after(options, measurements) click to toggle source
# File lib/bench9000/commands/reference.rb, line 39
def after(options, measurements)
  @file.close
end
before(options, existing_measurements) click to toggle source
# File lib/bench9000/commands/reference.rb, line 14
def before(options, existing_measurements)
  if options.implementations.size != 1
    puts "needs exactly one implementation"
    exit 1
  end

  @file = File.open("reference.txt", "w")
  @file.puts "version #{CONFIG_VERSION}"
  @file.flush

  true
end
result(options, b, i, measurement) click to toggle source
# File lib/bench9000/commands/reference.rb, line 27
def result(options, b, i, measurement)
  if measurement == :failed
    score = "failed"
  else
    score = measurement.score
  end

  puts "#{b.name} #{score}"
  @file.puts "#{b.name} #{score}"
  @file.flush
end