class Object

Constants

INNER_ITERATIONS
ITERATIONS
SMALL_PRIME

This file should be kept as simple as possible to accommodate early implementations of Ruby.

Public Instance Methods

bench9000_get_time() click to toggle source
# File lib/bench9000/harness.rb, line 23
def bench9000_get_time
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
harness_input() click to toggle source
# File lib/bench9000/micro-harness.rb, line 14
def harness_input
  micro_harness_input
end
harness_sample(input) click to toggle source
# File lib/bench9000/micro-harness.rb, line 18
def harness_sample(input)
  sum = 0

  micro_harness_iterations.times do
    sum = (sum + micro_harness_sample(input)) % SMALL_PRIME
  end

  sum
end
harness_verify(output) click to toggle source
# File lib/bench9000/micro-harness.rb, line 28
def harness_verify(output)
  expected_output = micro_harness_expected
  expected_sum = 0

  micro_harness_iterations.times do
    expected_sum = (expected_sum + expected_output) % SMALL_PRIME
  end

  output == expected_sum
end
micro_harness_iterations() click to toggle source
# File lib/bench9000/harness.rb, line 16
def micro_harness_iterations
  INNER_ITERATIONS
end