* benchmark/driver.rb (show_results): Show speedup ratio
with first executables score at last of results if two or more executrables are given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64b1751194
commit
f8c2a968dd
@ -1,3 +1,9 @@
|
|||||||
|
Tue Oct 16 22:24:44 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* benchmark/driver.rb (show_results): Show speedup ratio
|
||||||
|
with first executables score at last of results
|
||||||
|
if two or more executrables are given.
|
||||||
|
|
||||||
Tue Oct 16 21:59:01 2012 Koichi Sasada <ko1@atdot.net>
|
Tue Oct 16 21:59:01 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* benchmark/driver.rb: some refactoring.
|
* benchmark/driver.rb: some refactoring.
|
||||||
|
@ -90,8 +90,27 @@ class BenchmarkDriver
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def average results
|
def adjusted_results name, results
|
||||||
results.inject(:+) / results.length
|
s = nil
|
||||||
|
results.each_with_index{|e, i|
|
||||||
|
r = e.min
|
||||||
|
case name
|
||||||
|
when /^vm1_/
|
||||||
|
if @loop_wl1
|
||||||
|
r -= @loop_wl1[i]
|
||||||
|
r = 0 if r < 0
|
||||||
|
s = '*'
|
||||||
|
end
|
||||||
|
when /^vm2_/
|
||||||
|
if @loop_wl2
|
||||||
|
r -= @loop_wl2[i]
|
||||||
|
r = 0 if r < 0
|
||||||
|
s = '*'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
yield r
|
||||||
|
}
|
||||||
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_results
|
def show_results
|
||||||
@ -113,30 +132,38 @@ class BenchmarkDriver
|
|||||||
output "minimum results in each #{@repeat} measurements."
|
output "minimum results in each #{@repeat} measurements."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
output "Execution time (sec)"
|
||||||
output "name\t#{@execs.map{|(_, v)| v}.join("\t")}"
|
output "name\t#{@execs.map{|(_, v)| v}.join("\t")}"
|
||||||
@results.each{|v, result|
|
@results.each{|v, result|
|
||||||
rets = []
|
rets = []
|
||||||
s = nil
|
s = adjusted_results(v, result){|r|
|
||||||
result.each_with_index{|e, i|
|
|
||||||
r = e.min
|
|
||||||
case v
|
|
||||||
when /^vm1_/
|
|
||||||
if @loop_wl1
|
|
||||||
r -= @loop_wl1[i]
|
|
||||||
s = '*'
|
|
||||||
end
|
|
||||||
when /^vm2_/
|
|
||||||
if @loop_wl2
|
|
||||||
r -= @loop_wl2[i]
|
|
||||||
s = '*'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
rets << sprintf("%.3f", r)
|
rets << sprintf("%.3f", r)
|
||||||
}
|
}
|
||||||
|
|
||||||
output "#{v}#{s}\t#{rets.join("\t")}"
|
output "#{v}#{s}\t#{rets.join("\t")}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if @execs.size > 1
|
||||||
|
output
|
||||||
|
output "Speedup ratio comare with the result of `#{@execs[0]}' (greater is better)"
|
||||||
|
output "name\t#{@execs[1..-1].map{|(_, v)| v}.join("\t")}"
|
||||||
|
@results.each{|v, result|
|
||||||
|
rets = []
|
||||||
|
first_value = nil
|
||||||
|
s = adjusted_results(v, result){|r|
|
||||||
|
if first_value
|
||||||
|
if r == 0
|
||||||
|
rets << sprintf("%.3f", "Error")
|
||||||
|
else
|
||||||
|
rets << sprintf("%.3f", first_value/r)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
first_value = r
|
||||||
|
end
|
||||||
|
}
|
||||||
|
output "#{v}#{s}\t#{rets.join("\t")}"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if @opt[:output]
|
if @opt[:output]
|
||||||
output
|
output
|
||||||
output "Log file: #{@opt[:output]}"
|
output "Log file: #{@opt[:output]}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user