diff options
author | John Hawthorn <john@hawthorn.email> | 2023-04-13 11:37:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 14:37:37 -0400 |
commit | acc5c746482218ed51e602af88bb5c48f8d557d5 (patch) | |
tree | 14b3b8717ac9a6c8a0620631d855d1ad96c744a6 /yjit.rb | |
parent | bbe69fba595433d0a7d684b70c0117f49cecadb2 (diff) | |
download | ruby-acc5c746482218ed51e602af88bb5c48f8d557d5.tar.gz |
YJIT: Fix edge and total counts in exit_locations (#7702)
The stackprof-format raw samples are suffixed with a count (ie. how many
times did the previously recorded side-exit repeat). Previously we were
correctly using this value to increment the :samples count, but not the
:total_samples count or edges.
This made the stackprof aggregate results incorrect (though any
flamegraphs generated should have been correct, since those only rely on
raw samples).
Diffstat (limited to 'yjit.rb')
-rw-r--r-- | yjit.rb | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -70,6 +70,8 @@ module RubyVM::YJIT stack_length = raw_samples[i] + 1 i += 1 # consume the stack length + sample_count = raw_samples[i + stack_length] + prev_frame_id = nil stack_length.times do |idx| idx += i @@ -78,14 +80,14 @@ module RubyVM::YJIT if prev_frame_id prev_frame = frames[prev_frame_id] prev_frame[:edges][frame_id] ||= 0 - prev_frame[:edges][frame_id] += 1 + prev_frame[:edges][frame_id] += sample_count end frame_info = frames[frame_id] - frame_info[:total_samples] += 1 + frame_info[:total_samples] += sample_count frame_info[:lines][line_samples[idx]] ||= [0, 0] - frame_info[:lines][line_samples[idx]][0] += 1 + frame_info[:lines][line_samples[idx]][0] += sample_count prev_frame_id = frame_id end @@ -95,8 +97,6 @@ module RubyVM::YJIT top_frame_id = prev_frame_id top_frame_line = 1 - sample_count = raw_samples[i] - frames[top_frame_id][:samples] += sample_count frames[top_frame_id][:lines] ||= {} frames[top_frame_id][:lines][top_frame_line] ||= [0, 0] |