From f3b6e68609ba204af36402c9edddcca6f52f1469 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Sat, 17 Mar 2012 01:41:47 -0400 Subject: [PATCH] added pool rate to graphs --- p2pool/web.py | 11 ++++++++++ web-static/graphs.html | 53 +++++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/p2pool/web.py b/p2pool/web.py index 74c2d3e..866eeb6 100644 --- a/p2pool/web.py +++ b/p2pool/web.py @@ -351,6 +351,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), + 'pool_rate': graph.DataStreamDescription(True, dataview_descriptions), + 'pool_stale_rate': graph.DataStreamDescription(True, dataview_descriptions), }, hd_obj) def _atomic_write(filename, data): open(filename + '.new', 'w').write(data) @@ -362,6 +364,15 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad hd.datastreams['local_hash_rate'].add_datum(t, work) if dead: hd.datastreams['local_dead_hash_rate'].add_datum(t, work) + def add_point(): + if tracker.get_height(current_work.value['best_share_hash']) < 720: + return + 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)) + t = time.time() + hd.datastreams['pool_rate'].add_datum(t, poolrate) + hd.datastreams['pool_stale_rate'].add_datum(t, poolrate - nonstalerate) + task.LoopingCall(add_point).start(5) new_root.putChild('graph_data', WebInterface(lambda source, view: json.dumps(hd.datastreams[source].dataviews[view].get_data(time.time())), 'application/json')) web_root.putChild('static', static.File(os.path.join(os.path.dirname(sys.argv[0]), 'web-static'))) diff --git a/web-static/graphs.html b/web-static/graphs.html index 87f8374..e874b22 100644 --- a/web-static/graphs.html +++ b/web-static/graphs.html @@ -38,17 +38,33 @@

P2Pool Graphs

-

Last hour

-
+

Local rate - Blue=All, Red=Dead

-

Last day

-
+

Last hour

+
-

Last week

-
+

Last day

+
-

Last month

-
+

Last week

+
+ +

Last month

+
+ +

Pool rate - Blue=All, Red=Stale

+ +

Last hour

+
+ +

Last day

+
+ +

Last week

+
+ +

Last month

+
-- 1.7.1