1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# frozen_string_literal: true
require 'benchmark/memory/helpers'
module Benchmark
module Memory
class Measurement
# Describe the ratio of allocated vs. retained memory in a measurement.
class Metric
# 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.
def initialize(type, allocated, retained)
@type = type
@allocated = allocated
@retained = retained
end
# @return [Integer] The amount allocated in the metric.
attr_reader :allocated
# @return [Integer] The amount retained in the metric.
attr_reader :retained
# @return [Symbol] The type of memory allocated in the metric.
attr_reader :type
end
end
end
end
|