Class: Rgot::BenchmarkResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rgot/benchmark_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(n: nil, t: nil) ⇒ BenchmarkResult

Ruby-2.0.0 wants default value of keyword_argument

Raises:

  • (ArgumentError)


4
5
6
7
8
9
# File 'lib/rgot/benchmark_result.rb', line 4

def initialize(n: nil, t: nil)
  raise ArgumentError, "missing keyword: n" unless n
  raise ArgumentError, "missing keyword: t" unless t
  @n = n
  @t = t
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/rgot/benchmark_result.rb', line 11

def to_s
  sprintf("%d\t%d ns/op", @n, @t / @n * 1_000_000_000)
end