Created
January 11, 2017 18:45
-
-
Save askldjd/3ab1854230e9d45b85e51477eb69bce1 to your computer and use it in GitHub Desktop.
Perform a top level analysis on the ruby heap dump.
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
require 'json' | |
class Analyzer | |
def initialize(filename) | |
@filename = filename | |
end | |
def analyze | |
data = [] | |
File.open(@filename) do |f| | |
f.each_line do |line| | |
data << (parsed=JSON.parse(line)) | |
end | |
end | |
data.group_by{|row| row["generation"]} | |
.sort{|a,b| a[0].to_i <=> b[0].to_i} | |
.each do |k,v| | |
puts "generation #{k} objects #{v.count}" | |
end | |
end | |
end | |
Analyzer.new(ARGV[0]).analyze |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment