Sha256: e6a9f78dfc41a8ab8e33bdd057eaee88445c4c56b84c8731049388d025302534

Contents?: true

Size: 1.28 KB

Versions: 293

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8
if ($DEBUGLIST || []).include?("require")
  ROOT = File.dirname(__FILE__)
  module Kernel
    alias_method :require_debug, :require

    def require(path)
      start = Time.now
      result = require_debug(path)
      duration = Time.now - start

      origin = caller[1]
      if origin =~ /rubygems\/custom_require/
        origin = caller[3]
        if origin.nil?
          STDERR.puts "Unknown origin"
          STDERR.puts caller.join("\n")
        end
      end
      origin = origin.gsub(/:[0-9]+:in .*/, "") if origin

      # Only print require() calls that did actual work.
      # require() returns true on load, false if already loaded.
      if result
        source = caller[0]
        #p source.include?("/lib/polyglot.rb:63:in `require'") => source
        if source.include?("/lib/polyglot.rb:63:in `require'")
          source = caller[1]
        end

        #target = $LOADED_FEATURES.grep(/#{path}/).first
        #puts path
        #puts caller.map { |c| "  #{c}" }.join("\n")
        #fontsize = [10, duration * 48].max
        puts "#{duration},#{path},#{source}"
      end
      #puts caller.map { |c| " => #{c}" }.join("\n")
    end

    alias_method :load_debug, :load

    def load(path)
      puts "load(\"#{path}\")"
      return load_debug(path)
    end
  end
end

Version data entries

293 entries across 284 versions & 17 rubygems

Version Path
logstash-core-6.8.23-java lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.22-java lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.21-java lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.20-java lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.19-java lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.18-java lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-core-6.8.17-java lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/profile_require_calls.rb