Class: Mutant::Segment::Recorder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/segment/recorder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Method Summary collapse

Instance Method Details

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Metrics/MethodLength

API:

  • private



38
39
40
# File 'lib/mutant/segment/recorder.rb', line 38

def print_profile(io)
  print_node(io, tree, 0)
end

#record(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/MethodLength

API:

  • private



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mutant/segment/recorder.rb', line 18

def record(name)
  start     = timer.now
  parent_id = parent_id()

  @parent_id = id = gen_id.call

  yield.tap do
    segments << Segment.new(
      id:,
      name:,
      parent_id:,
      timestamp_end:   timer.now,
      timestamp_start: start
    )
  end
ensure
  @parent_id = parent_id
end