added per-miner graphs
[p2pool.git] / p2pool / web.py
index 59c32d7..acc38b3 100644 (file)
@@ -391,6 +391,8 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad
         'current_payout': graph.DataStreamDescription(True, dataview_descriptions),
         'incoming_peers': graph.DataStreamDescription(True, dataview_descriptions),
         'outgoing_peers': graph.DataStreamDescription(True, dataview_descriptions),
+        'miner_hash_rates': graph.DataStreamDescription(False, dataview_descriptions, {}, math.add_dicts, math.mult_dict),
+        'miner_dead_hash_rates': graph.DataStreamDescription(False, dataview_descriptions, {}, math.add_dicts, math.mult_dict),
     }, hd_obj)
     task.LoopingCall(lambda: _atomic_write(hd_path, json.dumps(hd.to_obj()))).start(100)
     @pseudoshare_received.watch
@@ -399,6 +401,10 @@ 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)
+        if user is not None:
+            hd.datastreams['miner_hash_rates'].add_datum(t, {user: work})
+            if dead:
+                hd.datastreams['miner_dead_hash_rates'].add_datum(t, {user: work})
     def add_point():
         if tracker.get_height(current_work.value['best_share_hash']) < 720:
             return