Sha256: 6df00f3c220859276e05fcc357c88b898f4a202dabe5de70cba50e7f92d94b61

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

# = benchmarking.rb
#
# @author Rodrigo Fernández

require "benchmark"

module Liri
  module Common
    # == Módulo Benchmarking
    # Este módulo se encarga de medir el tiempo de ejecución de algunos bloques de código
    module Benchmarking
      class << self
        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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liri-0.4.1 lib/common/benchmarking.rb
liri-0.4.0 lib/common/benchmarking.rb