Skip to content

Instantly share code, notes, and snippets.

@stamm
Last active February 3, 2017 10:17
Show Gist options
  • Save stamm/8b646c970c87b1b8dbea3b69e915f5f9 to your computer and use it in GitHub Desktop.
Save stamm/8b646c970c87b1b8dbea3b69e915f5f9 to your computer and use it in GitHub Desktop.
Parse goroutines dump (get by kill -6 PID) and group by count of file:line
contents = File.read('goroutines_dump.txt')
p = contents.scan(/goroutine\s(\d+).+?^\t(\S+\.go:\d+)/m)
counts = Hash.new(0)
p.each do |el|
counts[el[1]] += 1
end
puts counts.sort_by { |k,v| -v }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment