Class: Bench::Commands::Detail

Inherits:
Command
  • Object
show all
Defined in:
lib/bench9000/commands/detail.rb

Instance Method Summary collapse

Methods inherited from Command

#before

Instance Method Details

#after(options, measurements) ⇒ Object



42
43
44
45
46
# File 'lib/bench9000/commands/detail.rb', line 42

def after(options, measurements)
  if options.flags.has_key? "--json"
    puts JSONFormatter.format(options, measurements)
  end
end

#benchmark_complete(options, b, measurements) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bench9000/commands/detail.rb', line 28

def benchmark_complete(options, b, measurements)
  if options.flags.has_key? "--benchmark-per-line"
    puts "#{b} " + options.implementations.map { |i|
      measurement = measurements[b, i]

      if measurement == :failed
        "failed"
      else
        "#{measurement.warmup_time} #{measurement.sample_mean} #{measurement.score}"
      end
    }.join(" ")
  end
end

#result(options, b, i, measurement) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bench9000/commands/detail.rb', line 16

def result(options, b, i, measurement)
  if options.flags.has_key? "--value-per-line"
    if measurement == :failed
      puts "#{b} #{i} failed"
    else
      puts "#{b} #{i} warmup #{measurement.warmup_time}"
      puts "#{b} #{i} sample #{measurement.sample_mean}"
      puts "#{b} #{i} score #{measurement.score}"
    end
  end
end