1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Revert "Reuse times extracted from the clock in bflsc_get_results."

This reverts commit 1d8235334d.

Monotonic clock does not return the same times as gettimeofday.
This commit is contained in:
Con Kolivas 2013-08-19 17:59:59 +10:00
parent 1d8235334d
commit dddc2d1e60

View File

@ -1387,7 +1387,6 @@ static void *bflsc_get_results(void *userdata)
struct cgpu_info *bflsc = (struct cgpu_info *)userdata; struct cgpu_info *bflsc = (struct cgpu_info *)userdata;
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data); struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data);
struct timeval elapsed, now; struct timeval elapsed, now;
cgtimer_t ts_start;
float oldest, f; float oldest, f;
char buf[BFLSC_BUFSIZ+1]; char buf[BFLSC_BUFSIZ+1];
int err, amount; int err, amount;
@ -1402,13 +1401,14 @@ static void *bflsc_get_results(void *userdata)
} }
while (sc_info->shutdown == false) { while (sc_info->shutdown == false) {
cgtimer_t ts_start;
if (bflsc->usbinfo.nodev) if (bflsc->usbinfo.nodev)
return NULL; return NULL;
dev = -1; dev = -1;
oldest = FLT_MAX; oldest = FLT_MAX;
cgsleep_prepare_r(&ts_start); cgtime(&now);
cgtimer_to_timeval(&now, &ts_start);
// Find the first oldest ... that also needs checking // Find the first oldest ... that also needs checking
for (i = 0; i < sc_info->sc_count; i++) { for (i = 0; i < sc_info->sc_count; i++) {
@ -1420,12 +1420,10 @@ static void *bflsc_get_results(void *userdata)
} }
} }
if (bflsc->usbinfo.nodev) { if (bflsc->usbinfo.nodev)
/* To clean up the setup timer */
cgsleep_ms_r(&ts_start, 0);
return NULL; return NULL;
}
cgsleep_prepare_r(&ts_start);
if (dev == -1) { if (dev == -1) {
/* Sleep for only half a work period before checking /* Sleep for only half a work period before checking
* again. */ * again. */
@ -1433,7 +1431,7 @@ static void *bflsc_get_results(void *userdata)
continue; continue;
} }
copy_time(&sc_info->sc_devs[dev].last_check_result, &now); cgtime(&(sc_info->sc_devs[dev].last_check_result));
readok = bflsc_qres(bflsc, buf, sizeof(buf), dev, &err, &amount, false); readok = bflsc_qres(bflsc, buf, sizeof(buf), dev, &err, &amount, false);
if (err < 0 || (!readok && amount != BFLSC_QRES_LEN) || (readok && amount < 1)) { if (err < 0 || (!readok && amount != BFLSC_QRES_LEN) || (readok && amount < 1)) {
@ -1441,13 +1439,10 @@ static void *bflsc_get_results(void *userdata)
} else { } else {
que = process_results(bflsc, dev, buf, &nonces); que = process_results(bflsc, dev, buf, &nonces);
sc_info->not_first_work = true; // in case it failed processing it sc_info->not_first_work = true; // in case it failed processing it
if (que > 0 || nonces > 0) {
cgtime(&now);
if (que > 0) if (que > 0)
copy_time(&sc_info->sc_devs[dev].last_dev_result, &now); cgtime(&(sc_info->sc_devs[dev].last_dev_result));
if (nonces > 0) if (nonces > 0)
copy_time(&sc_info->sc_devs[dev].last_nonce_result, &now); cgtime(&(sc_info->sc_devs[dev].last_nonce_result));
}
// TODO: if not getting results ... reinit? // TODO: if not getting results ... reinit?
} }