From 8766bca4d4144ea2fd6bd39ba32f85207649a802 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 4 Jul 2012 23:57:54 +1000 Subject: [PATCH] Queue extra work at 2/3 differently depending on whether we're using nonce range or not. --- driver-bitforce.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/driver-bitforce.c b/driver-bitforce.c index 18ee8932..75dc432a 100644 --- a/driver-bitforce.c +++ b/driver-bitforce.c @@ -425,23 +425,33 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 bitforce->wait_ms = 0; ret = bitforce_send_work(thr, work); - /* Initially wait 2/3 of the average cycle time so we can request more - work before full scan is up */ - sleep_time = (2 * bitforce->sleep_ms) / 3; - ms_to_timeval(sleep_time, &tdiff); - if (!restart_wait(&tdiff)) - return 1; + if (!bitforce->nonce_range) { + /* Initially wait 2/3 of the average cycle time so we can request more + work before full scan is up */ + sleep_time = (2 * bitforce->sleep_ms) / 3; + ms_to_timeval(sleep_time, &tdiff); + if (!restart_wait(&tdiff)) + return 1; - bitforce->wait_ms += sleep_time; - queue_request(thr, false); + bitforce->wait_ms += sleep_time; + queue_request(thr, false); - /* Now wait athe final 1/3rd; no bitforce should be finished by now */ - sleep_time = bitforce->sleep_ms - sleep_time; - ms_to_timeval(sleep_time, &tdiff); - if (!restart_wait(&tdiff)) - return 1; + /* Now wait athe final 1/3rd; no bitforce should be finished by now */ + sleep_time = bitforce->sleep_ms - sleep_time; + ms_to_timeval(sleep_time, &tdiff); + if (!restart_wait(&tdiff)) + return 1; - bitforce->wait_ms += sleep_time; + bitforce->wait_ms += sleep_time; + } else { + sleep_time = bitforce->sleep_ms; + ms_to_timeval(sleep_time, &tdiff); + if (!restart_wait(&tdiff)) + return 1; + /* queue extra request once more than 2/3 is done */ + if (work->blk.nonce > 0xffffffff / 3 * 2) + queue_request(thr, false); + } if (ret) ret = bitforce_get_result(thr, work);