Class: RegoValidate::Profiler::Snapshot
- Inherits:
-
Object
- Object
- RegoValidate::Profiler::Snapshot
- Defined in:
- lib/ruby/rego/cli/profiling.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.
94 95 96 97 98 |
# File 'lib/ruby/rego/cli/profiling.rb', line 94 def initialize(allocated:, memsize:, objects:) @allocated = allocated @memsize = memsize @objects = objects end |
Instance Attribute Details
#allocated ⇒ Object (readonly)
Returns the value of attribute allocated.
100 101 102 |
# File 'lib/ruby/rego/cli/profiling.rb', line 100 def allocated @allocated end |
#memsize ⇒ Object (readonly)
Returns the value of attribute memsize.
100 101 102 |
# File 'lib/ruby/rego/cli/profiling.rb', line 100 def memsize @memsize end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
100 101 102 |
# File 'lib/ruby/rego/cli/profiling.rb', line 100 def objects @objects end |
Class Method Details
.capture ⇒ Object
64 65 66 67 68 69 |
# File 'lib/ruby/rego/cli/profiling.rb', line 64 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
75 76 77 |
# File 'lib/ruby/rego/cli/profiling.rb', line 75 def capture_after capture end |
.capture_before ⇒ Object
71 72 73 |
# File 'lib/ruby/rego/cli/profiling.rb', line 71 def capture_before capture end |