class ElasticAPM::ChildDurations::Durations

@api private

def initialize

def initialize
  @nesting_level = 0
  @start = nil
  @duration = 0
  @mutex = Mutex.new
end

def start

def start
  @mutex.synchronize do
    @nesting_level += 1
    @start = Util.micros if @nesting_level == 1
  end
end

def stop

def stop
  @mutex.synchronize do
    @nesting_level -= 1
    @duration = (Util.micros - @start) if @nesting_level == 0
  end
end