Welcome to mirror list, hosted at ThFree Co, Russian Federation.

memory.rb « metrics « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c165cdec7a3ddb9b17bce0e6f7a35f1889d2d6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Gitlab
  module Metrics
    module Memory
      extend self

      HEAP_SLOTS_PER_PAGE = GC::INTERNAL_CONSTANTS[:HEAP_PAGE_OBJ_LIMIT]

      def gc_heap_fragmentation(gc_stat = GC.stat)
        1 - (gc_stat[:heap_live_slots] / (HEAP_SLOTS_PER_PAGE * gc_stat[:heap_eden_pages].to_f))
      end
    end
  end
end