just let the runner run

and output eery step, gives better idea of variance (trouble)
This commit is contained in:
Torsten Ruger 2015-11-20 20:13:35 +02:00
parent 480e63a6c5
commit 28836457c5

View File

@ -15,19 +15,17 @@ class Stats
@variance = @variance + delta*(x - @mean) @variance = @variance + delta*(x - @mean)
end end
def show def show
puts "no per var" #puts "no per var"
puts "#{@n} #{@mean} #{@variance}" puts "#{@n} #{@mean} #{@variance}"
end end
end end
class Runner class Runner
def initialize num = 20 def initialize
@stats = Stats.new @stats = Stats.new
@cmd = ARGV[0] @cmd = ARGV[0]
@interations = num
end end
def run def run
@interations.times { once } { once } while true
@stats.show
end end
def once def once
@ -35,6 +33,7 @@ class Runner
took = Benchmark.measure { %x("#{@cmd}")}.real took = Benchmark.measure { %x("#{@cmd}")}.real
GC.enable GC.enable
@stats.add took @stats.add took
@stats.show
end end
end end