Created
May 15, 2016 21:04
-
-
Save liamwhite/3b5cb5fe04ac280ea44c709da4b897a5 to your computer and use it in GitHub Desktop.
rblineprof usage
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
# writing to a file | |
f = File.open("/tmp/profile", "w") | |
f.truncate(0) | |
for file in profile.keys | |
f.puts "\n#{file}" | |
File.readlines(file).each_with_index do |line, num| | |
if (sample = profile[file][num+1]) and sample[0] > 0 | |
f.printf "% 8.1fms | %s", sample[0]/1000.0, line | |
else | |
f.printf " | %s", line | |
end | |
end | |
end | |
f.close | |
# writing to stdout | |
for file in profile.keys | |
puts "\n#{file}" | |
File.readlines(file).each_with_index do |line, num| | |
if (sample = profile[file][num+1]) and sample[0] > 0 | |
printf "% 8.1fms | %s", sample[0]/1000.0, line | |
else | |
printf " | %s", line | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment