Skip to content

Instantly share code, notes, and snippets.

@kfigiela
Created December 5, 2013 12:06
Show Gist options
  • Save kfigiela/7804216 to your computer and use it in GitHub Desktop.
Save kfigiela/7804216 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'benchmark'
require 'yaml'
commands = File.open(ARGV[0], 'r') do |file|
file.readlines
end.map(&:strip)
results = []
commands.each_with_index do |cmd, index|
times = Benchmark.measure(cmd) do
pid = Kernel.spawn(cmd, :out=>"/dev/null")
Process.wait pid
end
results << times
File.open(ARGV[1], 'w') do |out|
YAML.dump(results, out)
end
puts "%4d/%d" % [index, commands.length]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment