Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created February 9, 2010 18:36
Show Gist options
  • Save mrinterweb/299496 to your computer and use it in GitHub Desktop.
Save mrinterweb/299496 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# This script will find how much memory is currently be used by Chromium on *nix systems
lines = `ps aux | grep Chromium`.split(/\n/)
total_mem = 0
regex = Regexp.new('^'+("([^\s]+\s+)"*6)+'.*')
lines.each do |line|
matches = line.match(regex)
if matches
total_mem += matches[6].to_i
end
end
p "Total Mem: #{total_mem/1024}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment