Class: RegoValidate::Profiler::Measurement
- Inherits:
-
Object
- Object
- RegoValidate::Profiler::Measurement
- Defined in:
- lib/ruby/rego/cli.rb
Overview
Tracks measurement state for a single sample.
Instance Method Summary collapse
-
#finish(after:, finish:) ⇒ Object
-
#initialize(label:, before:, start:) ⇒ Measurement
constructor
A new instance of Measurement.
Constructor Details
#initialize(label:, before:, start:) ⇒ Measurement
Returns a new instance of Measurement.
650 651 652 653 654 |
# File 'lib/ruby/rego/cli.rb', line 650 def initialize(label:, before:, start:) @label = label @before = before @start = start end |
Instance Method Details
#finish(after:, finish:) ⇒ Object
656 657 658 659 660 661 662 663 664 665 |
# File 'lib/ruby/rego/cli.rb', line 656 def finish(after:, finish:) delta = before.delta(after) Sample.new( label: label, duration_ms: ((finish - start) * 1000.0), allocations: delta.allocations, memory_bytes: delta.memory_bytes, top_objects: delta.top_objects ) end |