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 |
#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 <<-HELP To get a heap dump do this: require 'objspace' ObjectSpace.trace_object_allocations_start # Your code here p ObjectSpace.dump_all # => #<File:/path/to/output/heap/dump/here.json> This will print the file name of your heap dump. If you prefer you can manually pass in an IO object to `ObjectSpace.dump_all` io = File.open("/tmp/my_dump.json", "w+") ObjectSpace.dump_all(output: io); io.close HELP end |