File: metric.rb

package info (click to toggle)
ruby-benchmark-memory 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ruby: 1,121; makefile: 7; sh: 4
file content (32 lines) | stat: -rw-r--r-- 978 bytes parent folder | download
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