For YJIT stats, set avg_len_in_yjit to 0 if denominator would be 0 (#7793)

This commit is contained in:
Noah Gibbs 2023-05-09 20:40:26 +01:00 committed by GitHub
parent 986268afae
commit e1c84e8ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-05-09 19:40:53 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View File

@ -165,7 +165,7 @@ module RubyVM::YJIT
retired_in_yjit = stats[:exec_instruction] - side_exits
# Average length of instruction sequences executed by YJIT
avg_len_in_yjit = retired_in_yjit.to_f / total_exits
avg_len_in_yjit = total_exits > 0 ? retired_in_yjit.to_f / total_exits : 0
# This only available on yjit stats builds
if stats.key?(:vm_insns_count)