Created
March 15, 2015 10:13
-
-
Save pgeraghty/6b2f4fc22f71890aaa3b to your computer and use it in GitHub Desktop.
Memory profiling for requires - Ruby
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
if ENV['MEMORY_PROFILING'] | |
require 'benchmark' | |
def require(file) | |
puts `pmap #{Process.pid} | grep 'total'` | |
puts Benchmark.measure('') { super }.format("%t require #{file}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment