class Benchmark::Memory::Measurement::Metric

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

Attributes

allocated[R]

@return [Integer] The amount allocated in the metric.

retained[R]

@return [Integer] The amount retained in the metric.

type[R]

@return [Symbol] The type of memory allocated in the metric.

Public Class Methods

new(type, allocated, retained) click to toggle source

Instantiate a Metric of allocated vs. retained memory.

@param type [Symbol] The type of memory allocated in the metric. @param allocated [Integer] The amount allocated in the metric. @param retained [Integer] The amount retained in the metric.

# File lib/benchmark/memory/measurement/metric.rb, line 15
def initialize(type, allocated, retained)
  @type = type
  @allocated = allocated
  @retained = retained
end

Public Instance Methods

<=>(other) click to toggle source

Sort by the total allocated.

@param other [Metric] The other metric.

@return [Integer]

# File lib/benchmark/memory/measurement/metric.rb, line 35
def <=>(other)
  allocated <=> other.allocated
end