Created
March 10, 2011 18:33
-
-
Save mrinterweb/864606 to your computer and use it in GitHub Desktop.
Find total amount of memory used by chromium/chrome
This file contains hidden or 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 | |
| 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