Class: RegoValidate::Profiler::Snapshot
- Inherits:
-
Object
- Object
- RegoValidate::Profiler::Snapshot
- Defined in:
- lib/ruby/rego/cli.rb
Overview
Captures a memory snapshot for diffing.
Instance Attribute Summary collapse
-
#allocated ⇒ Object
readonly
Returns the value of attribute allocated.
-
#memsize ⇒ Object
readonly
Returns the value of attribute memsize.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Class Method Summary collapse
Instance Method Summary collapse
-
#delta(other) ⇒ Object
-
#initialize(allocated:, memsize:, objects:) ⇒ Snapshot
constructor
A new instance of Snapshot.
Constructor Details
#initialize(allocated:, memsize:, objects:) ⇒ Snapshot
Returns a new instance of Snapshot.
592 593 594 595 596 |
# File 'lib/ruby/rego/cli.rb', line 592 def initialize(allocated:, memsize:, objects:) @allocated = allocated @memsize = memsize @objects = objects end |
Instance Attribute Details
#allocated ⇒ Object (readonly)
Returns the value of attribute allocated.
598 599 600 |
# File 'lib/ruby/rego/cli.rb', line 598 def allocated @allocated end |
#memsize ⇒ Object (readonly)
Returns the value of attribute memsize.
598 599 600 |
# File 'lib/ruby/rego/cli.rb', line 598 def memsize @memsize end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
598 599 600 |
# File 'lib/ruby/rego/cli.rb', line 598 def objects @objects end |
Class Method Details
.capture ⇒ Object
562 563 564 565 566 567 |
# File 'lib/ruby/rego/cli.rb', line 562 def capture require "objspace" build_snapshot(memsize: ObjectSpace.memsize_of_all, objects: ObjectSpace.count_objects) rescue LoadError, NoMethodError build_snapshot(memsize: 0, objects: empty_object_counts) end |
.capture_after ⇒ Object
573 574 575 |
# File 'lib/ruby/rego/cli.rb', line 573 def capture_after capture end |
.capture_before ⇒ Object
569 570 571 |
# File 'lib/ruby/rego/cli.rb', line 569 def capture_before capture end |