-
-
Save bjonord/1c6a599fefefd7f6d081 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/env ruby | |
hits_ = nil | |
misses_ = nil | |
loop do | |
`redis-cli info | grep keyspace` =~ /hits:(\d+).*misses:(\d+)/m | |
hits, misses = $1.to_i, $2.to_i | |
if hits_ | |
dhits = hits - hits_ | |
dmisses = misses - misses_ | |
puts "%d: %.02f%% (%d / %d)" % [Time.now.to_i, dhits * 100.0 / (dhits + dmisses), | |
dhits, dmisses] | |
end | |
hits_ = hits | |
misses_ = misses | |
sleep 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment