Class: Benchmark::Memory::Measurement::Metric
- Inherits:
-
Object
- Object
- Benchmark::Memory::Measurement::Metric
- 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
-
#allocated ⇒ Integer
readonly
The amount allocated in the metric.
-
#retained ⇒ Integer
readonly
The amount retained in the metric.
-
#type ⇒ Symbol
readonly
The type of memory allocated in the metric.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Sort by the total allocated.
-
#initialize(type, allocated, retained) ⇒ Metric
constructor
Instantiate a Metric of allocated vs.
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
#allocated ⇒ Integer (readonly)
Returns The amount allocated in the metric.
22 23 24 |
# File 'lib/benchmark/memory/measurement/metric.rb', line 22 def allocated @allocated end |
#retained ⇒ Integer (readonly)
Returns The amount retained in the metric.
25 26 27 |
# File 'lib/benchmark/memory/measurement/metric.rb', line 25 def retained @retained end |
#type ⇒ Symbol (readonly)
Returns The type of memory allocated in the metric.
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 |