Skip to content

Instantly share code, notes, and snippets.

@nicholasf
Created February 24, 2009 23:24
Show Gist options
  • Save nicholasf/69869 to your computer and use it in GitHub Desktop.
Save nicholasf/69869 to your computer and use it in GitHub Desktop.
ProfilingUtils
module ProfilingUtils
#only caters for vmmap (os x) and pmap (linux)
def ram_footprint
footprint = nil
case `uname`.strip!
when 'Darwin'
footprint = `vmmap #{Process.pid} | tail -1`[10,40].strip
footprint = footprint.split("[").last
footprint = footprint.gsub("]", "")
when 'Linux'
footprint = `pmap #{Process.pid} | tail -1`[10,40].strip
end
unless footprint.nil?
footprint.gsub!("K", "")
end
return footprint.to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment