Sha256: a9db4737ec8b364cc003c7f94305ffb23dffef35728ee911e1ef70c3bdc7a62e

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

class Chaos::Instability::CpuUsage
  attr_reader :clock
  private     :clock

  def initialize(clock: Time)
    @clock = clock
  end

  def call(duration_in_seconds:)
    expected_execution_end_time = clock.now + duration_in_seconds

    generate_100_percent_load_on_a_single_cpu_limit(expected_execution_end_time)
  end

  private

  def generate_100_percent_load_on_a_single_cpu_limit(expected_execution_end_time)
    while clock.now < expected_execution_end_time
      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chaos-rb-0.1.0 lib/chaos/instability/cpu_usage.rb