Skip to content

Commit

Permalink
added orphan share rate graph
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Sep 17, 2013
1 parent 97ade2b commit 0460c6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 13 additions & 2 deletions p2pool/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time
import traceback

from twisted.internet import defer
from twisted.internet import defer, reactor
from twisted.python import log
from twisted.web import resource, static

Expand Down Expand Up @@ -376,6 +376,7 @@ def get_total_pool_rate(t):
'local_dead_hash_rate': graph.DataStreamDescription(dataview_descriptions, is_gauge=False),
'local_share_hash_rate': graph.DataStreamDescription(dataview_descriptions, is_gauge=False),
'local_dead_share_hash_rate': graph.DataStreamDescription(dataview_descriptions, is_gauge=False),
'local_orphan_share_hash_rate': graph.DataStreamDescription(dataview_descriptions, is_gauge=False),
'pool_rates': graph.DataStreamDescription(dataview_descriptions, multivalues=True,
multivalue_undefined_means_0=True),
'current_payout': graph.DataStreamDescription(dataview_descriptions),
Expand Down Expand Up @@ -406,11 +407,21 @@ def _(work, dead, user):
if dead:
hd.datastreams['miner_dead_hash_rates'].add_datum(t, {user: work})
@wb.share_received.watch
def _(work, dead):
def _(work, dead, share_hash):
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 later():
res = node.tracker.is_child_of(share_hash, node.best_share_var.value)
if res is None: return # share isn't connected to sharechain?
if res and dead: # share was DOA, but is now in sharechain
# remove from DOA graph
hd.datastreams['local_dead_share_hash_rate'].add_datum(t, -work)
elif not res and not dead: # share wasn't DOA, and isn't in sharechain
# add to orphan graph
hd.datastreams['local_orphan_share_hash_rate'].add_datum(t, work)
reactor.callLater(200, later)
@node.p2p_node.traffic_happened.watch
def _(name, bytes):
hd.datastreams['traffic_rate'].add_datum(time.time(), {name: bytes})
Expand Down
2 changes: 1 addition & 1 deletion p2pool/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def _(err):
except:
log.err(None, 'Error forwarding block solution:')

self.share_received.happened(bitcoin_data.target_to_average_attempts(share.target), not on_time)
self.share_received.happened(bitcoin_data.target_to_average_attempts(share.target), not on_time, share.hash)

if pow_hash > target:
print 'Worker %s submitted share with hash > target:' % (user,)
Expand Down
3 changes: 2 additions & 1 deletion web-static/graphs.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ <h2>Memory Usage</h2>
]);
plot_later(d3.select("#local_shares"), "H/s", "H", [
{"url": "../web/graph_data/local_share_hash_rate/last_" + lowerperiod, "color": "#0000FF", "label": "Total"},
//{"url": getData("../web/graph_data/local_dead_share_hash_rate/last_" + lowerperiod, "color": "#FF0000", "label": "Dead"}
{"url": "../web/graph_data/local_dead_share_hash_rate/last_" + lowerperiod, "color": "#FF0000", "label": "Dead"},
{"url": "../web/graph_data/local_orphan_share_hash_rate/last_" + lowerperiod, "color": "#00FF00", "label": "Orphan"}
]);
plot_later(d3.select("#payout"), currency_info.symbol, null, [
{"url": "../web/graph_data/current_payout/last_" + lowerperiod, "color": "#0000FF"}
Expand Down

0 comments on commit 0460c6c

Please sign in to comment.