Sha256: d434ce079970f90776dc6fa047d5a4c249021461c2306a3fae6b1d4651a6ddb6

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 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

        # Ratio of YJIT-executed instructions
        def ratio_in_yjit
          ::RubyVM::YJIT.runtime_stats[:ratio_in_yjit]
        end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/core/environment/yjit.rb
datadog-2.8.0 lib/datadog/core/environment/yjit.rb
datadog-2.7.1 lib/datadog/core/environment/yjit.rb
datadog-2.7.0 lib/datadog/core/environment/yjit.rb
datadog-2.6.0 lib/datadog/core/environment/yjit.rb
datadog-2.5.0 lib/datadog/core/environment/yjit.rb