Class: Benchmark::Memory::Report::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/memory/report/entry.rb

Overview

An entry in a report about a benchmark.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, measurement) ⇒ Entry

Instantiate a new entry.

Parameters:

  • label (#to_s)

    The entry label.

  • measurement (Measurement)

    The measurements for the entry.



14
15
16
17
# File 'lib/benchmark/memory/report/entry.rb', line 14

def initialize(label, measurement)
  @label = label
  @measurement = measurement
end

Instance Attribute Details

#label#to_s (readonly)

Returns The entry label.

Returns:

  • (#to_s)

    The entry label.



20
21
22
# File 'lib/benchmark/memory/report/entry.rb', line 20

def label
  @label
end

#measurementMeasurement (readonly)

Returns The measurements for the entry.

Returns:



23
24
25
# File 'lib/benchmark/memory/report/entry.rb', line 23

def measurement
  @measurement
end

Instance Method Details

#compared_metric(comparison) ⇒ Integer

Get the total amount of memory allocated in the entry.

Parameters:

Returns:

  • (Integer)


29
30
31
# File 'lib/benchmark/memory/report/entry.rb', line 29

def compared_metric(comparison)
  measurement.public_send(comparison.metric).public_send(comparison.value)
end