lib/benchmark/runner/exec.rb in benchmark_driver-0.8.2 vs lib/benchmark/runner/exec.rb in benchmark_driver-0.8.3

- old
+ new

@@ -1,9 +1,9 @@ -require 'bundler' require 'tempfile' require 'shellwords' require 'benchmark/driver/benchmark_result' +require 'benchmark/driver/bundler' require 'benchmark/driver/duration_runner' require 'benchmark/driver/repeatable_runner' require 'benchmark/driver/error' require 'benchmark/driver/time' @@ -77,11 +77,11 @@ elsif fields == [:max_rss] # TODO: we can also capture other metrics with /usr/bin/time raise '/usr/bin/time is not available' unless File.exist?('/usr/bin/time') script = BenchmarkScript.new(job.prelude, job.script).full_script(job.loop_count) with_file(script) do |script_path| - out = Bundler.with_clean_env { IO.popen(['/usr/bin/time', *executable.command, script_path], err: [:child, :out], &:read) } + out = Benchmark::Driver::Bundler.with_clean_env { IO.popen(['/usr/bin/time', *executable.command, script_path], err: [:child, :out], &:read) } match_data = /^(?<user>\d+.\d+)user\s+(?<system>\d+.\d+)system\s+(?<elapsed1>\d+):(?<elapsed2>\d+.\d+)elapsed.+\([^\s]+\s+(?<maxresident>\d+)maxresident\)k$/.match(out) raise "Unexpected format given from /usr/bin/time:\n#{out}" unless match_data[:maxresident] Benchmark::Driver::BenchmarkResult.new(job).tap do |result| result.max_rss = Integer(match_data[:maxresident]) @@ -151,10 +151,10 @@ def measure_seconds(command, script) with_file(script) do |path| cmd = [*command, path].shelljoin - Bundler.with_clean_env do + Benchmark::Driver::Bundler.with_clean_env do before = Benchmark::Driver::Time.now system(cmd, out: File::NULL) after = Benchmark::Driver::Time.now after.to_f - before.to_f