Created
January 6, 2014 19:14
-
-
Save rhenning/8288077 to your computer and use it in GitHub Desktop.
Watch JVM heap utilization
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/env ruby | |
## run like: tail --lines=0 --follow=name /var/log/tomcat6/gc.log | this_ruby_script | |
ARGF.each do |line| | |
if match = /secs\]\s\d+K-\>(\d+)K\((\d+)K\)/.match(line) | |
heap_cur = match[1] | |
heap_lim = match[2] | |
heap_pct = heap_cur.to_f / heap_lim.to_f * 100.0 | |
puts "#{heap_cur} / #{heap_lim} KiB : #{heap_pct}%" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment