Sha256: 6290c8451915890752d7ec8e73ea7c95ae0a660fe7c101463ad63eeead69524e

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

module Dial
  module RubyStat
    private

    def ruby_vm_stat_diff before, after
      stat_diff before, after, no_diff: [:next_shape_id]
    end

    def gc_stat_diff before, after
      stat_diff before, after, no_diff: [
        :heap_allocatable_slots,
        :malloc_increase_bytes_limit,
        :remembered_wb_unprotected_objects_limit,
        :old_objects_limit,
        :oldmalloc_increase_bytes_limit
      ]
    end

    def gc_stat_heap_diff before, after
      after.each_with_object({}) do |(slot_index, slot_stat), diff|
        diff[slot_index] = stat_diff before[slot_index], slot_stat, no_diff: [:slot_size]
      end
    end

    def stat_diff before, after, no_diff: []
      after.except(*no_diff).each_with_object({}) do |(key, value), diff|
        diff[key] = value - before[key]
      end.merge after.slice *no_diff
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dial-0.1.3 lib/dial/middleware/ruby_stat.rb