Class: RegoValidate::Profiler::Delta
- Inherits:
-
Object
- Object
- RegoValidate::Profiler::Delta
- Defined in:
- lib/ruby/rego/cli.rb
Overview
Computes deltas between snapshots.
Constant Summary collapse
- SKIP_KEYS =
%i[TOTAL FREE].freeze
Instance Attribute Summary collapse
-
#allocations ⇒ Object
readonly
Returns the value of attribute allocations.
-
#memory_bytes ⇒ Object
readonly
Returns the value of attribute memory_bytes.
-
#object_deltas ⇒ Object
readonly
Returns the value of attribute object_deltas.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allocations:, memory_bytes:, object_deltas:) ⇒ Delta
constructor
A new instance of Delta.
-
#top_objects(limit: 3) ⇒ Object
Constructor Details
#initialize(allocations:, memory_bytes:, object_deltas:) ⇒ Delta
Returns a new instance of Delta.
632 633 634 635 636 |
# File 'lib/ruby/rego/cli.rb', line 632 def initialize(allocations:, memory_bytes:, object_deltas:) @allocations = allocations @memory_bytes = memory_bytes @object_deltas = object_deltas end |
Instance Attribute Details
#allocations ⇒ Object (readonly)
Returns the value of attribute allocations.
638 639 640 |
# File 'lib/ruby/rego/cli.rb', line 638 def allocations @allocations end |
#memory_bytes ⇒ Object (readonly)
Returns the value of attribute memory_bytes.
638 639 640 |
# File 'lib/ruby/rego/cli.rb', line 638 def memory_bytes @memory_bytes end |
#object_deltas ⇒ Object (readonly)
Returns the value of attribute object_deltas.
638 639 640 |
# File 'lib/ruby/rego/cli.rb', line 638 def object_deltas @object_deltas end |
Class Method Details
.skip_key?(key) ⇒ Boolean
628 629 630 |
# File 'lib/ruby/rego/cli.rb', line 628 def self.skip_key?(key) SKIP_KEYS.include?(key) end |
Instance Method Details
#top_objects(limit: 3) ⇒ Object
640 641 642 643 644 645 |
# File 'lib/ruby/rego/cli.rb', line 640 def top_objects(limit: 3) object_deltas .sort_by { |(_, count)| -count } .first(limit) .map { |(key, count)| "#{key} +#{count}" } end |