Skip to content

Instantly share code, notes, and snippets.

@nicholasf
Created February 24, 2009 23:23
Show Gist options
  • Save nicholasf/69865 to your computer and use it in GitHub Desktop.
Save nicholasf/69865 to your computer and use it in GitHub Desktop.
module ProfilingUtils
#only cates for vmmap (os x) and pmap (linux)
def ram_footprint
footprint = nil
case `uname`
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