Skip to content

Commit 3ade42a

Browse files
authored
Merge pull request #473 from ruby/rwstauner/diff-all-keys
Update zjit_diff to report on stat keys from all rubies
2 parents ac3597f + 08c7eca commit 3ade42a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

misc/zjit_diff.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ def print_uncategorized_stats
122122
stats_by_ruby = @ruby_names.map { |r| [@raw_data.dig(r, bench_name, 'zjit_stats'), r] }
123123
next if stats_by_ruby.any? { |s, _| s.nil? }
124124

125-
unknown_keys = stats_by_ruby.first[0].keys.select do |k|
126-
stats_by_ruby.first[0][k].is_a?(Numeric) && !known_stat?(k)
125+
all_keys = stats_by_ruby.flat_map { |s, _| s.keys }.uniq
126+
unknown_keys = all_keys.select do |k|
127+
stats_by_ruby.any? { |s, _| s[k].is_a?(Numeric) } && !known_stat?(k)
127128
end
128129

129130
significant = filter_significant_keys(stats_by_ruby, unknown_keys)
@@ -230,7 +231,7 @@ def print_send_counters
230231
stats_by_ruby = @ruby_names.map { |r| [@raw_data.dig(r, bench_name, 'zjit_stats'), r] }
231232
next if stats_by_ruby.any? { |s, _| s.nil? }
232233

233-
keys = SEND_COUNTERS.map(&:to_s).select { |k| stats_by_ruby.first[0].key?(k) }
234+
keys = SEND_COUNTERS.map(&:to_s).select { |k| stats_by_ruby.any? { |s, _| s.key?(k) } }
234235
significant = filter_significant_keys(stats_by_ruby, keys)
235236
next if significant.empty?
236237

@@ -253,7 +254,7 @@ def print_summary_counters
253254
stats_by_ruby = @ruby_names.map { |r| [@raw_data.dig(r, bench_name, 'zjit_stats'), r] }
254255
next if stats_by_ruby.any? { |s, _| s.nil? }
255256

256-
keys = SUMMARY_COUNTERS.map(&:to_s).select { |k| stats_by_ruby.first[0].key?(k) }
257+
keys = SUMMARY_COUNTERS.map(&:to_s).select { |k| stats_by_ruby.any? { |s, _| s.key?(k) } }
257258
significant = filter_significant_keys(stats_by_ruby, keys)
258259
next if significant.empty?
259260

@@ -283,7 +284,7 @@ def print_category_diff(prefix, prompt, limit = nil)
283284
stats_by_ruby = @ruby_names.map { |r| [@raw_data.dig(r, bench_name, 'zjit_stats'), r] }
284285
next if stats_by_ruby.any? { |s, _| s.nil? }
285286

286-
keys = stats_by_ruby.first[0].keys.select { |k| k.start_with?(prefix) }
287+
keys = stats_by_ruby.flat_map { |s, _| s.keys }.uniq.select { |k| k.start_with?(prefix) }
287288
significant = filter_significant_keys(stats_by_ruby, keys)
288289

289290
next if significant.empty?

0 commit comments

Comments
 (0)