Class: Ukiryu::Models::StageMetrics

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ukiryu/models/stage_metrics.rb

Overview

Metrics for a single stage of execution

Instance Method Summary collapse

Instance Method Details

#finish!(success: true, error: nil) ⇒ Object

Record the end of a stage



28
29
30
31
32
33
34
35
36
37
# File 'lib/ukiryu/models/stage_metrics.rb', line 28

def finish!(success: true, error: nil)
  @duration = Time.now - @start_time if @start_time
  @formatted_duration = format_duration(@duration)
  @success = success
  @error = error if error

  # Record memory after
  @memory_after = get_memory_usage
  @memory_delta = @memory_after - @memory_before
end

#start!Object

Start recording this stage



40
41
42
43
44
# File 'lib/ukiryu/models/stage_metrics.rb', line 40

def start!
  @start_time = Time.now
  @memory_before = get_memory_usage
  self
end