Commit 5a8ac9fdafbfa3dcaf6415d8e5c250705be6fefb

Con Kolivas 2013-09-25T22:22:05

Meter out return of estimated hashes in BF1 to smooth out visible hashrate.

diff --git a/driver-bitfury.c b/driver-bitfury.c
index 58839ad..d56b80b 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -199,9 +199,8 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
 {
 	struct cgpu_info *bitfury = thr->cgpu;
 	struct bitfury_info *info = bitfury->device_data;
-	int64_t hashes = 0;
-	char buf[45];
 	int amount, i;
+	char buf[45];
 
 	buf[0] = 'W';
 	memcpy(buf + 1, work->midstate, 32);
@@ -238,15 +237,15 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
 		memcpy(&nonce, info->buf + i + 3, 4);
 		nonce = decnonce(nonce);
 		if (bitfury_checkresults(thr, info->prevwork1, nonce)) {
-			hashes += 0xffffffff;
+			info->nonces++;
 			continue;
 		}
 		if (bitfury_checkresults(thr, info->prevwork2, nonce)) {
-			hashes += 0xffffffff;
+			info->nonces++;
 			continue;
 		}
 		if (bitfury_checkresults(thr, work, nonce)) {
-			hashes += 0xffffffff;
+			info->nonces++;
 			continue;
 		}
 	}
@@ -256,7 +255,11 @@ cascade:
 	info->prevwork2 = info->prevwork1;
 	info->prevwork1 = copy_work(work);
 	work->blk.nonce = 0xffffffff;
-	return hashes;
+	if (info->nonces) {
+		info->nonces--;
+		return (int64_t)0xffffffff;
+	}
+	return 0;
 }
 
 static void bitfury_flush_work(struct cgpu_info __maybe_unused *bitfury)
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 96ec889..72bc267 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -21,6 +21,7 @@ struct bitfury_info {
 	struct work *prevwork2;
 	char buf[512];
 	int tot;
+	int nonces;
 };
 
 #endif /* BITFURY_H */