Skip to content

Instantly share code, notes, and snippets.

@flyerhzm
Created September 22, 2009 09:45
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 flyerhzm/190949 to your computer and use it in GitHub Desktop.
Save flyerhzm/190949 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
pid = `ps | grep script/serve[r] | awk '{ print $1 }'`.chomp
puts "Server PID: #{pid}"
url = ARGV.last
puts "URL: #{url}"
puts "Hit enter to go."
$stdin.gets
def get_memory_usage(pid)
`ps -o rss,vsz -p#{pid} | tail -n1`.chomp
end
puts "Initial Memory Usage: #{get_memory_usage(pid)}"
1000.times do
system %Q{wget -O/dev/null -o/dev/null #{url}}
end
puts "Final Memory Usage: #{get_memory_usage(pid)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment