Created
September 1, 2010 14:08
-
-
Save jmgarnier/560728 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
$require_level = 0 | |
module Kernel | |
alias require_without_timing require | |
def require(path) | |
result = seconds = nil | |
begin | |
$require_level += 1 | |
seconds = Benchmark.realtime { result = require_without_timing(path) } | |
ensure | |
$require_level -= 1 | |
end | |
puts "{'%.5f' % seconds} {' '*$require_level}{path}" if result | |
result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment