Created
August 21, 2015 18:10
-
-
Save NigoroJr/145cdea0cd46be99514e to your computer and use it in GitHub Desktop.
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/env ruby | |
| def measure | |
| `uptime`.split(' ')[-3].chop.to_f | |
| end | |
| max = -1 | |
| maxes = [] | |
| loop do | |
| current_load = measure | |
| if max < current_load | |
| max = current_load | |
| maxes << max | |
| maxes = maxes.sort.last(5).reverse | |
| end | |
| begin | |
| sleep 1 | |
| rescue Interrupt | |
| puts 'Quitting' | |
| puts maxes | |
| exit 0 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment