Module: Lrama::Reporter::Profile::Memory
- Defined in:
- lib/lrama/reporter/profile/memory.rb
Class Method Summary collapse
-
.report(enabled) ⇒ Object
See "Memory Profiling Lrama" in README.md for how to use.
- .require_memory_profiler ⇒ Object
Class Method Details
.report(enabled) ⇒ Object
See "Memory Profiling Lrama" in README.md for how to use.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lrama/reporter/profile/memory.rb', line 13 def self.report(enabled) if enabled && require_memory_profiler ex = nil #: Exception? report = MemoryProfiler.report do # steep:ignore UnknownConstant yield rescue Exception => e ex = e end report.pretty_print(to_file: "tmp/memory_profiler.txt") if ex raise ex end else yield end end |
.require_memory_profiler ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/lrama/reporter/profile/memory.rb', line 34 def self.require_memory_profiler require "memory_profiler" true rescue LoadError warn "memory_profiler is not installed. Please run `bundle install`." false end |