lib/bigbench/runner.rb in bigbench-0.0.1 vs lib/bigbench/runner.rb in bigbench-0.0.2
- old
+ new
@@ -14,16 +14,17 @@
# Runs all benchmarks
def self.run!
raise NoBenchmarksDefined.new if BigBench.benchmarks.empty?
# Run all benchmarks
- @running_threads = []
- BigBench.benchmarks.each do |benchmark|
- @running_threads << Thread.new{ benchmark.run! }
- end
-
- # Wait for them to finish
- @running_threads.each{ |thread| thread.join }
+ EventMachine.run {
+
+ # Start Timer
+ Thread.new { sleep(BigBench.duration.to_i); EventMachine.stop }
+
+ # Start Benchmarks
+ BigBench.benchmarks.each{ |benchmark| benchmark.run! }
+ }
end
end
# Runs all initialized benchmarks
\ No newline at end of file