Class: Omnizip::Models::PerformanceResult
- Inherits:
-
Object
- Object
- Omnizip::Models::PerformanceResult
- Defined in:
- lib/omnizip/models/performance_result.rb
Overview
Represents the performance characteristics of a profiled operation
Instance Attribute Summary collapse
-
#call_count ⇒ Object
readonly
Returns the value of attribute call_count.
-
#cpu_time ⇒ Object
readonly
Returns the value of attribute cpu_time.
-
#gc_runs ⇒ Object
readonly
Returns the value of attribute gc_runs.
-
#memory_allocated ⇒ Object
readonly
Returns the value of attribute memory_allocated.
-
#memory_retained ⇒ Object
readonly
Returns the value of attribute memory_retained.
-
#object_allocations ⇒ Object
readonly
Returns the value of attribute object_allocations.
-
#operation_name ⇒ Object
readonly
Returns the value of attribute operation_name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#total_time ⇒ Object
readonly
Returns the value of attribute total_time.
-
#wall_time ⇒ Object
readonly
Returns the value of attribute wall_time.
Instance Method Summary collapse
- #average_time_per_operation ⇒ Object
- #gc_pressure ⇒ Object
-
#initialize(operation_name:, total_time: nil, cpu_time: nil, wall_time: nil, memory_allocated: nil, memory_retained: nil, object_allocations: nil, gc_runs: nil, call_count: nil, timestamp: Time.now) ⇒ PerformanceResult
constructor
A new instance of PerformanceResult.
- #memory_per_operation ⇒ Object
- #throughput_ops_per_second ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(operation_name:, total_time: nil, cpu_time: nil, wall_time: nil, memory_allocated: nil, memory_retained: nil, object_allocations: nil, gc_runs: nil, call_count: nil, timestamp: Time.now) ⇒ PerformanceResult
Returns a new instance of PerformanceResult.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/omnizip/models/performance_result.rb', line 11 def initialize( operation_name:, total_time: nil, cpu_time: nil, wall_time: nil, memory_allocated: nil, memory_retained: nil, object_allocations: nil, gc_runs: nil, call_count: nil, timestamp: Time.now ) @operation_name = operation_name @total_time = total_time @cpu_time = cpu_time @wall_time = wall_time @memory_allocated = memory_allocated @memory_retained = memory_retained @object_allocations = object_allocations @gc_runs = gc_runs @call_count = call_count @timestamp = end |
Instance Attribute Details
#call_count ⇒ Object (readonly)
Returns the value of attribute call_count.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def call_count @call_count end |
#cpu_time ⇒ Object (readonly)
Returns the value of attribute cpu_time.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def cpu_time @cpu_time end |
#gc_runs ⇒ Object (readonly)
Returns the value of attribute gc_runs.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def gc_runs @gc_runs end |
#memory_allocated ⇒ Object (readonly)
Returns the value of attribute memory_allocated.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def memory_allocated @memory_allocated end |
#memory_retained ⇒ Object (readonly)
Returns the value of attribute memory_retained.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def memory_retained @memory_retained end |
#object_allocations ⇒ Object (readonly)
Returns the value of attribute object_allocations.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def object_allocations @object_allocations end |
#operation_name ⇒ Object (readonly)
Returns the value of attribute operation_name.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def operation_name @operation_name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def @timestamp end |
#total_time ⇒ Object (readonly)
Returns the value of attribute total_time.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def total_time @total_time end |
#wall_time ⇒ Object (readonly)
Returns the value of attribute wall_time.
7 8 9 |
# File 'lib/omnizip/models/performance_result.rb', line 7 def wall_time @wall_time end |
Instance Method Details
#average_time_per_operation ⇒ Object
41 42 43 44 45 |
# File 'lib/omnizip/models/performance_result.rb', line 41 def average_time_per_operation return nil unless call_count && total_time && call_count.positive? total_time / call_count.to_f end |
#gc_pressure ⇒ Object
53 54 55 56 57 |
# File 'lib/omnizip/models/performance_result.rb', line 53 def gc_pressure return nil unless gc_runs && total_time&.positive? gc_runs.to_f / total_time end |
#memory_per_operation ⇒ Object
47 48 49 50 51 |
# File 'lib/omnizip/models/performance_result.rb', line 47 def memory_per_operation return nil unless call_count && memory_allocated && call_count.positive? memory_allocated / call_count.to_f end |
#throughput_ops_per_second ⇒ Object
35 36 37 38 39 |
# File 'lib/omnizip/models/performance_result.rb', line 35 def throughput_ops_per_second return nil unless call_count && total_time&.positive? call_count.to_f / total_time end |
#to_h ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/omnizip/models/performance_result.rb', line 59 def to_h { operation_name: operation_name, total_time: total_time, cpu_time: cpu_time, wall_time: wall_time, memory_allocated: memory_allocated, memory_retained: memory_retained, object_allocations: object_allocations, gc_runs: gc_runs, call_count: call_count, throughput_ops_per_second: throughput_ops_per_second, average_time_per_operation: average_time_per_operation, memory_per_operation: memory_per_operation, gc_pressure: gc_pressure, timestamp: .iso8601, } end |