mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Don't request work too early for CPUs as CPUs will scan for the full opt_scantime anyway.
This commit is contained in:
parent
6045c4d161
commit
7e7a5f777e
12
main.c
12
main.c
@ -2401,14 +2401,20 @@ static void *miner_thread(void *userdata)
|
|||||||
bool needs_work = true;
|
bool needs_work = true;
|
||||||
/* Try to cycle approximately 5 times before each log update */
|
/* Try to cycle approximately 5 times before each log update */
|
||||||
const unsigned long cycle = opt_log_interval / 5 ? : 1;
|
const unsigned long cycle = opt_log_interval / 5 ? : 1;
|
||||||
/* Request the next work item at 2/3 of the scantime */
|
int request_interval;
|
||||||
unsigned const int request_interval = opt_scantime * 2 / 3 ? : 1;
|
|
||||||
unsigned const long request_nonce = MAXTHREADS / 3 * 2;
|
unsigned const long request_nonce = MAXTHREADS / 3 * 2;
|
||||||
bool requested = true;
|
bool requested = true;
|
||||||
uint32_t hash_div = 1;
|
uint32_t hash_div = 1;
|
||||||
|
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
|
/* Request the next work item just before the end of the scantime. We
|
||||||
|
* don't want the work lying around too long since the CPU will always
|
||||||
|
* spend the full scantime */
|
||||||
|
request_interval = opt_scantime - 5;
|
||||||
|
if (request_interval < 1)
|
||||||
|
request_interval = 1;
|
||||||
|
|
||||||
/* Set worker threads to nice 19 and then preferentially to SCHED_IDLE
|
/* Set worker threads to nice 19 and then preferentially to SCHED_IDLE
|
||||||
* and if that fails, then SCHED_BATCH. No need for this to be an
|
* and if that fails, then SCHED_BATCH. No need for this to be an
|
||||||
* error if it fails */
|
* error if it fails */
|
||||||
@ -2554,7 +2560,7 @@ static void *miner_thread(void *userdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeval_subtract(&diff, &tv_end, &tv_workstart);
|
timeval_subtract(&diff, &tv_end, &tv_workstart);
|
||||||
if (!requested && (diff.tv_sec > request_interval || work.blk.nonce > request_nonce)) {
|
if (!requested && (diff.tv_sec >= request_interval || work.blk.nonce > request_nonce)) {
|
||||||
if (unlikely(!queue_request())) {
|
if (unlikely(!queue_request())) {
|
||||||
applog(LOG_ERR, "Failed to queue_request in miner_thread %d", thr_id);
|
applog(LOG_ERR, "Failed to queue_request in miner_thread %d", thr_id);
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user