Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created August 27, 2012 08:52
Show Gist options
  • Save tknerr/3486758 to your computer and use it in GitHub Desktop.
Save tknerr/3486758 to your computer and use it in GitHub Desktop.
tracing require load times
module Kernel
def require_with_trace(*args)
start = Time.now.to_f
@indent ||= 0
@indent += 2
require_without_trace(*args)
@indent -= 2
Kernel::puts "#{' '*@indent}#{((Time.now.to_f - start)*1000).to_i} #{args[0]}"
end
#alias_method_chain :require, :trace
alias_method :require_without_trace, :require
alias_method :require, :require_with_trace
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment