Sha256: 0a0e9a6e17ecb3868ac712491ecede15b951f8d0bc5611305118e2ffb95a9e62

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

require "koine/profiler/version"
require "koine/profiler/entries"
require "koine/profiler/entry_group"
require "koine/profiler/entry"

module Koine
  class Profiler
    attr_reader :entries

    def initialize
      @entries = Entries.new
    end

    def profile(name)
      value = nil
      start_time = Time.now.utc
      value = yield if block_given?
      finish_time = Time.now.utc

      entries.append(name, finish_time - start_time)
      value
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koine-profiler-0.1.0 lib/koine/profiler.rb