Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
RubyVM::YJIT.runtime_stats
runtime_stats(context: false)
yjit.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/yjit.rb, line 154
def self.runtime_stats(context: false)
stats = Primitive.rb_yjit_get_stats(context)
return stats if stats.nil?
stats[:object_shape_count] = Primitive.object_shape_count
return stats unless Primitive.rb_yjit_stats_enabled_p
side_exits = total_exit_count(stats)
total_exits = side_exits + stats[:leave_interp_return]
# Number of instructions that finish executing in YJIT.
# See :count-placement: about the subtraction.
retired_in_yjit = stats[:yjit_insns_count] - side_exits
# Average length of instruction sequences executed by YJIT
avg_len_in_yjit = total_exits > 0 ? retired_in_yjit.to_f / total_exits : 0
# Proportion of instructions that retire in YJIT
total_insns_count = retired_in_yjit + stats[:vm_insns_count]
yjit_ratio_pct = 100.0 * retired_in_yjit.to_f / total_insns_count
stats[:total_insns_count] = total_insns_count
stats[:ratio_in_yjit] = yjit_ratio_pct
# Make those stats available in RubyVM::YJIT.runtime_stats as well
stats[:side_exit_count] = side_exits
stats[:total_exit_count] = total_exits
stats[:avg_len_in_yjit] = avg_len_in_yjit
stats
end
Return a hash for statistics generated for the --yjit-stats command line option. Return nil when option is not passed or unavailable.
See also
.reset_stats!
.stats_enabled?
.print_and_dump_stats
.stats_string
also in
4.1 · 4.0 · 3.4 · 3.2