class Rgot::F::Coordinator

Attributes

count[RW]

@dynamic count, count=, interesting_count, interesting_count=

interesting_count[RW]

Public Class Methods

new(warmup_input_count:) click to toggle source
# File lib/rgot/f.rb, line 45
def initialize(warmup_input_count:)
  @warmup_input_count = warmup_input_count
  @before_cov = 0
  @start_time = Rgot.now
  @count = 0
  @interesting_count = 0
  @count_last_log = 0
  @time_last_log = 0.0
end

Public Instance Methods

diff_coverage() click to toggle source
# File lib/rgot/f.rb, line 64
def diff_coverage
  current_cov = Coverage.peek_result.sum do |path, hash|
    hash.map do |_, covs|
      covs.length
    end.sum
  end
  (current_cov - @before_cov).tap { @before_cov = current_cov }
end
log_stats() click to toggle source
# File lib/rgot/f.rb, line 73
def log_stats
  rate = Float(count - @count_last_log) / (Rgot.now - @time_last_log)
  total = @warmup_input_count + interesting_count
  printf "fuzz: elapsed: %ds, execs: %d (%d/sec), new interesting: %d (total: %d)\n",
    elapsed, count, rate, interesting_count, total

  duration = Rgot.now - @time_last_log
  @count_last_log = count
  @time_last_log = Rgot.now
end
start_logger() click to toggle source
# File lib/rgot/f.rb, line 55
def start_logger
  Thread.new do
    loop do
      log_stats
      sleep 3
    end
  end
end

Private Instance Methods

elapsed() click to toggle source
# File lib/rgot/f.rb, line 86
def elapsed
  (Rgot.now - @start_time).round
end