Module: BigBench::Output
- Defined in:
- lib/bigbench/output.rb
Overview
This module is used to keep all the command line outputs in a single place. The output module gets notified of the code and can then do what it want’s with this information.
Class Method Summary collapse
- .bot_is_checking ⇒ Object
- .bot_received_test_instructions ⇒ Object
- .deployed_test ⇒ Object
- .done ⇒ Object
- .finished_bots_loop ⇒ Object
- .finished_running_benchmarks ⇒ Object
- .finished_writing_trackings(count) ⇒ Object
- .loaded_tests ⇒ Object
- .reset ⇒ Object
- .running_benchmarks ⇒ Object
- .running_bots_loop(bots) ⇒ Object
- .start ⇒ Object
- .starting_bots_loop ⇒ Object
- .writing_trackings(count) ⇒ Object
- .wrote_trackings(count) ⇒ Object
Class Method Details
.bot_is_checking ⇒ Object
104 105 106 107 |
# File 'lib/bigbench/output.rb', line 104 def self.bot_is_checking puts "#{Time.now}: Checking for new test plan" $stdout.flush end |
.bot_received_test_instructions ⇒ Object
109 110 111 112 |
# File 'lib/bigbench/output.rb', line 109 def self.bot_received_test_instructions puts "#{Time.now}: Received new test plan" $stdout.flush end |
.deployed_test ⇒ Object
79 80 81 82 |
# File 'lib/bigbench/output.rb', line 79 def self.deployed_test puts "Deployed test to the redis store." $stdout.flush end |
.done ⇒ Object
18 19 20 21 |
# File 'lib/bigbench/output.rb', line 18 def self.done puts "\n-> Done. Took #{Time.now - @start} seconds." $stdout.flush end |
.finished_bots_loop ⇒ Object
98 99 100 101 102 |
# File 'lib/bigbench/output.rb', line 98 def self.finished_bots_loop print "\r100% Done \n" puts "Finished bots test." $stdout.flush end |
.finished_running_benchmarks ⇒ Object
54 55 56 57 |
# File 'lib/bigbench/output.rb', line 54 def self.finished_running_benchmarks puts "Finished #{BigBench.benchmarks.size} benchmarks." $stdout.flush end |
.finished_writing_trackings(count) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/bigbench/output.rb', line 72 def self.finished_writing_trackings(count) print "\r100% Done \n" target = BigBench.config.mode == :bot ? 'redis' : BigBench.config.output puts "\nWrote #{count} trackings to #{target}." $stdout.flush end |
.loaded_tests ⇒ Object
28 29 30 31 32 |
# File 'lib/bigbench/output.rb', line 28 def self.loaded_tests puts "\n-> Loading\n" puts "Loaded #{BigBench.benchmarks.size} benchmarks. Benchmark will take #{BigBench.duration} seconds" $stdout.flush end |
.reset ⇒ Object
23 24 25 26 |
# File 'lib/bigbench/output.rb', line 23 def self.reset puts "-> Resetting everything." $stdout.flush end |
.running_benchmarks ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bigbench/output.rb', line 34 def self.running_benchmarks puts "\n-> Running\n" puts "Running #{BigBench.benchmarks.size} benchmarks." $stdout.flush Thread.new{ loop { sleep(1) progress = Time.now - @start remaining = BigBench.duration.to_i - progress percent = ((progress.to_f / BigBench.duration.to_f).to_f * 100).to_i print "\r#{percent}% - #{progress.to_i} seconds elapsed. #{remaining.to_i} seconds remaining." if percent > 99 print "\r100% Done \n" break end } } end |
.running_bots_loop(bots) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/bigbench/output.rb', line 89 def self.running_bots_loop(bots) progress = Time.now - @start remaining = BigBench.duration.to_i - progress percent = ((progress.to_f / BigBench.duration.to_f).to_f * 100).to_i info = " - Waiting for bots to finish" if percent > 100 $stdout.flush print "\r#{percent}% - #{progress.to_i} seconds elapsed. #{remaining.to_i} seconds remaining. #{bots.size} Active Bots#{info} " end |
.start ⇒ Object
13 14 15 16 |
# File 'lib/bigbench/output.rb', line 13 def self.start puts "-> Started BigBench at #{@start = Time.now}\n" $stdout.flush end |
.starting_bots_loop ⇒ Object
84 85 86 87 |
# File 'lib/bigbench/output.rb', line 84 def self.starting_bots_loop puts "\n-> Running\n" puts "Running benchmarks on bots." end |
.writing_trackings(count) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/bigbench/output.rb', line 59 def self.writing_trackings(count) target = BigBench.config.mode == :bot ? 'redis' : BigBench.config.output puts "\n-> Writing\n" puts "Writing #{@trackings = count} trackings to #{target}." $stdout.flush end |
.wrote_trackings(count) ⇒ Object
66 67 68 69 70 |
# File 'lib/bigbench/output.rb', line 66 def self.wrote_trackings(count) percent = ((count.to_f / @trackings.to_f).to_f * 100).to_i $stdout.flush print "\r#{percent}%" end |