Created
October 21, 2017 06:27
-
-
Save tarui/aa0e0d036b9a683f668ec258ea24052c to your computer and use it in GitHub Desktop.
analyze_vm_exec_core_by_perf.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data=`perf annotate -svm_exec_core --show-total-period --stdio`.split(/\n/) | |
ins="before" | |
cnt=Hash.new{0} | |
total=0 | |
data.each{|line| | |
case line | |
when /INSN_ENTRY\((.*)\)/ | |
ins = $1 | |
when /END_INSN/ | |
ins = "none" | |
end | |
if line =~/^\s*([\d\.]+)\s*:/ | |
cnt[ins] += $1.to_i | |
total += $1.to_i | |
end | |
} | |
cnt.each{|k,v| cnt[k]=v.to_f/total} | |
require 'pp' | |
pp cnt.to_a.map{|a,b| [b,a]}.sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment