HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/lib/ruby/site_ruby/1.8/puppet/util/profiler/logging.rb
class Puppet::Util::Profiler::Logging
  def initialize(logger, identifier)
    @logger = logger
    @identifier = identifier
    @sequence = Sequence.new
  end

  def start(description, metric_id)
    @sequence.next
    @sequence.down
    do_start(description, metric_id)
  end

  def finish(context, description, metric_id)
    profile_explanation = do_finish(context, description, metric_id)[:msg]
    @sequence.up
    @logger.call("PROFILE [#{@identifier}] #{@sequence} #{description}: #{profile_explanation}")
  end

  def shutdown()
    # nothing to do
  end

  class Sequence
    INITIAL = 0
    SEPARATOR = '.'

    def initialize
      @elements = [INITIAL]
    end

    def next
      @elements[-1] += 1
    end

    def down
      @elements << INITIAL
    end

    def up
      @elements.pop
    end

    def to_s
      @elements.join(SEPARATOR)
    end
  end
end