From: Forrest Voight Date: Thu, 22 Mar 2012 16:49:58 +0000 (-0400) Subject: added graph of hash rate as estimated by shares found X-Git-Tag: 0.10.4~39 X-Git-Url: https://git.novaco.in/?p=p2pool.git;a=commitdiff_plain;h=121dd4ae78a37dfa69d10ee9a833b85756d6c34b added graph of hash rate as estimated by shares found --- diff --git a/p2pool/main.py b/p2pool/main.py index 99ceb9b..927315f 100644 --- a/p2pool/main.py +++ b/p2pool/main.py @@ -441,6 +441,7 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint): pseudoshare_received = variable.Event() + share_received = variable.Event() local_rate_monitor = math.RateMonitor(10*60) class WorkerBridge(worker_interface.WorkerBridge): @@ -667,6 +668,8 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint): shared_share_hashes.add(share.hash) except: log.err(None, 'Error forwarding block solution:') + + share_received.happened(bitcoin_data.target_to_average_attempts(share.target), not on_time) if pow_hash > target: print 'Worker %s submitted share with hash > target:' % (request.getUser(),) @@ -689,7 +692,7 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint): get_current_txouts = lambda: p2pool_data.get_expected_payouts(tracker, current_work.value['best_share_hash'], current_work.value['bits'].target, current_work2.value['subsidy'], net) - web_root = web.get_web_root(tracker, current_work, current_work2, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, args.worker_fee, p2p_node, my_share_hashes, recent_blocks, pseudoshare_received) + web_root = web.get_web_root(tracker, current_work, current_work2, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, args.worker_fee, p2p_node, my_share_hashes, recent_blocks, pseudoshare_received, share_received) worker_interface.WorkerInterface(WorkerBridge()).attach_to(web_root) deferral.retry('Error binding to worker port:', traceback=False)(reactor.listenTCP)(worker_endpoint[1], server.Site(web_root), interface=worker_endpoint[0]) diff --git a/p2pool/web.py b/p2pool/web.py index d6d33ec..b285e99 100644 --- a/p2pool/web.py +++ b/p2pool/web.py @@ -44,7 +44,7 @@ def _atomic_write(filename, data): os.remove(filename) os.rename(filename + '.new', filename) -def get_web_root(tracker, current_work, current_work2, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, worker_fee, p2p_node, my_share_hashes, recent_blocks, pseudoshare_received): +def get_web_root(tracker, current_work, current_work2, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, worker_fee, p2p_node, my_share_hashes, recent_blocks, pseudoshare_received, share_received): start_time = time.time() web_root = resource.Resource() @@ -392,6 +392,8 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad hd = graph.HistoryDatabase.from_obj({ 'local_hash_rate': graph.DataStreamDescription(False, dataview_descriptions), 'local_dead_hash_rate': graph.DataStreamDescription(False, dataview_descriptions), + 'local_share_hash_rate': graph.DataStreamDescription(False, dataview_descriptions), + 'local_dead_share_hash_rate': graph.DataStreamDescription(False, dataview_descriptions), 'pool_rate': graph.DataStreamDescription(True, dataview_descriptions), 'pool_stale_rate': graph.DataStreamDescription(True, dataview_descriptions), 'current_payout': graph.DataStreamDescription(True, dataview_descriptions), @@ -411,6 +413,12 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad hd.datastreams['miner_hash_rates'].add_datum(t, {user: work}) if dead: hd.datastreams['miner_dead_hash_rates'].add_datum(t, {user: work}) + @share_received.watch + def _(work, dead): + t = time.time() + hd.datastreams['local_share_hash_rate'].add_datum(t, work) + if dead: + hd.datastreams['local_dead_share_hash_rate'].add_datum(t, work) def add_point(): if tracker.get_height(current_work.value['best_share_hash']) < 720: return diff --git a/web-static/graphs.html b/web-static/graphs.html index 649b3fb..63d431a 100644 --- a/web-static/graphs.html +++ b/web-static/graphs.html @@ -36,6 +36,9 @@

Local rate - Blue=All, Red=Dead (hash/second)

+

Local rate reflected in shares - Blue=All, Red=Dead (hash/second)

+ +

Current payout (BTC)

@@ -181,6 +184,10 @@ {"data": getData("/web/graph_data/local_hash_rate/last_" + lowerperiod), "value_getter": identity, "color": "#0000FF"}, {"data": getData("/web/graph_data/local_dead_hash_rate/last_" + lowerperiod), "value_getter": identity, "color": "#FF0000"} ]); + plot(d3.select("#local_shares"), [ + {"data": getData("/web/graph_data/local_share_hash_rate/last_" + lowerperiod), "value_getter": identity, "color": "#0000FF"}, + {"data": getData("/web/graph_data/local_dead_share_hash_rate/last_" + lowerperiod), "value_getter": identity, "color": "#FF0000"} + ]); plot(d3.select("#payout"), [ {"data": getData("/web/graph_data/current_payout/last_" + lowerperiod), "value_getter": identity, "color": "#0000FF"} ]);