Skip to content

Instantly share code, notes, and snippets.

@m4rkw
Created October 24, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4rkw/1dcdbb3dfe63b29b5343b70a28ce1c5b to your computer and use it in GitHub Desktop.
Save m4rkw/1dcdbb3dfe63b29b5343b70a28ce1c5b to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'mechanize'
def meminfo
pid, size = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)
return size
end
x = 0
while 1
Mechanize.start do |mech|
mech.user_agent_alias = 'Mac Safari'
page = mech.get 'https://www.google.com'
end
m = meminfo
if m != x
x = m
p x
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment