Sha256: d3d3353f1726f949ff8685b9983f675a34576f0b44490367fa3369b753d98c02

Contents?: true

Size: 796 Bytes

Versions: 26

Compression:

Stored size: 796 Bytes

Contents

require 'benchmark_driver/default_job'
require 'benchmark_driver/default_job_parser'

class BenchmarkDriver::Runner::Block < BenchmarkDriver::Runner::Ips
  METRIC = BenchmarkDriver::Metric.new(name: 'Iteration per second', unit: 'i/s')

  # JobParser returns this, `BenchmarkDriver::Runner.runner_for` searches "*::Job"
  Job = Class.new(BenchmarkDriver::DefaultJob)

  # Dynamically fetched and used by `BenchmarkDriver::JobParser.parse`
  JobParser = BenchmarkDriver::DefaultJobParser.for(klass: Job, metrics: [METRIC]).extend(Module.new{
    def parse(**)
      jobs = super
      jobs.map do |job|
        job = job.dup
        job.prelude = "#{job.prelude}\n__bmdv_script_block = proc { #{job.script} }"
        job.script = '__bmdv_script_block.call'
        job
      end
    end
  })
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
benchmark_driver-0.15.4 lib/benchmark_driver/runner/block.rb
benchmark_driver-0.15.3 lib/benchmark_driver/runner/block.rb
benchmark_driver-0.15.2 lib/benchmark_driver/runner/block.rb
benchmark_driver-0.15.1 lib/benchmark_driver/runner/block.rb
benchmark_driver-0.15.0 lib/benchmark_driver/runner/block.rb
benchmark_driver-0.14.22 lib/benchmark_driver/runner/block.rb