class BenchmarkDriver::Output::Record
def initialize(metrics:, jobs:, contexts:)
-
contexts
(Array
) -- -
jobs
(Array
) -- -
metrics
(Array
) --
def initialize(metrics:, jobs:, contexts:) @metrics = metrics @job_warmup_context_result = Hash.new do |h1, job| h1[job] = Hash.new do |h2, warmup| h2[warmup] = Hash.new do |h3, context| h3[context] = {} end end end end
def report(result)
-
result
(BenchmarkDriver::Result
) --
def report(result) $stdout.print '.' @job_warmup_context_result[@job][!@with_benchmark][@context] = result end
def save_record
def save_record yaml = { 'type' => 'recorded', 'job_warmup_context_result' => @job_warmup_context_result, 'metrics' => @metrics, }.to_yaml File.write('benchmark_driver.record.yml', yaml) end
def with_benchmark(&block)
def with_benchmark(&block) @with_benchmark = true $stdout.print 'benchmarking' block.call ensure $stdout.puts @with_benchmark = false save_record end
def with_context(context, &block)
-
context
(BenchmarkDriver::Context
) --
def with_context(context, &block) @context = context block.call end
def with_job(job, &block)
-
job
(BenchmarkDriver::Job
) --
def with_job(job, &block) @job = job block.call end
def with_warmup(&block)
def with_warmup(&block) $stdout.print 'warming up' block.call ensure $stdout.puts end