added graph of local dead hash rate
authorForrest Voight <forrest@forre.st>
Sat, 14 Jan 2012 22:29:47 +0000 (17:29 -0500)
committerForrest Voight <forrest@forre.st>
Sat, 14 Jan 2012 22:29:47 +0000 (17:29 -0500)
p2pool/graphs.py
p2pool/main.py

index 5a2bd6b..40337f3 100644 (file)
@@ -44,18 +44,26 @@ else:
             self.grapher = grapher
             
             self.putChild('', self)
+            
             self.putChild('poolrate_day', Renderer('--lower-limit', '0', '--start', '-1d',
-                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Pool hash rate (last day)'))
+                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last day)',
+                'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last day)'))
             self.putChild('poolrate_week', Renderer('--lower-limit', '0', '--start', '-1w',
-                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Pool hash rate (last week)'))
+                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last week)',
+                'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last week)'))
             self.putChild('poolrate_month', Renderer('--lower-limit', '0', '--start', '-1m',
-                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Pool hash rate (last month)'))
+                'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last month)',
+                'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last month)'))
+            
             self.putChild('localrate_day', Renderer('--lower-limit', '0', '--start', '-1d',
-                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Local hash rate (last day)'))
+                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last day)',
+                'DEF:B=%s.localdeadrate:localdeadrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#FF0000:Dead (last day)'))
             self.putChild('localrate_week', Renderer('--lower-limit', '0', '--start', '-1w',
-                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Local hash rate (last week)'))
+                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last week)',
+                'DEF:B=%s.localdeadrate:localdeadrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#FF0000:Dead (last week)'))
             self.putChild('localrate_month', Renderer('--lower-limit', '0', '--start', '-1m',
-                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Local hash rate (last month)'))
+                'DEF:A=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last month)',
+                'DEF:B=%s.localdeadrate:localdeadrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#FF0000:Dead (last month)'))
         
         def render_GET(self, request):
             if not request.path.endswith('/'):
@@ -87,12 +95,20 @@ else:
                     'RRA:AVERAGE:0.5:7:288', # last week
                     'RRA:AVERAGE:0.5:30:288', # last month
                 )
+            if not os.path.exists(self.path + '.localdeadrate'):
+                rrdtool.create(self.path + '.localdeadrate', '--step', '300', '--no-overwrite',
+                    'DS:localdeadrate:ABSOLUTE:43200:U:U',
+                    'RRA:AVERAGE:0.5:1:288', # last day
+                    'RRA:AVERAGE:0.5:7:288', # last week
+                    'RRA:AVERAGE:0.5:30:288', # last month
+                )
         
         def add_poolrate_point(self, poolrate):
             rrdtool.update(self.path + '.poolrate', '-t', 'poolrate', 'N:%f' % (poolrate,))
         
-        def add_localrate_point(self, hashes):
+        def add_localrate_point(self, hashes, dead):
             rrdtool.update(self.path + '.localrate', '-t', 'localrate', 'N:%f' % (hashes,))
+            rrdtool.update(self.path + '.localdeadrate', '-t', 'localdeadrate', 'N:%f' % (hashes if dead else 0,))
         
         def get_resource(self):
             return Resource(self)
index e18d040..d17fff7 100644 (file)
@@ -562,7 +562,7 @@ def main(args, net, datadir_path):
                     p2p_shares([share])
                 
                 if pow_hash <= target:
-                    reactor.callLater(1, grapher.add_localrate_point, bitcoin_data.target_to_average_attempts(target))
+                    reactor.callLater(1, grapher.add_localrate_point, bitcoin_data.target_to_average_attempts(target), not on_time)
                 
                 if pow_hash > target:
                     print 'Worker submitted share with hash > target:'