Class: Rgot::F::Coordinator
- Inherits:
-
Object
- Object
- Rgot::F::Coordinator
- Defined in:
- lib/rgot/f.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#interesting_count ⇒ Object
Returns the value of attribute interesting_count.
Instance Method Summary collapse
- #diff_coverage ⇒ Object
-
#initialize(warmup_input_count:) ⇒ Coordinator
constructor
A new instance of Coordinator.
- #log_stats ⇒ Object
- #start_logger ⇒ Object
Constructor Details
#initialize(warmup_input_count:) ⇒ Coordinator
Returns a new instance of Coordinator.
45 46 47 48 49 50 51 52 53 |
# 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 |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
42 43 44 |
# File 'lib/rgot/f.rb', line 42 def count @count end |
#interesting_count ⇒ Object
Returns the value of attribute interesting_count.
43 44 45 |
# File 'lib/rgot/f.rb', line 43 def interesting_count @interesting_count end |
Instance Method Details
#diff_coverage ⇒ Object
64 65 66 67 68 69 70 71 |
# 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 ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# 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 ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/rgot/f.rb', line 55 def start_logger Thread.new do loop do log_stats sleep 3 end end end |