Module: BenchmarkDriver::Runner
- Defined in:
- lib/benchmark_driver/runner.rb
Defined Under Namespace
Classes: Block, CommandStdout, Ips, Memory, Once, Recorded, RubyStdout, Time
Class Method Summary collapse
-
.run(jobs, config:) ⇒ Object
Main function which is used by both CLI and ‘Benchmark.driver`.
Class Method Details
.run(jobs, config:) ⇒ Object
Main function which is used by both CLI and ‘Benchmark.driver`.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/benchmark_driver/runner.rb', line 17 def run(jobs, config:) if config.verbose >= 1 config.executables.each do |exec| $stdout.puts "#{exec.name}: #{IO.popen([*exec.command, '-v'], &:read)}" end end runner_config = Config::RunnerConfig.new runner_config.members.each do |member| runner_config[member] = config[member] end jobs.group_by{ |j| j.respond_to?(:contexts) && j.contexts }.each do |contexts, contexts_jobs| contexts_jobs.group_by(&:metrics).each do |metrics, metrics_jobs| metrics_jobs.group_by(&:class).each do |klass, klass_jobs| runner = runner_for(klass) contexts = build_contexts(contexts, executables: config.executables) output = Output.new( type: config.output_type, metrics: metrics, jobs: klass_jobs.map { |job| BenchmarkDriver::Job.new(name: job.name) }, contexts: contexts, options: config.output_opts, ) with_clean_env do runner.new(config: runner_config, output: output, contexts: contexts).run(klass_jobs) end end end end end |