Class: HeapScope::Probe
- Inherits:
-
Object
- Object
- HeapScope::Probe
- Defined in:
- lib/heapscope/scorecard.rb
Overview
One-shot probe that prints an executive scorecard for a workload.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title:, force_gc:, mode:, print:) ⇒ Probe
constructor
A new instance of Probe.
- #run ⇒ Object
Constructor Details
#initialize(title:, force_gc:, mode:, print:) ⇒ Probe
Returns a new instance of Probe.
12 13 14 15 16 17 |
# File 'lib/heapscope/scorecard.rb', line 12 def initialize(title:, force_gc:, mode:, print:) @title = title @force_gc = force_gc @mode = mode @print = print end |
Class Method Details
.run(title: "probe", force_gc: true, mode: :lightweight, print: true, &block) ⇒ Object
8 9 10 |
# File 'lib/heapscope/scorecard.rb', line 8 def self.run(title: "probe", force_gc: true, mode: :lightweight, print: true, &block) new(title: title, force_gc: force_gc, mode: mode, print: print).run(&block) end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/heapscope/scorecard.rb', line 19 def run(&) raise ArgumentError, "block required" unless block_given? report = HeapScope.measure(force_gc: @force_gc, mode: @mode, metadata: { kind: "probe", title: @title }, &) scorecard = Scorecard.from_report(report, title: @title) puts scorecard.to_text if @print && !HeapScope.config.quiet Result.new(report: report, scorecard: scorecard, printed: @print) end |