Module: Liri::Common::Benchmarking

Defined in:
lib/common/benchmarking.rb

Overview

Módulo Benchmarking

Este módulo se encarga de medir el tiempo de ejecución de algunos bloques de código

Class Method Summary collapse

Class Method Details

.start(start_msg: nil, end_msg: 'Duration: ', stdout: true, &block) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/common/benchmarking.rb', line 15

def start(start_msg: nil, end_msg: 'Duration: ', stdout: true, &block)
  Liri.logger.info(start_msg, stdout)

  seconds = Benchmark.realtime(&block)

  Liri.logger.info("#{end_msg}#{Duration.humanize(seconds, times_round: Liri.times_round, times_round_type: Liri.times_round_type)}", stdout)
  seconds
end