Class: Benchmark::Memory::Measurement::Metric

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/benchmark/memory/measurement/metric.rb

Overview

Describe the ratio of allocated vs. retained memory in a measurement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, allocated, retained) ⇒ Metric

Instantiate a Metric of allocated vs. retained memory.



15
16
17
18
19
# File 'lib/benchmark/memory/measurement/metric.rb', line 15

def initialize(type, allocated, retained)
  @type = type
  @allocated = allocated
  @retained = retained
end

Instance Attribute Details

#allocatedInteger (readonly)



22
23
24
# File 'lib/benchmark/memory/measurement/metric.rb', line 22

def allocated
  @allocated
end

#retainedInteger (readonly)



25
26
27
# File 'lib/benchmark/memory/measurement/metric.rb', line 25

def retained
  @retained
end

#typeSymbol (readonly)



28
29
30
# File 'lib/benchmark/memory/measurement/metric.rb', line 28

def type
  @type
end

Instance Method Details

#<=>(other) ⇒ Integer

Sort by the total allocated.



35
36
37
# File 'lib/benchmark/memory/measurement/metric.rb', line 35

def <=>(other)
  allocated <=> other.allocated
end