Sha256: 2f2b0f77ee624ae1c95e0f3e5613028616d80ceba0004754d50c2d46bccc0fd1

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

#encoding: utf-8

require_relative 'simplest_benchmark_logger.rb'

module SimplestBenchmark
  include SimplestBenchmarkLogger

  attr_reader :miliseconds

	def sb_begin(msg = "", other_info = "")
    time        = Time.now
    miliseconds << time.to_f
    log "SimplestBenchmark\t#{time}\t#{time.to_f}\tBEGIN\t#{miliseconds.count-1}\t#{msg}\t\t#{other_info}"
  end

  def sb_end(msg, other_info="")
    time       = Time.now
    time_spent = time.to_f - miliseconds.last
    miliseconds.pop
    log "SimplestBenchmark\t#{time}\t#{time.to_f}\tEND\t#{miliseconds.count}\t#{msg}\t#{time_spent}\t#{other_info}"
    return time_spent
  end

  def miliseconds
    @miliseconds ||= []
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplest_benchmark-0.0.3 lib/simplest_benchmark.rb