lib/stackprof/report.rb in stackprof-0.2.20 vs lib/stackprof/report.rb in stackprof-0.2.21

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true require 'pp' -require 'digest/md5' +require 'digest/sha2' require 'json' module StackProf class Report MARSHAL_SIGNATURE = "\x04\x08" @@ -50,11 +50,11 @@ end def normalized_frames id2hash = {} @data[:frames].each do |frame, info| - id2hash[frame.to_s] = info[:hash] = Digest::MD5.hexdigest("#{info[:name]}#{info[:file]}#{info[:line]}") + id2hash[frame.to_s] = info[:hash] = Digest::SHA256.hexdigest("#{info[:name]}#{info[:file]}#{info[:line]}") end @data[:frames].inject(Hash.new) do |hash, (frame, info)| info = hash[id2hash[frame.to_s]] = info.dup info[:edges] = info[:edges].inject(Hash.new){ |edges, (edge, weight)| edges[id2hash[edge.to_s]] = weight; edges } if info[:edges] hash @@ -223,10 +223,10 @@ child_stacks.each do |stack| weight += stack.last end else frame = @data[:frames][val] - child_name = "#{ frame[:name] } : #{ frame[:file] }" + child_name = "#{ frame[:name] } : #{ frame[:file] } : #{ frame[:line] }" child_data = convert_to_d3_flame_graph_format(child_name, child_stacks, depth + 1) weight += child_data["value"] children << child_data end end