Class: Heapy::CLI
- Inherits:
-
Thor
- Object
- Thor
- Heapy::CLI
- Defined in:
- lib/heapy.rb
Class Method Summary collapse
Instance Method Summary collapse
- #diff(before, after, retained = nil) ⇒ Object
- #read(file_name, generation = nil) ⇒ Object
- #version ⇒ Object
- #wat ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
8 9 10 |
# File 'lib/heapy.rb', line 8 def self.exit_on_failure? true end |
Instance Method Details
#diff(before, after, retained = nil) ⇒ Object
66 67 68 |
# File 'lib/heapy.rb', line 66 def diff(before, after, retained = nil) Diff.new(before: before, after: after, retained: retained, output_diff: [:output_diff] || nil).call end |
#read(file_name, generation = nil) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/heapy.rb', line 42 def read(file_name, generation = nil) if generation Analyzer.new(file_name).drill_down(generation, [:lines] || 50) else Analyzer.new(file_name).analyze end end |
#version ⇒ Object
72 73 74 |
# File 'lib/heapy.rb', line 72 def version puts Heapy::VERSION end |
#wat ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/heapy.rb', line 77 def wat puts "\nTo get a heap dump do this:\n\nrequire 'objspace'\nObjectSpace.trace_object_allocations_start\n\n# Your code here\n\np ObjectSpace.dump_all\n\n# => #<File:/path/to/output/heap/dump/here.json>\n\nThis will print the file name of your heap dump.\n\nIf you prefer you can manually pass in an IO object to `ObjectSpace.dump_all`\n\nio = File.open(\"/tmp/my_dump.json\", \"w+\")\nObjectSpace.dump_all(output: io);\nio.close\n\n" end |