Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Created August 21, 2015 18:10
Show Gist options
  • Select an option

  • Save NigoroJr/145cdea0cd46be99514e to your computer and use it in GitHub Desktop.

Select an option

Save NigoroJr/145cdea0cd46be99514e to your computer and use it in GitHub Desktop.
#!/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