Permalink
Browse files

pass reference time for hash rate calculation

  • Loading branch information...
1 parent 867fdf7 commit 060441f2aff186798bfb3c07eedc7bc3a9280a7c @m0mchil committed Oct 17, 2012
Showing with 4 additions and 5 deletions.
  1. +2 −2 BFLMiner.py
  2. +1 −2 Miner.py
  3. +1 −1 OpenCLMiner.py
View
@@ -188,9 +188,9 @@ def mining_thread(self):
iterations += 4294967296
t = now - last_rated
if t > self.options.rate:
- self.update_rate(iterations, t, targetQ)
+ self.update_rate(now, iterations, t, targetQ)
last_rated = now; iterations = 0
-
+
if result != b'NO-NONCE\n':
r.nonces = result
self.switch.put(r)
View
@@ -27,8 +27,7 @@ def stop(self, message = None):
if message: print '\n%s' % message
self.should_stop = True
- def update_rate(self, iterations, t, targetQ, rate_divisor=1000):
- now = time()
+ def update_rate(self, now, iterations, t, targetQ, rate_divisor=1000):
self.rate = int((iterations / t) / rate_divisor)
self.rate = Decimal(self.rate) / 1000
if self.accept_hist:
View
@@ -219,7 +219,7 @@ def mining_thread(self):
t = now - last_rated
if t > self.options.rate:
- self.update_rate(threads_run, t, work.targetQ, rate_divisor)
+ self.update_rate(now, threads_run, t, work.targetQ, rate_divisor)
last_rated = now; threads_run = 0
queue.finish()

0 comments on commit 060441f

Please sign in to comment.