mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
YJIT: Handle 0 total_exits YJIT Status Display (#6079)
handle case in YJIT stats where 0 exits causes NaN in the display
This commit is contained in:
parent
b0c639f249
commit
2366e14976
Notes:
git
2022-06-30 23:24:55 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>
1 changed files with 15 additions and 11 deletions
4
yjit.rb
4
yjit.rb
|
@ -233,6 +233,7 @@ module RubyVM::YJIT
|
||||||
exits = exits.sort_by { |name, count| -count }[0...how_many]
|
exits = exits.sort_by { |name, count| -count }[0...how_many]
|
||||||
total_exits = total_exit_count(stats)
|
total_exits = total_exit_count(stats)
|
||||||
|
|
||||||
|
if total_exits > 0
|
||||||
top_n_total = exits.map { |name, count| count }.sum
|
top_n_total = exits.map { |name, count| count }.sum
|
||||||
top_n_exit_pct = 100.0 * top_n_total / total_exits
|
top_n_exit_pct = 100.0 * top_n_total / total_exits
|
||||||
|
|
||||||
|
@ -247,6 +248,9 @@ module RubyVM::YJIT
|
||||||
formatted_percent = "%.1f" % percent
|
formatted_percent = "%.1f" % percent
|
||||||
$stderr.puts("#{padded_name}: #{padded_count} (#{formatted_percent}%)" )
|
$stderr.puts("#{padded_name}: #{padded_count} (#{formatted_percent}%)" )
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
$stderr.puts "total_exits: " + ("%10d" % total_exits)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_exit_count(stats, prefix: "exit_")
|
def total_exit_count(stats, prefix: "exit_")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue