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
Родитель cbb0271dd6
Коммит cc2aa1221f
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -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