Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save liamwhite/3b5cb5fe04ac280ea44c709da4b897a5 to your computer and use it in GitHub Desktop.
Save liamwhite/3b5cb5fe04ac280ea44c709da4b897a5 to your computer and use it in GitHub Desktop.
rblineprof usage
# 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