Sha256: a26e6d76e70b47e63add14986ea6d5ddc3795dec51fc508e574211b5b6898799

Contents?: true

Size: 658 Bytes

Versions: 40

Compression:

Stored size: 658 Bytes

Contents

require 'puppet/util/profiler/logging'

# A profiler implementation that measures the number of seconds a segment of
# code takes to execute and provides a callback with a string representation of
# the profiling information.
#
# @api private
class Puppet::Util::Profiler::WallClock < Puppet::Util::Profiler::Logging
  def start
    Timer.new
  end

  def finish(context)
    context.stop
    "took #{context} seconds"
  end

  class Timer
    FOUR_DECIMAL_DIGITS = '%0.4f'

    def initialize
      @start = Time.now
    end

    def stop
      @finish = Time.now
    end

    def to_s
      format(FOUR_DECIMAL_DIGITS, @finish - @start)
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
puppet-3.6.2 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.2-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.1 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.1-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.0 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.0-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.0.rc1 lib/puppet/util/profiler/wall_clock.rb
puppet-3.6.0.rc1-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.1 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.1-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.1.rc1 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.1.rc1-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc3 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc3-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc2 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc2-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc1 lib/puppet/util/profiler/wall_clock.rb
puppet-3.5.0.rc1-x86-mingw32 lib/puppet/util/profiler/wall_clock.rb
puppet-3.4.3 lib/puppet/util/profiler/wall_clock.rb
puppet-3.4.2 lib/puppet/util/profiler/wall_clock.rb