self.putChild('poolrate_day', Renderer(lambda: ['--lower-limit', '0', '-M', '-E', '--start', '-1d',
'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last day)',
+ 'DEF:C=%s.stalerate:stalerate:AVERAGE' % (self.grapher.path,), 'LINE1:C#FF0000:Total stale (last day)',
'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last day)']))
self.putChild('poolrate_week', Renderer(lambda: ['--lower-limit', '0', '-M', '-E', '--start', '-1w',
'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last week)',
+ 'DEF:C=%s.stalerate:stalerate:AVERAGE' % (self.grapher.path,), 'LINE1:C#FF0000:Total stale (last week)',
'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last week)']))
self.putChild('poolrate_month', Renderer(lambda: ['--lower-limit', '0', '-M', '-E', '--start', '-1m',
'DEF:A=%s.poolrate:poolrate:AVERAGE' % (self.grapher.path,), 'LINE1:A#0000FF:Total (last month)',
+ 'DEF:C=%s.stalerate:stalerate:AVERAGE' % (self.grapher.path,), 'LINE1:C#FF0000:Total stale (last month)',
'DEF:B=%s.localrate:localrate:AVERAGE' % (self.grapher.path,), 'LINE1:B#0000FF:Local (last month)']))
def get_lines():
'RRA:AVERAGE:0.5:7:288', # last week
'RRA:AVERAGE:0.5:30:288', # last month
)
+ if not os.path.exists(self.path + '.stalerate'):
+ rrdtool.create(self.path + '.stalerate', '--step', '300',
+ 'DS:stalerate:GAUGE:600: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
+ )
if not os.path.exists(self.path + '.localrate'):
rrdtool.create(self.path + '.localrate', '--step', '300',
'DS:localrate:ABSOLUTE:43200:U:U',
'RRA:AVERAGE:0.5:30:288', # last month
)
- def add_poolrate_point(self, poolrate):
+ def add_poolrate_point(self, poolrate, stalerate):
rrdtool.update(self.path + '.poolrate', '-t', 'poolrate', 'N:%f' % (poolrate,))
+ rrdtool.update(self.path + '.stalerate', '-t', 'stalerate', 'N:%f' % (stalerate,))
def add_localrate_point(self, hashes, dead):
rrdtool.update(self.path + '.localrate', '-t', 'localrate', 'N:%f' % (hashes,))
def add_point():
if tracker.get_height(current_work.value['best_share_hash']) < 720:
return
- grapher.add_poolrate_point(p2pool_data.get_pool_attempts_per_second(tracker, current_work.value['best_share_hash'], 720)
- / (1 - p2pool_data.get_average_stale_prop(tracker, current_work.value['best_share_hash'], 720)))
+ nonstalerate = p2pool_data.get_pool_attempts_per_second(tracker, current_work.value['best_share_hash'], 720)
+ poolrate = nonstalerate / (1 - p2pool_data.get_average_stale_prop(tracker, current_work.value['best_share_hash'], 720))
+ grapher.add_poolrate_point(poolrate, poolrate - nonstalerate)
task.LoopingCall(add_point).start(100)
reactor.listenTCP(args.worker_port, server.Site(web_root))