1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix avg_len_in_yjit

We weren't counting completing an entire method in YJIT as exits so the
avg_len_in_yjit for

    ./miniruby --yjit-call-threshold=1 --yjit-stats -e'def foo; end; foo'

was infinite.
This commit is contained in:
Alan Wu 2021-09-10 11:04:14 -04:00
parent cbb0271dd6
commit cc2aa1221f

View file

@ -162,10 +162,12 @@ module YJIT
print_counters(stats, prefix: 'oaref_', prompt: 'opt_aref exit reasons: ')
print_counters(stats, prefix: 'expandarray_', prompt: 'expandarray exit reasons: ')
total_exits = total_exit_count(stats)
side_exits = total_exit_count(stats)
total_exits = side_exits + stats[:leave_interp_return]
# Number of instructions that finish executing in YJIT
retired_in_yjit = stats[:exec_instruction] - total_exits
# Number of instructions that finish executing in YJIT.
# See :count-placement: about the subtraction.
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