зеркало из https://github.com/github/ruby.git
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).
This commit is contained in:
Родитель
bbe69fba59
Коммит
acc5c74648
10
yjit.rb
10
yjit.rb
|
@ -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]
|
||||
|
|
Загрузка…
Ссылка в новой задаче