Skip to content

Instantly share code, notes, and snippets.

@floere
Created October 7, 2010 13:46
Show Gist options
  • Save floere/615121 to your computer and use it in GitHub Desktop.
Save floere/615121 to your computer and use it in GitHub Desktop.
module Kernel
def memory_consumption
`ps -o rss= -p #{Process.pid}`.to_i
end
alias :require_without_profiling :require
def require(file,*args)
mem_before = memory_consumption
require_without_profiling(file, *args)
mem_after = memory_consumption
puts "Loaded #{file} #{mem_before} -> #{mem_after} (#{mem_after - mem_before})"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment