Make scantime retargeting less granular
This commit is contained in:
parent
0941296571
commit
99084f8be4
1 changed files with 4 additions and 4 deletions
|
@ -539,6 +539,7 @@ static void *miner_thread(void *userdata)
|
||||||
struct work work __attribute__((aligned(128)));
|
struct work work __attribute__((aligned(128)));
|
||||||
unsigned long hashes_done;
|
unsigned long hashes_done;
|
||||||
struct timeval tv_start, tv_end, diff;
|
struct timeval tv_start, tv_end, diff;
|
||||||
|
int diffms;
|
||||||
uint64_t max64;
|
uint64_t max64;
|
||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
|
@ -571,11 +572,10 @@ static void *miner_thread(void *userdata)
|
||||||
hashmeter(thr_id, &diff, hashes_done);
|
hashmeter(thr_id, &diff, hashes_done);
|
||||||
|
|
||||||
/* adjust max_nonce to meet target scan time */
|
/* adjust max_nonce to meet target scan time */
|
||||||
if (diff.tv_usec > 500000)
|
diffms = diff.tv_sec * 1000 + diff.tv_usec / 1000;
|
||||||
diff.tv_sec++;
|
if (diffms > 0) {
|
||||||
if (diff.tv_sec > 0) {
|
|
||||||
max64 =
|
max64 =
|
||||||
((uint64_t)hashes_done * opt_scantime) / diff.tv_sec;
|
((uint64_t)hashes_done * opt_scantime * 1000) / diffms;
|
||||||
if (max64 > 0xfffffffaULL)
|
if (max64 > 0xfffffffaULL)
|
||||||
max64 = 0xfffffffaULL;
|
max64 = 0xfffffffaULL;
|
||||||
max_nonce = max64;
|
max_nonce = max64;
|
||||||
|
|
Loading…
Reference in a new issue