module Bench::JSONFormatter
Public Class Methods
format(options, measurements)
click to toggle source
# File lib/bench9000/json-formatter.rb, line 15 def self.format(options, measurements) benchmarks = options.benchmarks implementations = options.implementations JSON.pretty_generate({ benchmarks: benchmarks, implementations: implementations, measurements: benchmarks.product(implementations).map do |b, i| measurement = measurements[b, i] if measurement == :failed { benchmark: b, implementation: i, failed: true } else { benchmark: b, implementation: i, warmup_time: measurement.warmup_time, sample_mean: measurement.sample_mean, sample_error: measurement.sample_error, score: measurement.score, score_error: measurement.score_error, warmup_samples: measurement.warmup_samples, samples: measurement.samples } end end }) end