# File lib/deep_test/metrics/queue_lock_wait_time_measurement.rb, line 16 16: def pop_with_lock_wait_measurement(no_wait = false) 17: if no_wait 18: return measure(:add_pop_time) do 19: pop_without_lock_wait_measurement(no_wait) 20: end 21: else 22: begin 23: # Measure without waiting to minimize extra time added 24: # above locking time 25: # 26: return measure(:add_pop_time) do 27: pop_without_lock_wait_measurement(true) 28: end 29: rescue ThreadError => e 30: if e.message == "queue empty" 31: # Normally we would have waiting for a condvar signal, 32: # so don't penalize time for locking here again - hence 33: # no measure 34: return pop_without_lock_wait_measurement(false) 35: else 36: raise 37: end 38: end 39: end 40: end