Properly reformat bonnie's micro and millisecond results when tabulating results

This commit is contained in:
R. Tyler Croy 2014-11-20 10:15:28 -08:00
parent 0ba058612a
commit b843e2a759
1 changed files with 22 additions and 8 deletions

View File

@ -4,14 +4,28 @@ require 'rubygems'
require 'colorize'
require 'csv'
out = File.open('report.csv', 'w+')
out.write(File.open('bonnie-header.csv').read)
out.write("\n")
CSV.open('report.csv', 'w+') do |csv|
CSV.foreach('bonnie-header.csv') do |row|
csv << row
end
Dir['./results/*.csv'].each do |f|
puts "processing #{f}".green
out.write(File.open(f).read)
Dir['./results/*.csv'].each do |f|
puts "processing #{f}".green
CSV.foreach(f) do |row|
row.each_with_index do |element, index|
next if element.nil?
if element.match(/us/)
element = element.to_f / 1_000_000
elsif element.match(/ms/)
element = element.to_f / 1_000
end
row[index] = element
end
csv << row
end
end
end
out.close