Forked from antirez/Redis interactive memory usage changes reporting script.rb
Created
January 4, 2010 19:52
-
-
Save jperras/268801 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 python | |
import redis | |
from optparse import OptionParser | |
from time import sleep | |
def options(): | |
parser = OptionParser() | |
parser.add_option("--host", default="localhost") | |
parser.add_option("--port", type="int", default=6379) | |
return parser.parse_args() | |
if __name__ == '__main__': | |
(opts, args) = options() | |
r = redis.Redis(host=opts.host, port=opts.port) | |
um = 0 | |
while True: | |
newum = r.info()['used_memory'] | |
if newum != um and um != 0: | |
print('%d bytes (%d difference)') % (um, newum - um) | |
um = newum | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment