heapy commands
[electrum-server.git] / backends / irc / __init__.py
index e153402..0ec2a8b 100644 (file)
@@ -169,7 +169,7 @@ class ServerProcessor(Processor):
         params = request['params']
         result = None
 
-        if method in ['server.stop', 'server.info']:
+        if method in ['server.stop', 'server.info', 'server.heapy']:
             try:
                 password = request['params'][0]
             except:
@@ -204,12 +204,25 @@ class ServerProcessor(Processor):
 
         elif method == 'server.cache':
             p = self.dispatcher.request_dispatcher.processors['blockchain']
-            result = len(repr(p.store.tx_cache))
+            result = len(repr(p.history_cache))
 
         elif method == 'server.load':
             p = self.dispatcher.request_dispatcher.processors['blockchain']
             result = p.queue.qsize()
 
+        elif method == 'server.heapy':
+            try:
+                s = request['params'][1]
+            except:
+                s = None
+
+            if s:
+                from guppy import hpy
+                h = hpy()
+                try:
+                    result = str(eval(s))
+                except:
+                    result = "error"
         else:
             print_log("unknown method", request)