Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pass reference time for hash rate calculation
  • Loading branch information
m0mchil committed Oct 17, 2012
1 parent 867fdf7 commit 060441f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions BFLMiner.py
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions Miner.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion OpenCLMiner.py
Expand Up @@ -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()
Expand Down

0 comments on commit 060441f

Please sign in to comment.