Sha256: bac9aac84af5788046474a1fc01a3bdb5986e2fd8f4d431122a0f3cc1f0fdb44

Contents?: true

Size: 1.53 KB

Versions: 3

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

module Datadog
  module Core
    module Environment
      # Reports YJIT primitive runtime statistics.
      module YJIT
        module_function

        # Inline code size
        def inline_code_size
          ::RubyVM::YJIT.runtime_stats[:inline_code_size]
        end

        # Outlined code size
        def outlined_code_size
          ::RubyVM::YJIT.runtime_stats[:outlined_code_size]
        end

        # GCed pages
        def freed_page_count
          ::RubyVM::YJIT.runtime_stats[:freed_page_count]
        end

        # GCed code size
        def freed_code_size
          ::RubyVM::YJIT.runtime_stats[:freed_code_size]
        end

        # Live pages
        def live_page_count
          ::RubyVM::YJIT.runtime_stats[:live_page_count]
        end

        # Code GC count
        def code_gc_count
          ::RubyVM::YJIT.runtime_stats[:code_gc_count]
        end

        # Size of memory region allocated for JIT code
        def code_region_size
          ::RubyVM::YJIT.runtime_stats[:code_region_size]
        end

        # Total number of object shapes
        def object_shape_count
          ::RubyVM::YJIT.runtime_stats[:object_shape_count]
        end

        # Size of memory Rust allocated for metadata
        def yjit_alloc_size
          ::RubyVM::YJIT.runtime_stats[:yjit_alloc_size]
        end

        def available?
          defined?(::RubyVM::YJIT) \
            && ::RubyVM::YJIT.enabled? \
            && ::RubyVM::YJIT.respond_to?(:runtime_stats)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datadog-2.4.0 lib/datadog/core/environment/yjit.rb
datadog-2.3.0 lib/datadog/core/environment/yjit.rb
datadog-2.2.0 lib/datadog/core/environment/yjit.rb