module BigBench::Output

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.

Public Class Methods

bot_is_checking() click to toggle source
# File lib/bigbench/output.rb, line 104
def self.bot_is_checking
  puts "Checking for new tests at #{Time.now}"
  $stdout.flush
end
bot_received_test_instructions() click to toggle source
# File lib/bigbench/output.rb, line 109
def self.bot_received_test_instructions
  puts "\n-> Received\n"
  puts "Received test instructions\n"
  $stdout.flush
end
deployed_test() click to toggle source
# File lib/bigbench/output.rb, line 79
def self.deployed_test
  puts "Deployed test to the redis store."
  $stdout.flush
end
done() click to toggle source
# File lib/bigbench/output.rb, line 18
def self.done
  puts "\n-> Done. Took #{Time.now - @start} seconds."
  $stdout.flush
end
finished_bots_loop() click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/bigbench/output.rb, line 23
def self.reset
  puts "-> Resetting everything."
  $stdout.flush
end
running_benchmarks() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/bigbench/output.rb, line 13
def self.start
  puts "-> Started BigBench at #{@start = Time.now}\n"
  $stdout.flush
end
starting_bots_loop() click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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