Skip to content

Add YJIT metrics to Process #331

@erickguan

Description

@erickguan

Hey!

I want to add a few metrics about YJIT in the Process instrumentation to understand the YJIT performance.

These metrics depend on the RUBYOPT=--yjit-stats flag and Ruby::YJIT.runtime_stats API.
When the Ruby process starts with --yjit-stats or RUBYOPT=--yjit-stats, the Ruby::YJIT.runtime_stats produces performance stats. Otherwise, Ruby::YJIT.runtime_stats returns nil. Naturally, I would propose to add:

  1. A new function collect_yjit_metrics in the Process#collect.
  2. collect_yjit_metrics collects:
    • ratio_in_yjit: the percentage of total YARV instructions executed by YJIT as opposed to the CRuby interpreter
    • code_region_size
    • yjit_alloc_size
    • code_gc_count
    • compiled_iseq_count
    • yjit_insns_count
    • side_exit_count
    • total_exit_count
    • avg_len_in_yjit

Reference: Ruby YJIT Docuementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions