Created
February 9, 2010 18:36
-
-
Save mrinterweb/299496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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